Questions tagged [geopandas]

For questions about using GeoPandas in Python

The goal of GeoPandas is to make working with geospatial data in Python easier. It combines the capabilities of Pandas and Shapely, providing geospatial operations in pandas and a high-level interface to multiple geometries to shapely. GeoPandas enables you to easily do operations in python that would otherwise require a spatial database such as PostGIS.

Geometric operations are performed by Shapely. Geopandas further depends on Fiona for file access and Matplotlib for plotting.

http://geopandas.org/

1601 questions
11
votes
2 answers

Casting geometry to MULTI using GeoPandas?

Shapefiles can mix simple POLYGONs and MULTIPOLYGONs in the same data source. Spatial databases like PostGIS and SpatiaLite are strict, and will not put a POLYGON in a MULTIPOLYGON geometry column. I've gotten used to using ST_Multi to fix this…
Lee Hachadoorian
  • 4,605
  • 1
  • 17
  • 43
7
votes
1 answer

Keeping geometry column from both dataframes when applying sjoin() using GeoPandas

I am trying to use sjoin() to spatially join two geo dataframs and then use both geometries for later spatial calculation, however, I noticed that from the official docs, only one geometry column from either side may be kept. df= gpd.sjoin(gdf1,…
flgn
  • 173
  • 1
  • 4
5
votes
2 answers

How to merge polygons using GeoDataFrame?

I would like to merge polygons (parcels) which are inside the white road (which is a hole) -- see the picture. The way I'm doing this is certainly a bad way because later, in my script, I have this error: AttributeError: 'GeoSeries' object has no…
Apatride
  • 51
  • 1
  • 2
4
votes
1 answer

Remove polygons within other polygons in a dataframe

Given a dataframe, is it possible to find polygons that lie within another polygon in the same dataframe and remove them based on a condition? For example, consider the following dataframe geometry …
ashnair1
  • 379
  • 1
  • 4
  • 14
3
votes
3 answers

QGIS -Tool for splitting a big dataset into smaller data sets and store them?

I would like to split a bigger dataset into multiple smaller ones and store the smaller data sets. For example, I have a big point feature data set and would like to split it into, let's say, 4 parts, and then store the 4 smaller datasets. Is there…
i.i.k.
  • 1,427
  • 5
  • 11
3
votes
2 answers

GeoPandas: Smallest Enclosing Circle

There are answers for how to get the geometry of the smallest enclosing circle with QGIS, ArcGIS, and PostGIS, but I haven't come across any way to create a smallest enclosing circle with GeoPandas. The closest I've found is GeoSeries.envelope…
Austin Wolff
  • 205
  • 1
  • 6
3
votes
1 answer

GeoPandas geometry is different on Windows and Linux

Building a same application both on Linux and Windows I noticed that the geometry is handled differently after transferring the dataframe from WGS84 projection to OSM. The results of the program below are different when run on Windows or when run on…
3
votes
1 answer

GeoPandas equivalent of ST_MakePolygon

What is the GeoPandas equivalent of ST_MakePolygon? I want to convert a MULTIPOLYGON to one single polygon. Currently, using GeoPandas.boundary a MultiLineString is returned. How can this one be converted to a regular POLYGON? As far as I understand…
Georg Heiler
  • 401
  • 3
  • 12
2
votes
1 answer

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 (parcels) is a polygon geodataframe and roads…
Mr_Robinini
  • 81
  • 1
  • 4
1
vote
1 answer

Iterate through geodataframes and overlay them to create a single output

I am attempting to iterate through dissolved_result and overlay them using how='intersection' to create a single output file that represents all of the input dissolved_results. I am struggling with how best to do that, this is what I have so far and…
maharg
  • 13
  • 3
1
vote
1 answer

Creating buffer around line segments based on custom values for each line

I have a line shapefile (feature count > 600000) which has three fields: id, geometry, bufferwidth. Which means, each line has its own buffer width. How can I create for each feature a buffer with the relevant bufferwidth and store the created…
i.i.k.
  • 1,427
  • 5
  • 11
1
vote
1 answer

How to do a union rolling window on a GeoDataFrame

I want to get a new GeoDataFrame in which each element is the union of N consecutive elements in my original GeoDataFrame. I'd be very happy if this code worked, but it doesn't: the last step fails. from shapely.geometry import Polygon from…
matiasg
  • 113
  • 4
1
vote
1 answer

Return point feature interpolated from a distance and a line

I am trying to get a point that exists along a line at X distance. I have a geodataframe that is a line feature as line_gdf and from this source Returns a point interpolated along a line using geopandas I determined that I can return a point…
MrKingsley
  • 1,443
  • 13
  • 26
1
vote
1 answer

Efficiently computing distance to large number of geometries

I have a largeish (slightly less than 500000) points and need to compute the distance to the nearest object of a collection of geometries (usually a bunch of polygons, but in one case a bunch of lines). My current approach is to compute the union of…
arnsholt
  • 143
  • 5
1
vote
1 answer

Computing length of polygon segments using geopandas

I have this little issue I am trying to solve and I have looked everywhere for an answer. It seems odd that I cannot find it, but it might just be me. So, I have this dataframe df= id x_zone y_zone 0 A1 65.422080 48.147850 1 A1 …
1
2