[GIS] Scaling x,y coordinates in proj4

coordinate systemcoordinatesproj

This question was asked before on Stack Overflow.

Let's say we have mercator map with given resolution (for simplicity in centimeters).

Now let's get coordinates of (lat,lon) = (50, 15):

$ proj +proj=merc +ellps=WGS84
50 15
5565974.54      1678147.52

Since we don't know the boundaries, we can't scale it to desired resolution.

The only way I've found to get boundaries is compute the coordinates for (lat, lon) = (180, 0) and (0, 90), but that's more like a hack and it's not universal (other projections might map only from (±90, ±90)).

Does proj4 deal with scaling differently?

Best Answer

I think you may be confusing Mercator XY with the image pixel XY.

The Mercator XYs you are seeing in proj4 are derived from the Mercator formula where the intersection of the Equator and Prime Meridian is 0,0. Those Mercator XYs have nothing to do with the scale of your map.

If you're looking to convert lat/longs to the XY pixel location of an image, see the answer to this question here.

Related Question