# This is a test for from_features function, which # in geopandas reads the __geo_interface__ from other libraries. # This test currently fails. # 2015-09-17 I'm using a recent development version of geopandas import geopandas as gpd class geoEmptyClass: pass global_cities = geoEmptyClass() global_cities.__geo_interface__ = { "type": "FeatureCollection", "features": [ { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 2.3508, 48.8567 ] }, "properties": { "name": "Paris" } }, { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ 114.2, 22.3 ] }, "properties": { "name": "Hong Kong" } } ] } london_gi = geoEmptyClass() london_gi.__geo_interface__ = { "type": "Feature", "geometry": { "type": "Point", "coordinates": [ -0.1275, 51.507222 ] }, "properties": { "name": "London" } } if __name__ == "__main__": # this works fine df_london = gpd.GeoDataFrame.from_features([london_gi]) # from_features currently fails because geopandas doesn't currently # support reading FeatureCollections from the __geo_interface__ df_cities = gpd.GeoDataFrame.from_features([global_cities])