I want to use ogr2ogr command line to convert KML files to shapefile file, however, I can't get correct shapefile when I type the ogr2ogr convert command.
However, I can succeed in converting the continent.shp to correct KML file inside ArcGIS software by means of ogr2ogr. Besides, the conversion between acquired KML file in last step to shapefile.
I guess maybe my KML file is not the strict standard format. So I paste the KML file contents.
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:gml="http://www.opengis.net/gml"
xmlns:xfdu="urn:ccsds:schema:xfdu:1"
xmlns:safe="http://www.esa.int/safe/sentinel-1.0"
xmlns:s1="http://www.esa.int/safe/sentinel-1.0/sentinel-1"
xmlns:s1sar="http://www.esa.int/safe/sentinel-1.0/sentinel-1/sar"
xmlns:s1sarl1="http://www.esa.int/safe/sentinel-1.0/sentinel-1/sar/level-1"
xmlns:s1sarl2="http://www.esa.int/safe/sentinel-1.0/sentinel-1/sar/level-2"
xmlns:gx="http://www.google.com/kml/ext/2.2">
<Document>
<name>Sentinel-1 Map Overlay</name>
<Folder>
<name>Sentinel-1 Scene Overlay</name>
<GroundOverlay>
<name>Sentinel-1 Image Overlay</name>
<Icon>
<href>quick-look.png</href>
</Icon>
<gx:LatLonQuad>
<coordinates>-113.892487,68.977577 -124.235062,69.902451 -122.225281,73.452110 -109.974060,72.393707</coordinates>
</gx:LatLonQuad>
</GroundOverlay>
</Folder>
</Document>
</kml>
I don't know the reason to the conversion problems. Could you give me some advice?
Best Answer
Conversion fails because GDAL is trying to read the data as GML instead of KML. You can see that this happens by running your command with GDAL debug flag.
KML is XML as well as GML and now GDAL selects for some reason wrong driver for this data. Conversion succeeds if it is run with the GDAL_SKIP configuration option https://trac.osgeo.org/gdal/wiki/ConfigOptions
What is odd is that ogrinfo opens the data correctly as KML without a need to skip the GML driver.
The shapefile contains the footprint of the image and a link to image file. There is really nothing more in the KML file. If ArcGIS finds something more, please tell what.