I have a kml file with multi-geometries (points and polygons). I want to access only the polygons present inside the kml file.
I tried reading the kml file using Geopandas-
inputfile = 'path to kml file' fiona.supported_drivers['KML'] = 'rw' sp = gpd.read_file(inputfile, driver='KML')
here 'sp' variable only reads the point features present inside the kml file. I tried using 'Geometry' argument along with the driver argument, but still only the point features are read.
Can anyone help me in accessing the 'Polygon' entities in the kml file?
I had this same question today! I was obtaining the KML through a URL response however, so I was able to "remove" the point data prior to writing it as a kml file (now only with polygon data). This is what I did:
This got me a geodataframe with a column of names, description and geometry for the polygons only. In your case, you may have to find a way to read in the kml, then edit it as I did above, before reconstructing and passing to geopandas. Good luck.