Linked Questions

0 votes
0 answers
29 views

Iterating in a points geodataframe and then check if point is inside polygon [duplicate]

I'm trying to make a spatial verification. I have a geodataframe with 245 points, and I'm having a bad time trying to check if they're inside a polygon or not. I've been attempting this code, but I ...
Rodrigo Brust's user avatar
22 votes
3 answers
85k views

Check if a point falls within a multipolygon with Python

I have tried several examples of code using libraries such as shapefile, fiona, and ogr to attempt to check whether a point (x, y) falls within the boundaries of a multipolygon created with ArcMap (...
spartmar's user avatar
  • 553
15 votes
4 answers
11k views

How to efficiently access the features returned by QgsSpatialIndex?

The PyQGIS Cookbook explains how to set up the spatial index but it only explains half of its usage: create spatial index — the following code creates an empty index index = QgsSpatialIndex() add ...
underdark's user avatar
  • 83.6k
12 votes
3 answers
6k views

geopandas error "minimums more than maximums"

I posted this question on stackoverflow here, but it seems that gis.stackexchange is the more appropriate platform. I am trying to merge two geodataframes in geopandas (want to see which polygon each ...
Alexis Eggermont's user avatar
12 votes
2 answers
43k views

Filter a GeoPandas dataframe for points within a specific country

I have a dataframe of health survey data which is geotagged, called momdata. I have converted the dataframe to a GeoPandas dataframe, and used the geotags as the geometry column within the dataframe, ...
LucieCBurgess's user avatar
9 votes
2 answers
12k views

Maximizing Code Performance for Shapely

I've written this code in order to calculate the percent cover of grassland within a national park, within 20km^2 of points of recorded occurrences for a species. It is designed to only consider the ...
CSB's user avatar
  • 1,274
9 votes
3 answers
6k views

RTree spatial index does not result in faster intersection computation

I have some code that I am using to determine which Shapely Polygon/MultiPolygons intersect with a number of Shapely LineStrings. Through the answers to this question the code has gone from this: ...
derNincompoop's user avatar
9 votes
2 answers
6k views

Is there a python option to "join attributes by location"?

I am trying to perform the function join attributes by location as found on the QGIS menu Vector>Data Management Tools. I am seeking an open source python option for this. I know arcpy has a spatial ...
mishaF's user avatar
  • 193
4 votes
1 answer
9k views

How To Properly Implement a Bounding Box for Shapely & Fiona?

I am trying to spatially analyze two layers within same GDB file using Python / Shapely. Another user was kind enough to give me a procedure to go by in trying to reduce the number of senseless ...
George's user avatar
  • 511
1 vote
1 answer
4k views

Problem intersecting shapefiles with OGR in Python

I'm trying to move from ArcPy for geoprocessing. After searching some posts, I found this solution using the GDAL/OGR Python bindings: Intersect Shapefiles using Shapely My code is the following: ...
Ernesto561's user avatar
1 vote
2 answers
6k views

Point in Polygon - geojson - using Shapely / Python returning incorrect results

I'm trying to test if a point is inside a polygon using this example: https://stackoverflow.com/questions/20776205/point-in-polygon-with-geojson-in-python However, my output says that none of the ...
pceccon's user avatar
  • 113
2 votes
1 answer
4k views

Geopandas Intersects Speed

I have recently started using Geopandas and am having a problem with the performance of intersects. The intersect tests whether land parcels have a road within (or across the boundary). Parcel data (...
Mr_Robinini's user avatar
1 vote
1 answer
4k views

Fastest way to join many points to many polygons in python

I need to attribute a geographical area (based on shapefile polygons) to 8 million GPS points. There are 405 polygons. I currently have the code below, and a quick extrapolation tells me it will take ...
Alexis Eggermont's user avatar
3 votes
1 answer
4k views

Counting number of points in each grid?

I would like to count the number of points in each cell. I have tried https://docs.scipy.org/doc/numpy/reference/generated/numpy.histogram2d.html but the out isn't appropriate. Does anybody know how I ...
Danial's user avatar
  • 81
1 vote
1 answer
7k views

Performing Spatial Join / match Points from dataframe to polygons using Python?

I have a dataframe with coordinates and other attributes, and a shp file (the whole package with shx and dbf as well) with many polygons of neighborhoods. I need to match each point to which polygon ...
pentatomic's user avatar

15 30 50 per page