geopandasfiona

AttributeError: 'NoneType' object has no attribute 'drvsupport' when using Fiona driver


when I run the following code:

import geopandas as gpd
from shapely.geometry import Point, Polygon
import pandas as pd

gpd.io.file.fiona.drvsupport.supported_drivers['KML'] = 'rw'
my_map = gpd.read_file('mymap.kml', driver='KML')
my_map

I get this error:

    gpd.io.file.fiona.drvsupport.supported_drivers['KML'] = 'rw'
AttributeError: 'NoneType' object has no attribute 'drvsupport'

Can anyone please help to solve this issue?


Solution

  • Recent versions of geopandas import fiona dynamically, and gpd.io.file.fiona is initially None.

    My fix was to change to:

    from fiona.drvsupport import supported_drivers
    supported_drivers['LIBKML'] = 'rw'