Topics

fiona.transform.transform - different behavior based on GDAL version


calebrob6@...
 

Hi all,

I'm observing different behavior from fiona.transform.transform based on the underlying gdal version. 

Steps to reproduce
```
conda create --name test python gdal fiona # this installs gdal 3.0.2 and fiona 1.8.13.post1
conda activate test
python
>>> import fiona.transform
>>> fiona.transform.transform("epsg:4326", "epsg:3857", [-75.71], [38.06])
([4236819.819591993], [-13244913.18166699])
```

If I switch the lat/lon position then I get the correct result (http://epsg.io/transform#s_srs=4326&t_srs=3857&x=-75.7169053&y=38.0624956):
```
>>> fiona.transform.transform("epsg:4326", "epsg:3857", [38.06], [-75.71])
([-8427998.647958742], [4587905.271362515])
```

If I instead do the conda install with a gdal version less than 3 I get the expected result:
```
conda create --name test2 python "gdal<3" fiona # this installs gdal 2.3.3 and fiona 1.8.4
conda activate test2
python
>>> fiona.transform.transform("epsg:4326", "epsg:3857", [-75.71], [38.06])
([-8427998.647958742], [4587905.27136252])
```

Is this known / should I open an Issue on github?

Thanks,
Caleb


Joshua Arnott
 

Hi Caleb,

I can reproduce your issue with the master branch on Travis by adding a test based on the code you provided.


Please can you raise an issue on GitHub for this? Include your examples. https://github.com/Toblerity/Fiona/issues

There are a few places this problem could be coming from as it involves the interaction with Fiona, GDAL and PROJ.

Josh


On Tue, 14 Jul 2020 at 20:32, <calebrob6@...> wrote:
Hi all,

I'm observing different behavior from fiona.transform.transform based on the underlying gdal version. 

Steps to reproduce
```
conda create --name test python gdal fiona # this installs gdal 3.0.2 and fiona 1.8.13.post1
conda activate test
python
>>> import fiona.transform
>>> fiona.transform.transform("epsg:4326", "epsg:3857", [-75.71], [38.06])
([4236819.819591993], [-13244913.18166699])
```

If I switch the lat/lon position then I get the correct result (http://epsg.io/transform#s_srs=4326&t_srs=3857&x=-75.7169053&y=38.0624956):
```
>>> fiona.transform.transform("epsg:4326", "epsg:3857", [38.06], [-75.71])
([-8427998.647958742], [4587905.271362515])
```

If I instead do the conda install with a gdal version less than 3 I get the expected result:
```
conda create --name test2 python "gdal<3" fiona # this installs gdal 2.3.3 and fiona 1.8.4
conda activate test2
python
>>> fiona.transform.transform("epsg:4326", "epsg:3857", [-75.71], [38.06])
([-8427998.647958742], [4587905.27136252])
```

Is this known / should I open an Issue on github?

Thanks,
Caleb


Alan Snow
 

I am betting it has to do with axis order changes with PROJ 6+ and GDAL 3+:
You can see a similar issue raised for pyproj here: https://github.com/pyproj4/pyproj/issues/538


calebrob6@...
 

Thanks! For completeness, I just opened it here https://github.com/Toblerity/Fiona/issues/919.

Best,
Caleb