0

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.

3
  • 1
    You want to do a Spatial Join. See here (geopandas tutorial) and here (geopandas documentation). Nov 3 '20 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
    Nov 4 '20 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). Nov 5 '20 at 9:00
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, privacy policy and cookie policy

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