Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Projection support for vector sources #226

Open
orangemug opened this issue Jun 17, 2019 · 2 comments
Open

Projection support for vector sources #226

orangemug opened this issue Jun 17, 2019 · 2 comments

Comments

@orangemug
Copy link
Contributor

I wanted to use vector tiles with another projection other than EPSG:3857, so here's my take on how we could add support for that.

Support two new fields ol:projection/ol:extent, extentions to the mapbox-gl style spec. So an example source would look like this

{
  "sources": {
    "us_states": {
      "type": "vector",
      "tiles": ["https://orangemug.github.io/vector-tiles-projection-test/vectortiles/EPSG102003/{z}/{x}/{y}.pbf"],
      "ol:projection": "102003",
      "ol:extent": [
        -2357180.9345227931626141,
        -1295390.5666783656924963,
        2257301.1407301435247064,
        1560376.8365237235557288
      ],
      "minZoom": 0,
      "maxZoom": 2
    }
  }
}

The idea of namespacing with ol:extent instead of just extent is presumably the spec might support extent in future in a different format.

There is a branch which supports this new extension over at master...orangemug:feature/add-projections, happy to raise a PR if you like the approach.

I've also added this to a Maputnik branch, you can see a demo action and see a write up here maplibre/maputnik#529 .

Let me know your thoughts

@orangemug
Copy link
Contributor Author

Hi @ahocevar I wonder if there is any interest in adding the functionality mentioned this ticket? It seems to work really well in Maputnik with projections enabled (see demo). I'm happy to help in any way I can to get projections supported.

@mike-000
Copy link
Contributor

mike-000 commented Jul 5, 2020

Maptiler has sample code https://cloud.maptiler.com/maps/ (login to get access to the code) using tiles designed for non-EPSG:3857 projections where the tilegrid options are hardcoded. Ordnance Survey have an EPSG:27700 example which creates the tilegrid from the json https://github.com/OrdnanceSurvey/OS-Data-Hub-API-Demos/blob/master/OSVectorTileAPI/OpenLayers/map.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants