This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Is there an API that exports a SVG output?

0

Im aware that using

GET /api/0.6/map?bbox=left,bottom,right,top

Will return a XML or OSM format, but is it possible to reconfigure it to export a raw SVG output, similar to when using the export tab manually to download a SVG file?

asked 17 Mar '20, 20:57

Hyperant's gravatar image

Hyperant
16112
accept rate: 0%


2 Answers:

2

When you click on the "Download" button, after selecting SVG, it will generate this kind of URL : https://render.openstreetmap.org/cgi-bin/export?bbox=2.354260683059693,48.8476459732009,2.3654508590698247,48.8507382415782&scale=2847&format=svg

But as implied in this previous question, there is a token verification against API use, so it work only in your current browser. Also be aware that this kind of exports put a huge load on servers, so be really careful on the area you're trying to export. Probably better to stick to manual selection.

For other solutions about exporting SVG from OSM, have a look at this question, this wiki page, and others. But I don't think you'll find anything about API.

If you need to programmatically render SVG, you're best bet will probably be Maperitive, it's more or less made for that. BBBike use it, so you can test there.

Regards

answered 18 Mar '20, 13:30

H_mlet's gravatar image

H_mlet
5.4k1781
accept rate: 13%

edited 18 Mar '20, 13:31

Thank you for your help.

(18 Mar '20, 18:40) Hyperant

-2

"No"

You need to build actual geometries (not present in "raw" OSM data) and then render them to SVG to achieve that, or use a service that provides that, for example https://extract.bbbike.org/

In general asking people to google solutions for you is not a good strategy and simple pisses them off.

answered 18 Mar '20, 00:00

SimonPoole's gravatar image

SimonPoole ♦
44.7k13326701
accept rate: 18%

Googling was the first thing i did, but as i didn't find much in that regard i decided to make an account here but you did a good job making assumptions.

Passive aggressiveness aside, thanks for the help.

(18 Mar '20, 01:19) Hyperant

Source code available on GitHub .