File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -189,12 +189,12 @@ def create_layer_from_data_input(
189189
190190 # Anything with __arrow_c_stream__
191191 if hasattr (data , "__arrow_c_stream__" ):
192- data = cast (ArrowStreamExportable , data )
192+ data = cast (" ArrowStreamExportable" , data )
193193 return _viz_geoarrow_table (pa .table (data ), ** kwargs )
194194
195195 # Anything with __geo_interface__
196196 if hasattr (data , "__geo_interface__" ):
197- data = cast (GeoInterfaceProtocol , data )
197+ data = cast (" GeoInterfaceProtocol" , data )
198198 return _viz_geo_interface (data .__geo_interface__ , ** kwargs )
199199
200200 # GeoJSON dict
Original file line number Diff line number Diff line change @@ -13,11 +13,27 @@ def test_viz_wkb_geoarrow():
1313
1414
1515def test_viz_reproject ():
16- gdf = gpd .read_file (gpd . datasets .get_path ("nybb" ))
16+ gdf = gpd .read_file (geodatasets .get_path ("nybb" ))
1717 map_ = viz (gdf )
1818
1919 # Assert table was reprojected
2020 first_coord = map_ .layers [0 ].table ["geometry" ][0 ][0 ][0 ][0 ]
2121 expected_coord = - 74.05050951794041 , 40.56643026026788
2222 assert (first_coord [0 ].as_py () - expected_coord [0 ]) < 0.0001
2323 assert (first_coord [1 ].as_py () - expected_coord [1 ]) < 0.0001
24+
25+
26+ def test_viz_geo_interface ():
27+ class GeoInterfaceHolder :
28+ def __init__ (self , geom ) -> None :
29+ self .geom = geom
30+
31+ @property
32+ def __geo_interface__ (self ):
33+ return self .geom .__geo_interface__
34+
35+ gdf = gpd .read_file (geodatasets .get_path ("nybb" )).to_crs ("EPSG:4326" )
36+ geo_interface_obj = GeoInterfaceHolder (gdf .geometry [0 ])
37+ map_ = viz (geo_interface_obj )
38+
39+ assert isinstance (map_ .layers [0 ], SolidPolygonLayer )
You can’t perform that action at this time.
0 commit comments