2

I want to define a custom CRS for a very special, technical use-case. For that I use a WGS84-World-Mercator as base definition, here are the proj4 parameters taken von QGIS:

+proj=merc +lon_0=0 +k=1 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs

For my custom CRS, I wish to have positive coordinates for any point in the world and all coordinates should be within the range of 0 and 1. The coordinate origin should be in the north-west corner of the Mercator.

To scale all coordinates within the range [0, 1], I use the parameter +to_meter=40075016.68557849 while leaving the scale factor k_0=1 and removing the metric units=m.

+proj=merc +lon_0=0 +k_0=1 +to_meter=40075016.68557849 +x_0=0 +y_0=0 +datum=WGS84 +no_defs

So far, so good, now the tricky part: How to create a coordinate origin at the north-west corner (North Pole)? Taking pen and paper, I found the solution is setting +lat_0=90 and lon_0=-180, like that:

+proj=merc +lon_0=-180 +lat_0=90 +k_0=1 +to_meter=40075016.68557849 +x_0=0 +y_0=0 +datum=WGS84 +no_defs

However, that creates weird results:

  1. The +lat_0=90 basicly does nothing to whatever value it gets set. Why?
  2. The +lon_0=-180 does behave like setting it to plus +180°, but I explicitly want the negative value from a mathematical view.

I know that plus and minus 180° are the same meridian on the map, but technically the difference with the minus is important for me.

How to create a CRS with coordinate origin at the north-west corner of the Mercator projection and only positive coordinates throught out the whole map? Is inverting the y-axis the issue here? Is chosing a World Mercator as base the wrong approach?

  • I'm sure I'm misunderstanding, but you know that Mercator can't map the North Pole, right? It's coordinate would be infinite in the y direction. You could try doing a rigid rotation first, or, as you mention, using a different projection (eg, equiangular). – barrycarter Oct 7 '16 at 14:24
2

The Mercator projection has no North bound, the North pole is in infinity. Apart from that, for Proj.4 the origin of the Mercator projection must be on the equator, see http://geotiff.maptools.org/proj_list/mercator_1sp.html.

What you can do, is set a false Northing to your projection, so that the equator is at 20037508 meters. This will set the equators coordinate to 0.5. Same works for a false Easting:

+proj=merc +k_0=1 +to_meter=40075016.68557849 +x_0=20037508.34 +y_0=20037508.34 +datum=WGS84 +no_defs

This attempt will fail if you have map features North or South of 85.0511° North/South, but that's the oddity of this projection.

  • Okay thanks, this is very close to what I need. I can live with the restrictions at the poles. But is it somehow possible to inverse the y-axis? Currently 52° N is 0.66, but it should be 0.33. – Waqar Lim Oct 7 '16 at 18:42
  • +proj=merc +k_0=1 +to_meter=40075016.68557849 +x_0=20037508.34 +y_0=-20037508.34 +datum=WGS84 +axis=esu +no_defs might be what you are looking for, but QGIS displays it upside down, – AndreJ Oct 8 '16 at 5:27
  • Thanks, the one in the comment is exactly what I was looking for. – Waqar Lim Oct 17 '16 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.