Setting `accuracy` parameter in the `pyproj.Transformer` class
See original GitHub issueThis is a question about how to set the accuracy
parameter in the Transformer
class.
I have UK Northing/Easting (EPSG:27700) data held in the variable DATA
and would like to project this to WGS 84 (EPSG:4326) to a given level of accuracy using pyproj
as set out in the following code snippet:
from pyproj import Transformer, CRS
from shapely.ops import transform
transformer = Transformer.from_crs(DATA.crs, CRS.from_epsg(4326), always_xy=True)
From the API I understand that the Transformer
accuracy parameter is in metres and defaults to -1.0
. If I wanted to set this accuracy to an arbitrary distance, say, 0.5m, how do I do this?
My naïve attempts to set the value as below fail with a can't set attribute
error:
-1.0
>>> transformer.accuracy = 0.5
Traceback (most recent call last):
AttributeError: can't set attribute
>>> transformer['accuracy'] = 0.5
Traceback (most recent call last):
AttributeError: can't set attribute
I have looked and couldn’t see answer in the usual places.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Transformer - pyproj 3.4.1 documentation - GitHub Pages
The Transformer class is for facilitating re-using transforms without needing ... New in version 3.1.0: authority, accuracy, allow_ballpark ... Parameters:.
Read more >Transformer — pyproj 3.1.0 documentation - GitHub Pages
The pyproj.Transformer has the capabilities of performing 2D, 3D, and 4D (time) transformations. It can do anything that the PROJ command line programs...
Read more >Source code for pyproj.transformer - GitHub Pages
From PROJ docs:: The operations are sorted with the most relevant ones first: by descending area (intersection of the transformation area with the...
Read more >Transformer — pyproj 2.4.0 documentation - GitHub Pages
The Transformer class is for facilitating re-using transforms without needing to re-create them. The goal is to make repeated transforms faster.
Read more >Proj - pyproj 3.4.1 documentation - GitHub Pages
A Proj class instance is initialized with proj map projection control parameter key/value pairs. The key/value pairs can either be passed in a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The accuracy is just for information. So, no behavior change.
numpy can help with the decimal precision: https://numpy.org/devdocs/reference/generated/numpy.around.html#numpy.around
https://www.explainxkcd.com/wiki/index.php/2170:_Coordinate_Precision