I am able to open the google KML sample by running:
ds = gdal.OpenEx( fn, 0 )
But when using a specific file that I get from my country's database, it doesn't work. I've solved the problem by converting the file into a GPX using GPSBabel but I am sure there must be a better way of doing it. By the way when I run on my .gpx:
from osgeo import gdal, ogr # File converted from KML to GPX by GPSBabel. fn = r"D:\Downloads\POT_DONDE_VIVE_LA_GENTE.gpx" ds = gdal.OpenEx( fn, 0 ) cnt = ds.GetLayerCount() for i in range( 0, cnt ): print( ds.GetLayer(i).GetExtent() )
(0.0, 0.0, 0.0, 0.0) (0.0, 0.0, 0.0, 0.0) (0.0, 0.0, 0.0, 0.0) (0.0, 0.0, 0.0, 0.0) (0.0, 0.0, 0.0, 0.0)
That tells me that there must something wrong. The file works perfectly when using the ArcGISWebViewer.
So my questions are, how can I read KML files that output:
IOError: Could not open 'fileName'
with GDAL/OSGEO?, and if the only way is to convert them first to a different file format(how to it within python?) how can I be sure that the output of the conversion matches the original file?