I have a county KML file, and it works under QGIS, but I need to split the file according to a data field. How do I do this?

an example county within the file is below:

-87.5135193,36.3346596,0 -87.5236130,36.2488365,0 -87.5314636,36.2496452,0 -87.5304031,36.2323189,0 -87.5665894,36.1778755,0 -87.5722122,36.1787834,0 -87.5737915,36.1821823,0 -87.5783463,36.1830215,0 -87.5765457,36.1892662,0 -87.5866699,36.1927223,0 -87.5859604,36.1976433,0 -87.6621780,36.2011719,0 -87.6871872,36.2174225,0 -87.7073898,36.2271118,0 -87.7311096,36.2354279,0 -87.7579727,36.2414665,0 -87.7984848,36.2447014,0 -87.8353958,36.2323036,0 -87.9495773,36.2431030,0 -87.9442673,36.2641182,0 -87.9476166,36.2852516,0 -87.9571533,36.3149757,0 -87.9617233,36.3226204,0 -87.9686203,36.3271790,0 -87.9706497,36.3385658,0 -87.9811859,36.3537102,0 -87.9500046,36.3523712,0 -87.9449615,36.3540916,0 -87.9264908,36.3449669,0 -87.8928146,36.3346596,0 -87.8615417,36.3298187,0 -87.8217926,36.3286705,0 -87.7844162,36.3340721,0 -87.7562637,36.3429108,0 -87.7227859,36.3603096,0 -87.7154694,36.3681870,0 -87.5923462,36.3676109,0 -87.5869598,36.3417320,0 -87.5135193,36.3346596,0 

In <name>TN_Houston</name> I need to break the KML based on the first two characters. The result is multiple files each based on those two first characters. For example a TN.kml that would include the above polygon and all other TN_* polygons.

Here is a link to the file: https://www.dropbox.com/s/z0ufczir7zs9py0/cnt_us.kml?dl=0

  • Could you upload the file you are trying to split somwhere? – the_darkside Dec 11 '16 at 20:50

In QGIS you can split the KML. Click Vector > Data Management Tools > Split Vector layer. Choose the field and then the output folder. This will not require you to change the file type.


You could convert your KML file including its attributes to a shapefile and then use Split tool in ArcMap to split it manually.

You could also use the below link which is an extension to ArcMap to split the shapefile:


  • The question asked for a way to split KML in QGIS, and you're offering an ArcGIS script for shapefiles? – Vince Dec 11 '16 at 21:58
  • 2
    It could also be done in qgis. Load kml, save as Shapefile, split, export as kml – DirkB. Dec 11 '16 at 22:41

Attention! QGIS: Click Vector > Data Management Tools > Split Vector layer, split KML into several shapefiles, not into several KML files.

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.