We were provided with a few geotagged photos, from those photos we were expected to mark more classification points around the region for the classes like water, built-up and barren land.

I was able to import those images into google earth using a KML file format using this link. I further went on to mark and label required points around the region. This was done using google earth placemarks. I exported the KML file which has this format.

    <name>Barren land</name>

Now I want to create a classifier with these labels.

My query is how to convert Google Earth Placemark KML to shapefile with proper labels for classification using a code in python and not a tool?


As for converting KML to SHP you can use an open source library GDAL. For conversion in command line tool you can type:

ogr2ogr -f 'ESRI Shapefile' output.shp input.kml

Of course you can put this in bash script. But if you really need to have this done in python, you can call command in you python script:

import os
os.system("ogr2ogr -f 'ESRI Shapefile' output.shp input.kml")

In my opinion using Google Earth is not most suitable tool to do the classification on imagery. If you need to stick to free and open source tools I would recommend QGIS, where you can do manual classification (creating shapefiles manually). Maybe there also are some tools for automatic classification, but I'm not aware of them.

You can also use more professional tools like ArcGIS, Erdas Imagine or ENVI, in which you can manually classify data on your imagery or use tools and options for automatic classification.

More on classification basics can be easily done with googling, e.g. http://gisgeography.com/image-classification-techniques-remote-sensing/

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.