Sunday, 7 January 2018

coordinate system - Create Mercator map with arbitrary center/orientation?


I want to see a Mercator map where I choose what latitude/longitude is in the center and what direction is "north". In some sense, a Mercator map of a rigid rotation of the globe.


Does such a program/site exist? I'm familiar with Mercator Rotator, but this appears to be vaporware. I'm working on a project like this myself, and want to see if I'm duplicating anything.



Same general question for other projections.



Answer



You don't say which software you're using, but in general you can use the Proj4 library (for which there are bindings for many popular languages) to create a transformation from one CRS to another.


Proj4 has an Oblique Mercator projection type that is just what you're looking for. Its parameters are described here. For example, this definition:


+proj=omerc +k=1.0 +lat_0=52.0 +alpha=23.0 +lonc=-4.0

Puts the centre of the projection at 52N 4W, and rotates it 23 degrees clockwise. You can also specify the centre and rotation parameters in terms of a great circle.


There are potential problems however, and you'll have to handle your data with care because you can easily end up with wrap-around problems at the projection's anti-meridian. For example, the World Borders datset looks like this normally:


world borders projected in EPSG:4326


And with our Oblique Mercator defined above, it looks like this:



enter image description here


Everything is good apart from the vertical lines, which is where the data wraps around and causes QGIS (in this case) problems when it comes to render.


There are also caveats in the Proj4 documentation that say it will fail if the parameters nearly define a regular or transverse Mercator, but it looks like you'll have to use trial-and-error to see to what tolerance it can go to.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...