@snowman2 one more: Ever experienced a bug in rasterio/GDAL where it drops some of the projection parameters? I have a WKT rasterio CRS object that has the Latitude of natural origin and Longitude of natural origin for a
laea
projection, but after saving to a geotiff with rasterio it has those parameters set to 0
Huh, I haven't seen that. But, definitely something to be concerned about.
PROJ/pyproj have no way of guessing the datum from a PROJ string unless it is explicitly set.
I believe PROJ has assumed defaults. GRS80 is a common one IIRC. In the docs I see it quite a bit example aea.
Looks like that was ellps not datum. Not sure about the internals on how PROJ matches the datum.
from pyproj import Proj, transform
import time
start = time.time()
outProj = Proj(init='epsg:3003')
inProj = Proj("+proj=cass +lat_0=43.318293 +lon_0=11.332212 +x_0=0.000000000000000 +y_0=0.000000000000000 +datum=WGS84 +units=m +no_defs")
x = 61759.831
y = -41125.585
ret = transform(inProj, outProj, y, x)
stop = time.time()
print "TIME: {}".format(stop - start)
print ret
TIME: 0.00243186950684
(1646302.7175562638, 4859396.617420217)
TIME: 0.000527143478394
(1646302.7175562638, 4859396.617420217)
I hope this can help..
v 1.9.6:
TIME: 0.000527143478394
(1646302.7175562638, 4859396.617420217)
v 2.0.0
TIME: 0.0132768154144
(1646279.7128513593, 4859469.284666889)
v 2.0.1
TIME: 0.0472819805145
(1646279.7128513593, 4859469.284666889)
v 2.1.0
TIME: 0.0480349063873
(1646279.7128513593, 4859469.284666889)
v 2.1.1
TIME: 0.0479390621185
(1646279.7128513593, 4859469.284666889)
v 2.1.2
TIME: 0.142739057541
(1646302.7175560538, 4859396.61741957)
v 2.1.3
TIME: 0.149616956711
(1646302.7175560538, 4859396.61741957)
v 2.2.0
TIME: 0.0712070465088
(1646302.7175560538, 4859396.61741957)
v 2.2.1
TIME: 0.0708930492401
(1646302.7175560538, 4859396.61741957)
v 2.2.2
TIME: 0.0708050727844
(1646302.7175560538, 4859396.61741957)
# https://pyproj4.github.io/pyproj/stable/gotchas.html#upgrading-to-pyproj-2-from-pyproj-1
from pyproj import Transformer
import time
start = time.time()
x = 61759.831
y = -41125.585
transformer = Transformer.from_crs("+proj=cass +lat_0=43.318293 +lon_0=11.332212 +x_0=0.000000000000000 +y_0=0.000000000000000 +datum=WGS84 +units=m +no_defs", "epsg:3003")
ret = transformer.transform(y, x)
stop = time.time()
print "TIME: {}".format(stop - start)
print ret
TIME: 0.0580408573151
(1646302.7175560538, 4859396.61741957)
TIME: 0.0537190437317
(1646302.7175560538, 4859396.61741957)
TIME: 0.0591440200806
(1646302.7175560538, 4859396.61741957)
TIME: 0.0580699443817
(1646302.7175560538, 4859396.61741957)
TIME: 0.0595941543579
(1646302.7175560538, 4859396.61741957)
TIME: 0.0600090026855
(1646302.7175560538, 4859396.61741957)
TIME: 0.059278011322
(1646302.7175560538, 4859396.61741957)
TIME: 0.0588028430939
(1646302.7175560538, 4859396.61741957)
TIME: 0.0584590435028
(1646302.7175560538, 4859396.61741957)
TIME: 0.0585939884186
(1646302.7175560538, 4859396.61741957)
TIME: 0.0572869777679
(1646302.7175560538, 4859396.61741957)
TIME: 0.0574839115143
(1646302.7175560538, 4859396.61741957)
TIME: 0.0569059848785
(1646302.7175560538, 4859396.61741957)
TIME: 0.0589108467102
(1646302.7175560538, 4859396.61741957)
TIME: 0.0600910186768
(1646302.7175560538, 4859396.61741957)
TIME: 0.0592269897461
(1646302.7175560538, 4859396.61741957)
TIME: 0.058445930481
(1646302.7175560538, 4859396.61741957)
TIME: 0.0585761070251
(1646302.7175560538, 4859396.61741957)
TIME: 0.0573010444641
(1646302.7175560538, 4859396.61741957)
TIME: 0.067663192749
(1646302.7175560538, 4859396.61741957)
TIME: 0.0576071739197
(1646302.7175560538, 4859396.61741957)