I have a number of encoded polylines stored in separate database records. I can successfully retrieve each one, decode it and create a single KML file. However, I need to create a KML file that includes all polylines. What I've discovered is that the syntax for both geojson (my intermediate step) and KML are drastically different when you have more than one line segment. None of the libraries I've found create MultiLineStrings (http://geojsonlint.com/#sample-MultiLineString) and the tokml library (https://github.com/mapbox/tokml) doesn't seem to support them as an input anyway.

  • Welcome to GIS SE! As a new user be sure to take the Tour to learn about our focussed Q&A format. For your questions to be answered here they should as much as possible describe not just what you want to do, but precisely what you have tried and where you are stuck trying that. – PolyGeo Aug 31 '16 at 3:22

PolyGeo is spot on asking for more information but I will take a stab at this anyway. By the sounds of it, you are extracting each line from the database singly. I'd recommend doing a bulk operation using ogr2ogr. This way you should be able to read the database and export all lines in one go to KML (or any other format supported by ogr2ogr) with no need of an intermediate step. Here's a tutorial.

Your Answer

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

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