In one layer I have “polygons layer” of all “parcel boundaries”, in another layer I have the “polygon” of “census areas”. And I would need to assign every “parcel boundaries” to the “census areas” belongs to. I have a GeoPackage file “.gpkg”. Geometry is in MULTIPOLYGON format. E.g. MULTIPOLYGON (((595568.124 4417209.48, 595563.754 4417209.48, and so on…..)))

Do you know how can assign parcel boundaries to census areas from MULTIPOLYGON format using Python or find more information? I am reading “.gpkg” file using “geopandas” in Python.

  • 1
    You want to do a Spatial Join. See here (geopandas tutorial) and here (geopandas documentation). Commented Nov 3, 2020 at 13:04
  • 1
    Thank you very much Stefan. It works using Spatial Join. I just had to do the following before to male it work: gdf1 = gdf1.to_crs(epsg=3257) gdf2 = gdf2.to_crs(epsg=3257)
    – Jessica
    Commented Nov 4, 2020 at 17:12
  • Please answer your own question as soon as you are allowed to (I think there is a delay between asking a question and being able to answer). Commented Nov 5, 2020 at 9:00

1 Answer 1


Ids were assigned using a Spatial Join from geopandas:

gdf1 = geopandas.sjoin(gdf1, gdf2, how="inner", op='intersects')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.