Does this projection make my poles look big? |
Spherical Mercator (web mercator) is the most common map projection you'll see. It's a fairly simple unraveling of the earth, but its main purpose is to annoy cartographers. Did you know the EPSG code for Web Mercator stands for "DIAF". True fact. Look it up.
Our users mostly stick with web mercator, but we now let you specify your own custom projection.
Proj.4 CoordinateSystem
Like all the cool kids we use Proj.4 to represent coordinate systems. In theory this allowed us to use a wide variety of systems. In practice, we just used Spherical Mercator, Plate Carree and a very weak geocentric.
Recently we exposed Proj.4 directly with a MaplyProj4CoordSystem. It's simple enough, if you're familiar with Proj.4. Here's an example for British National Grid.
Full disclosure, there's actually a datum grid shift that goes with that for proper BNG. We've shortened it for the example.
You can get these Proj.4 strings from spatialreference.org, among other places. But odds are if you have the need, you already have the string.
British National Grid
The folks at Ordnance Survey were kind enough to help us sort this out. Let's look specifically at the British National Grid, starting with a data source in BNG.
BNG tile source on spherical mercator |
That's a 2D map with a base layer in web mercator (Stamen Watercolor) overlaid with a dummy tile source in BNG. As far as these things go, that's the easy case. Let's look at a more difficult one where the map itself in BNG.
BNG tile source on BNG map |
In this one the map is in BNG with a base layer in web mercator and an overlaid dummy tile source in BNG.
That's pretty cool! Web mercator stretches far outside the boundaries of the BNG system, so we convert the tiles to BNG and toss out any that don't overlap. And it works! But there's more.
BNG tile source on globe |
Okay, not all that difficult as these things go but it looks cool. We're just overlaying a dummy BNG source on the globe.
You can find all of these examples in the AutoTester app for iOS. And there's more...
Android
This is something I hope to say a lot more in the future: Custom map projections are also available on Android in the develop_3_0 branch!
A triptych of British National Grid |
You can find these examples in the AutoTester app for Android. I'll explain AutoTester in more detail soon, but it's already been a great help in development.
Next Up
The hard part here was tracking down the weird corner cases and systems which just don't play well with each other. There are likely to be a few more like that, so let me know what you find.
We've got more map features in the queue, including some vector data display. Stay tuned!
No comments:
Post a Comment