2

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.

<Placemark>
    <name>Barren land</name>
    <LookAt>
        <longitude>78.01311981239444</longitude>
        <latitude>13.13658990287736</latitude>
        <altitude>0</altitude>
        <heading>0.0456062423736624</heading>
        <tilt>30.00023885976806</tilt>
        <range>264.4081533793532</range>
        <gx:altitudeMode>relativeToSeaFloor</gx:altitudeMode>
    </LookAt>
    <styleUrl>#msn_track</styleUrl>
    <Point>
        <gx:drawOrder>1</gx:drawOrder>
        <coordinates>78.01311981239444,13.13658990287736,0</coordinates>
    </Point>
</Placemark>

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?

3

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.