[Proj] implementing inverse equirectangular projection
John Cartwright
John.C.Cartwright at noaa.gov
Fri Jan 12 18:18:39 EST 2007
Hello All,
I'm trying to implement the inverse projection for the equirectangular
(Plate Carree) projection.
The context for this is a map viewer that needs to convert from pixels
to geographic decimal degrees w/ each mouse move. I have the
equirectangular coordinates in meters for the map image. The formula
as described in USGS Bulletin 1532 or MathWorld
(http://mathworld.wolfram.com/CylindricalEquidistantProjection.html)
seems very simple, but I don't seem to be implementing it correctly.
It looks like it should be:
#lon,lat in radians; central meridian in decimal degrees
#R=radius of earth in meters; x,y= projected coordinates in meters
lon = math.radians(centralMeridian) + x
lat = y / R
However, the calculated longitude values are incorrect. GDAL/OSR and
proj4 (naturally) produce correct results. Here's the Well Known Text
I'm using to define the projection:
'PROJCS["World_Plate_Carree", GEOGCS["WGS 84", DATUM["WGS_1984",
SPHEROID["WGS_1984", 6378137.0, 298.257223563]], PRIMEM["Greenwich",
0.0], UNIT["degree",0.017453292519943295]],
PROJECTION["Equirectangular"], PARAMETER["false_easting", 0.0],
PARAMETER["false_northing", 0.0], PARAMETER["Central_Meridian", -180.0],
UNIT["Meter",1.0]]'
and this is the proj4 command I'm using to test:
cs2cs +proj=eqc +lon_0=-180 +datum=WGS84 +to +proj=longlat +datum=WGS84
Can anyone help me out here?
Thanks so much!
-- john
More information about the Proj
mailing list