TransWikia.com

Spatial Join Geospatial data returning empty data frame

Geographic Information Systems Asked by eun ji on March 12, 2021

I am trying to spatial join two GeoDataFrames.

This is how the dataframes look like:

enter image description here

enter image description here

I wanted to find the points within each region, but I got back an empty data frame.

east_region = gdf[gdf['REGION_N']=='EAST REGION']

north_region = gdf[gdf['REGION_N']=='NORTH REGION']

central_region = gdf[gdf['REGION_N']=='CENTRAL REGION']

west_region = gdf[gdf['REGION_N']=='WEST REGION']

northeast_region = gdf[gdf['REGION_N']=='NORTH-EAST REGION']

gpd.sjoin(data_geo, east_region, op='within')

The CRS is the same 4326 for both GeoDataFrames and when I plotted on the maps, it is clear that there are points within the north region etc.

I coded these in Google Colab.

One Answer

The WKT geometries in your point geometries in the first dataframe suggest you are mixing up the lat and lng when you are creating those geometries. They should be POINT(lng lat) and it looks like you are generating POINT(lat lng)

Answered by Jeremy Malczyk on March 12, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP