1

I have a lot of KMLs that include points, lines and polygons together.

Is there a way to automatically parse them into separate shapefiles (one for point, one for line, one for polygon) in QGIS or ArcGIS?

Otherwise I have to go through and delete the other two for each file, which is time consuming.

closed as too broad by PolyGeo Jan 31 '18 at 12:45

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Have you considered using a find and replace within a text editor on the KML directly (using regular expressions/ regex)? There are issues with doing things which are too complex on XML files using this process, but I'm thinking that this would be a simple process for what you are needing... It should be said that I'm not particularly familiar with KML XML and what would matter is how clearly each type of data is distinguished in this. – Rostranimin Apr 16 '15 at 8:59
3

ogr2ogr will (sort of) do it.

Scroll down to "How do I translate a mixed geometry file to shapefile format?"

% ogr2ogr out_point.shp mixed.kml -where 'ogr_geometry = "POINT"'
% ogr2ogr out_line.shp mixed.kml -where 'ogr_geometry = "LINESTRING"'
% ogr2ogr out_poly.shp mixed.kml -where 'ogr_geometry = "POLYGON"'

ogr2ogr converting to shapefile - how to select feature types? covers it as well.

Remember you can install this on windows using OSGEO4W.

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