Proj({'proj': 'eqc', 'lon_0': 0.0, 'lat_0': 0.0})
and it seems to error on Windows with RuntimeError: b'major axis or radius = 0 or not given'
with pyproj 1.9.6 but with pyproj 2.3 it is fine. I would have assumed pyproj/proj to get more strict, not less strict. And I've never seen this error before. FYI this is PROJ 5.2.0 on Windows that fails.
$ conda list proj
# packages in environment at /home/snowal/miniconda3/envs/geocube:
#
# Name Version Build Channel
proj4 5.2.0 he1b5a44_1003 conda-forge
pyproj 1.9.6 py36h516909a_1002 conda-forge
(geocube) snowal@snowal-lx2:~$ python
Python 3.6.7 | packaged by conda-forge | (default, Jul 2 2019, 02:18:42)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyproj import Proj
>>> pj = Proj({'proj': 'eqc', 'lon_0': 0.0, 'lat_0': 0.0})
>>> pj
pyproj.Proj('+units=m +proj=eqc +lon_0=0.0 +lat_0=0.0 ', preserve_units=True)
>>> import pyproj
>>> pyproj.__version__
'1.9.6'
pip install git+https://github.com/pyproj4/pyproj.git
?
@branch-or-tag
Hey all, I'm working on upgrading pyproj from 1.9.4
to a more recent version. But I can't get past a change in output from pyproj.transform
if I go to 2.2.1
and higher.
import pyproj
result = pyproj.transform(pyproj.Proj(init='EPSG:4326'),
pyproj.Proj(init='EPSG:31370'),
-50, -50)
print(result)
# 2.2.1: (-16648000.756625965, -13287157.707139067)
# 1.9.4: (-16647936.738681808, -13287195.77167615)
The outputs are in the comments, and the difference is really too big to ignore.
What exactly is going wrong here?
pyproj.Proj('EPSG:4326')
instead
-50, -50
149372.267141, 175495.954088
vs 149372.214872, 175495.952055
.In [27]: import pyproj
...: result = pyproj.transform(pyproj.Proj(init='EPSG:4326'),
...: pyproj.Proj(init='EPSG:31370'),
...: 4, 50)
...: print(result)
(123563.57130448119, 76585.07875370234)
vs In [14]: import pyproj
...: result = pyproj.transform(pyproj.Proj(init='EPSG:4326'),
...: pyproj.Proj(init='EPSG:31370'),
...: 4, 50)
...: print(result)
(123563.56657479196, 76585.07854289468)
In [17]: import pyproj
...: result = pyproj.transform(pyproj.Proj('EPSG:4326'),
...: pyproj.Proj('+proj=lcc +lat_1=51.16666723333333 +lat_2=49.8333339 +lat_0=90 +lon_0=4.367486666666666 +x_0=150000.013 +y_0=5400088.438 +ellps=intl +towgs84=-106.869,52.2978,-103
...: .724,0.3366,-0.457,1.8422,-1.2747 +units=m +no_defs'),
...: 4, 50, always_xy=True)
...: print(result)
(123563.5712753858, 76585.07851246372)
+towgs84
which is not considered part of the EPSG:31370 definition
Proj
that makes the big difference. # 1.9.4:
# EPSG : (-16647936.738681808, -13287195.77167615)
# proj4: (-16647936.738681808, -13287195.77167615)
# 2.2.1:
# EPSG : (-16648000.756625965, -13287157.707139067)
# proj4: (-16647936.738681737, -13287195.771676153)
do you have other PROJ related libraries installed @joemcglinchy? Like rasterio? cartopy? gdal?
I think it is recommended that you set conda-forge as the channel for the entire environment (I always set it globally) and it is usually best to look in setting a channel_priority to "strict". Otherwise you end up with some packages from the defaults channel and some from conda-forge and they may conflict. What do you get when you do conda install -c conda-forge "pyproj>=2"
? Note that pyproj 2.0+ depends on PROJ 6 so this is higher than the PROJ 5.2 that you want, but it's also the newest version so it'd be a good idea to upgrade now if you can.
@snowman2 Sanity check: PROJ/pyproj have no way of guessing the datum
from a PROJ string unless it is explicitly set.
I realized today that newer versions are automatically converting a/b
to ellps
if it matches a definition (ex.+ellps=GRS80
), but wondering if there is a way to define PROJ parameters to have it do the same for the datum. I'd assume there aren't PROJ parameters to define a datum completely
laea
projection, but after saving to a geotiff with rasterio it has those parameters set to 0