Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
OpenLayers projection support #529
Conversation
|
@orangemug this looks very interesting! Some questions and thoughts (I'm not familiar with ol projections until now):
|
|
Good questions @pathmapper OpenLayers can do 'client-side raster reprojection' of tiles https://openlayers.org/en/latest/examples/reprojection-by-code.html. So in that instance you could in theory have a projection on a source that is different to that of the map. This is only available for raster sources currently however
It's worth noting that as far as I can see client side reprojection has some drawbacks, so it's not a fix all. So either way most of the time you'd want tiles in the maps intended projection anyway. Also worth noting, that at the moment the changes for The I'm pretty novice on all this also, so if anything sounds incorrect it might well be. |
This pull request is the first step towards OpenLayers projection support.
The motivation: I wanted to create a vector map of Antarctica, and couldn't find an easy way to do that. I found a few bit a pieces here and there but the examples I found used 'dirty reprojection' (see https://medium.com/devseed/dirty-reprojectors-1df66e8f308d). Which I wasn't really a fan of because it messes up the lat/lon of the map.
Because OpenLayers has proper projection support (mapbox-gl does not), I thought I have a go at creating some vector tiles in different projections and adding a UI to Maputnik. Here's what I've got so far.
I have a script which generates vector tiles using GDAL from a definition file https://github.com/orangemug/vector-tiles-projection-test/blob/master/definition.json . The definition files specifies a target projection (
epsg) with GDAL auto detecting the source projection.I've had to make some small changes to
ol-mapbox-styleto load the projection from the tilejson openlayers/ol-mapbox-style@master...orangemug:feature/add-projections . I'll raise a ticket in theol-mapbox-stylerepo to try and get these merged over the next couple of weeks. I'm sure there will be changes required because I'm pretty new to OpenLayers.The styles have 2 new keys in the source
projectionandextenthttps://github.com/orangemug/vector-tiles-projection-test/blob/2df924154f7f88b59fb7543d47a6b9972ffc601b/styles/epsg3031.json#L9-L15 which are loaded by the modifiedol-mapbox-styledescribed above.There is also some additional UI in the settings panel
Here's a screenshot of an antarctic map in Maputnik
Also a couple of links to the demos
So how can you all help
Note: This is probably going to be sometime before it's merged, I wanted to get it out there so I can gather feedback and to give me time to try and get the ol-mapbox-style changes upstream. I'm going to switch back over to #521 in the short term to try and improve the performance of Maputnik but this will be moving along slowly in the background.