I'm trying to extract relations from Openstreetmap, using the Overpass Turbo service, saving as a KML file to be viewed on a suitable mobile phone app. I need the resulting KML to have simple geometries for it to work properly on the mobile app.

Relations in OSM can have multiple geometries (e.g. more than one polyline within one relation). An export of data, extracted from OSM using the Overpass-Turbo service, respects this. So the raw KML will be structured like this:

<Placemark> <name>Some name</name> <MultiGeometry> <LineString> <coordinates>1234567890...</coordinates> </LineString> <LineString> <coordinates>

Proper GIS software should be able to cope with this. But KML files are increasingly used for viewing on mobile apps, which may expect the kml file to contain only single polylines. The app 'Maps.me' for example, displays such multi-polylines without gaps between what should be separate parts of the polyline (often making a real mess).

What would be the simplest way to extract data like this from OSM using Overpass, if we need to convert such multi-geometries into simple polylines (or polygons etc) so that they display on less sophisticated apps correctly? Obviously one solution is to bring data into GIS software, using this to manipulate the data, but I'd prefer a solution which avoids the use of GIS software completely. I was aiming to distribute an Overpass-Turbo query to a small number of non-GIS using colleagues, enabling them to use this to extract specific data from OSM themselves to view on their own mobile phones.

  • Overpass Turbo is only a web frontend, the Overpass API ("the real backend") has no idea about KML - this is all done on the fly in your browser by Overpass Turbo. I think you need to revisit your overall architecture if you want to use this in mobile applications. Best would be if you provide the data to your user on your own, to reduce the load on the Overpass instances. Also your question is not clear if KML as generated by overpass turbo is sufficient now, or at what else you're looking. – mmd Jul 12 '18 at 11:08
  • I understand - it hadn't occurred to me that it is Overpass Turbo doing the conversion to KML, but that's fairly obvious now I think about it. The KML from Overpass Turbo is not currently suitable for the people I have in mind - for the reasons above. This is for a small number of people, enabling them to accomplish specific tasks without GIS software, utilising data from OSM and various existing mobile apps to view it. I imagine a negligible load. I also want to be able to do this myself. – Rostranimin Jul 12 '18 at 11:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.