Disagreement between Spatial Index Report in GeoPandas and QGIS #3155
-
I have a GeoPackage files containing a Polygon sheet index which I want to intersect with some geometry to search and download relevant assets. When loading this index into QGIS and checking its properties, it is reported that it has a spatial index. I can also see That being said, the intersection I need to compute takes virtually the same amount of time regardless of whether I do that or not which makes me think that it in fact exists, it’s just that GeoPandas has trouble recognizing it although the underlying libraries can use it just fine. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
GeoPandas is an in-memory analytics library... so all data will typically be loaded in-memory for further processing. Because it does all processing in memory, it will also create its own in-memory spatial index the first time you apply a spatial operation that needs one. Some more info in the documentation of has_sindex. So, GeoPandas will typically not use the spatial index available in the GeoPackage. An exception to this is at the stage when you are reading the data (to memory) using geopandas.read_file:
|
Beta Was this translation helpful? Give feedback.
GeoPandas is an in-memory analytics library... so all data will typically be loaded in-memory for further processing. Because it does all processing in memory, it will also create its own in-memory spatial index the first time you apply a spatial operation that needs one. Some more info in the documentation of has_sindex.
So, GeoPandas will typically not use the spatial index available in the GeoPackage. An exception to this is at the stage when you are reading the data (to memory) using geopandas.read_file:
bbox=
ormask=
you can limit the data being loaded to the rows that intersect with the bbox/geometry mask specified. At this stage the spatial index in the …