Questions tagged [geopandas]

GeoPandas is an open source project to make working with geospatial data in python easier. GeoPandas extends the datatypes used by pandas to allow spatial operations on geometric types.

GeoPandas is an open source project to make working with geospatial data in python easier. GeoPandas extends the datatypes used by pandas to allow spatial operations on geometric types.

Geometric operations are performed by shapely. Geopandas further depends on fiona for file access and descartes and matplotlib for plotting.

If you're having trouble running or installing geopandas, it is recommended that you use conda to install geopandas into a new conda environment. When installing the GIS stack, it's recommended that you pull all of the dependencies from a single channel (e.g., only from the default channel or only from conda-forge):

> conda create --name=gis python=3.7 geopandas --channel=conda-forge

Resources:

2652 questions
10
votes
2 answers

Shapely polygon to binary mask

I have seen this question asked but have not really been able to find a full response. I have a simple shapely polygon, called polygon. I would like to extract this polygon as a binary mask (ideally a numpy array). How would I go about doing this? I…
hex93
  • 319
  • 3
  • 15
10
votes
4 answers

Exporting a Geopandas dataframe to a zipped shapefile directly

I'm trying to save Geopandas data frame into a shapefile that is written to a zipped folder directly. As any shapefile user knows, a shapefile is not a single file but rather a collection of files that are meant to be read together. So calling …
saQuist
  • 416
  • 7
  • 19
10
votes
3 answers

Cannot make GeoDataFrame from Shapely Polygons: NotImplementedError: A polygon does not itself provide the array interface. Its rings do

This is code that used to work previously, but doesn't anymore: import geopandas as gp from shapely.geometry import Polygon a = Polygon([(0, 0), (0, 1), (1, 1), (1, 0)]) b = Polygon([(0, 1), (0, 2), (1, 2), (1, 1)]) c = Polygon([(1, 0), (1, 1), (2,…
bsuw
  • 101
  • 1
  • 3
10
votes
2 answers

Geopandas: how to plot countries/cities?

I would need to plot some data on a geographic plot. Specifically, I would like to highlight countries and states where data comes from. My dataset is Year Country State/City 0 2009 BGR Sofia 1 2018 BHS New Providence 2 …
V_sqrt
  • 537
  • 8
  • 28
10
votes
3 answers

Geopandas warning on read_file()

I'm getting the following warning reading a geojson with geopanda's read_file(): ...geodataframe.py:422: RuntimeWarning: Sequential read of iterator was interrupted. Resetting iterator. This can negatively impact the performance. for feature in…
leosole
  • 331
  • 4
  • 13
10
votes
4 answers

Can't install geopandas with anaconda because of conflicts

I'm a beginner and I try to follow a tutorial. So I install a anaconda and next step I should install geopandas but I get this messages: conda install geopandas Collecting package metadata (current_repodata.json): done Solving environment: failed…
Sebastian
  • 952
  • 1
  • 14
  • 41
10
votes
2 answers

geopandas: sjoin 'NoneType' object has no attribute 'intersection'

I am trying to do a spatial join with two open source datasets. I am running into an AttributeError: 'NoneType' object has no attribute 'intersection' error. Similar errors have seem to have been solved by ensuring empty geometry is removed but this…
camnesia
  • 2,143
  • 20
  • 26
10
votes
2 answers

How to use geopanda or shapely to find nearest point in same geodataframe

I have a geodataframe showing ~25 locations represented as point geometry. I am trying to come up with a script that goes through each point, identifies the nearest location and returns the name of the nearest location and the distance. I can easily…
rzt101
  • 127
  • 1
  • 1
  • 6
10
votes
1 answer

GEOPANDAS .sjoin 'index_left' and 'index_right' cannot be names in the frames being joined

I am trying to make a spatial join of 2 geo data frames. Both the indexes are of this kind: RangeIndex(start=0, stop=312, step=1) I get the following error: --------------------------------------------------------------------------- ValueError …
Dmitriy Grankin
  • 568
  • 9
  • 21
10
votes
2 answers

Error in importing geopandas

I am getting the following error when importing import geopandas as gpd --------------------------------------------------------------------------- ImportError Traceback (most recent call last)…
Arshad
  • 351
  • 1
  • 2
  • 15
10
votes
4 answers

Write GeoDataFrame into SQL Database

I hope that my question is not ridiculous since, surprisingly, this question has apparently not really been asked yet (to the best of my knowledge) on the popular websites. The situation is that I have several csv files containing more than 1 Mio…
Jhonny
  • 568
  • 1
  • 9
  • 26
9
votes
1 answer

Why is my geopandas installation missing sjoin? AttributeError: 'GeoDataFrame' object has no attribute 'sjoin'

I need to use geopandas sjoin on a project. I have successfully created GeoDataFrame objects and used class methods readfile, crs and to_crs. However when it comes to using sjoin I am getting an error: AttributeError: 'GeoDataFrame' object has no…
clams
  • 91
  • 1
  • 3
9
votes
1 answer

Calculate all distances between two GeoDataFrame (of points) in GeoPandas

This is quite simple case, but I did not find any easy way to do it so far. The idea is to get a set of distances between all the points defined in a GeoDataFrame and the ones defined in another GeoDataFrame. import geopandas as gpd import pandas as…
Leonard
  • 2,510
  • 18
  • 37
9
votes
1 answer

Spatial Join between pyspark dataframe and polygons (geopandas)

Problem : I would like to make a spatial join between: A big Spark Dataframe (500M rows) with points (eg. points on a road) a small geojson (20000 shapes) with polygons (eg. regions boundaries). Here is what I have so far, which I find to be…
Luis Blanche
  • 557
  • 9
  • 18
9
votes
1 answer

Explanding GeoPandas Multipolygon Dataframe To One Poly Per Line

This question is similar to another one out there but none of the solutions worked for me. Note I have included several attempts at those solutions and results. If another library will achieve this I am open to it. I am trying to expand a GeoJson…
Adam Barrett
  • 188
  • 1
  • 2
  • 7