33 questions linked to/from More Efficient Spatial join in Python without QGIS, ArcGIS, PostGIS, etc
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 ...
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 (...
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 ...
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 ...
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, ...
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 ...
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: ...
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 ...
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 ...
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: ...
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 ...
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 (...
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 ...
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 ...
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 ...