Closed Zeroto521 closed 2 years ago
The index of returning Topology.to_gdf is not equal to the inputting one.
Topology.to_gdf
import geopandas as gpd from topojson import Topology df = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres")).query( 'continent == "Africa"' ) result = Topology(df, 1).to_gdf(crs=df.crs) print(df.index) # Int64Index([ 1, 2, 11, 12, 13, 14, 15, 25, 26, 48, 49, 50, 51, # 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, # 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 78, 80, # 81, 82, 154, 162, 163, 164, 165, 166, 167, 168, 169, 176], # dtype='int64') print(result.index) # should be `df.index` # RangeIndex(start=0, stop=51, step=1)
Package versions
Thanks for raising the issue. Please see https://github.com/mattijn/topojson/pull/165 where I've implemented this enhancement as feature. Will that work for you?
Thanks for fixing that problem.
The index of returning
Topology.to_gdf
is not equal to the inputting one.Package versions