1

I'd like to implement a custom client-side rendering for OpenStreetMap. For that, I'd need the source data to render. I could use the OSM XML source - but not at higher scales, as the amount of data becomes too high. And most of that data is not needed, as it makes sense to show fewer features at higher zoom levels.

Size of already rendered data is roughly proportional to (bbox area)/zoom^2. Is there an API, and a server providing OSM source data with it, which would also return only about a fixed amount of data for a "fixed viewport size"?

Ideally, I'd like to select the features which I want to see at particular zoom levels, but a server which selects it for me would be also a great start.

5
  • 2
    Have you considered Vector Tiles? That's exactly what their primary use case is. Commented Nov 16, 2017 at 9:44
  • 3
    I'm not convinced that anything can select what data you are interested in without you telling it what sorts of features those are, since they will be different for every potential use case. I'd suggest downloading an extract from one of the links from planet.osm.org , extract the data you want from it (perhaps using wiki.openstreetmap.org/wiki/Osmium or something similar) and make that available on a server you control in the format you want. As noted above this is essentially "vector tiles". The "download, process, use" method is the normal OSM way to do this, not an API. Commented Nov 16, 2017 at 12:22
  • @bugmenot123 yes, OSM vector tiles would be great. Is there anywhere a server which would serve them, maybe for the whole Earth (like the servers which provide rendered OSM)? Commented Nov 16, 2017 at 18:02
  • @SomeoneElse good note, thank you. I silently assumed that the features I'm interested in (roads) are always present in the served data... maybe I'd have to download/build/serve the data myself - which I wanted to avoid (as my focus is on small customizations of "typical" renderings). Commented Nov 16, 2017 at 18:05
  • 2
    Found somewhat related question: gis.stackexchange.com/questions/129864/… Commented Nov 17, 2017 at 16:39

1 Answer 1

1

If you absolutely want an API, then Overpass is probably your best bet: https://wiki.openstreetmap.org/wiki/Overpass_API . There are various instances of it around (read down that page for details) and a couple of query language options. If you want to test it out there's a "download from Overpass" option in JOSM (the de-facto standard standalone OSM editor: https://wiki.openstreetmap.org/wiki/JOSM ).

1
  • 1
    Note that you cannot download all roads worldwide using this approach. In any case, use a planet pbf file for such use cases and do you own post processing locally.
    – mmd
    Commented Nov 18, 2017 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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