Simply use (Converting elevations into correct units with pyproj?, Proj4 String for NAD83(2011) / Louisiana South (ftUS), ...)
preserve_units=True (as you say, pyproj assumes that your coordinates are in meters, therefore)
for northing, easting, up in targets:
print "Converting", easting, northing
# Transform using pyproj (gives wrong answer)
WGS84 = Proj(init='EPSG:4326')
inp = Proj(init='EPSG:2284',preserve_units=True)
...
Results
Converting 11293013.1059 3669486.63386
-79.1537547735 37.3989918968 (with proj4)
-79.153755 37.398992 (using spatialreference.org URL)
Converting 11292972.7283 3669559.13811
-79.1538955003 37.3991902547 (with proj4)
-79.153896 37.39919 (using spatialreference.org URL)
Converting 11292851.4826 3669639.51308
-79.1543148015 37.3994086895 (with proj4)
-79.154315 37.399409 (using spatialreference.org URL)
Converting 11292949.3812 3669800.62304
-79.1539816309 37.3998530254 (with proj4)
-79.153982 37.399853 (using spatialreference.org URL)
Supplementary control with GDAL/OSR
from osgeo import osr
wgs84 = osr.SpatialReference()
wgs84.ImportFromEPSG(4326)
inp= osr.SpatialReference()
inp.ImportFromEPSG(2284)
transformation = osr.CoordinateTransformation(inp,wgs84)
for northing, easting, up in targets:
print transformation.TransformPoint(easting,northing)
(-79.15375477347949, 37.3989918968496, 0.0)
(-79.15389550031416, 37.39919025468435, 0.0)
(-79.15431480154861, 37.39940868945351, 0.0)
(-79.15398163085317, 37.39985302535012, 0.0)
from pyproj import Proj, transform
print(transform(Proj(init='epsg:4326'), Proj(init='epsg:3857'), -0.1285907, 51.50809)) # longitude first, latitude second.
# output (meters east of 0, meters north of 0): (-14314.651244750548, 6711665.883938471)
The "trick" is to use these shortcuts for Web Mercator (EPSG 3857) and WGS 84 longitude and latitude (EPSG 4326). The init
key means "initialize this projection by reading the definition for 3857 from the 'epsg' file."
Best Answer
List pj_list gives you at least projections the
proj
command understands. The EPSG context in the proj.4 biotop is a simple file based "DATABASE" that connects ONLY EPSG number entries (KEYS) with initialization params of the toolproj
. You will find the data in the fileif you use proj.4 and one of it's bindings in LINUX.
Each entry has an EPSG key and a set of proj params. It looks like this. A line beginning with
#
is a comment line and a line beginning with<NUMBER>
is an EPSG data entry. Some example lines:Output (..shorted)
You can use LINUX command line programs like
grep
to retrieve your info by screening the parameter+proj=aea
(aea = Albers Equal Area) and the comments above the EPSG definition.Output (..shorted)
And the parameter meaning of grep is:
You can write a small wrapper in python if you SHELL OUT the grep stuff in combination with the
pj_list
and build your own dictionary. Here a small "dirty" example (..for the shell out part only):