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
6
votes
1 answer

How to display a heatmap on a specific parameter with geopandas?

In my very simple case I would like to display the heatmap of the points in the points GeoJSON file but not on the geographic density (lat, long). In the points file each point has a confidence property (a value from 0 to 1), how to display the…
Tim
  • 513
  • 5
  • 20
6
votes
0 answers

Fail to load module Jupyter but not in Terminal

I am creating a conda env with the following commands in my Windows machine: conda create -n s1 python=3.6 conda activate s1 conda config --env --add channels conda-forge conda config --env --set channel_priority strict Then, I install the…
GCGM
  • 901
  • 1
  • 17
  • 38
6
votes
2 answers

Syntax for creating a new, empty GeoDataFrame

I have a GeoDataFrame (let's call it Destinations) that was made from a point shapefile using GeoPandas. For every feature (correct me if the terminology is wrong) in Destinations, I need to find the nearest node on a graph and save that node to…
Borillar0821
  • 63
  • 1
  • 5
6
votes
1 answer

Geopandas and Google Colab issue: Spatial indexes require either `rtree` or `pygeos`

I am trying to do an intersection with 2 GeoDataFrame using the gdf.overlay function on Google Colab. Please see the code below !sudo apt install libspatialindex-dev !sudo pip3 install rtree !pip install pygeos overlap = gpd.overlay(gdf1,gdf2,…
6
votes
2 answers

Geopandas polygon to line

I am new to geopandas and would like to plot only the outline of a polygon, similar to the function ST_Boundary() in PostGIS I have a geodataframe states containing polygons for each state states = counties.dissolve(by='STATEFP') When I subset by…
iskandarblue
  • 7,208
  • 15
  • 60
  • 130
6
votes
2 answers

Convert multipolygon geometry into list

How can I please convert a multipolygon geometry into a list? I tried this: mycoords=geom.exterior.coords mycoordslist = list(mycoords) But I get the error: AttributeError: 'MultiPolygon' object has no attribute 'exterior'
mee
  • 688
  • 8
  • 18
6
votes
1 answer

Conda error: Cannot link a source that does not exist

I'm trying to install geopandas and I would normally do it through pip, but it seems to struggle with dependencies so I went to try installing via conda package manager. It all goes well until I get this error: Conda error: Cannot link a source that…
NotAName
  • 3,821
  • 2
  • 29
  • 44
6
votes
2 answers

Geopandas: how to convert the column geometry to string?

I have a geopandas dataframe geometry idx 0 POLYGON ((-74.25559 40.91553, -74.24559 40.915... 0 1 POLYGON ((-74.25559 40.90553, -74.24559 40.905... 1 2 POLYGON ((-74.25559 40.89553, -74.24559…
emax
  • 6,965
  • 19
  • 74
  • 141
6
votes
1 answer

Make an Altair map with interactive pan and zoom

I am able to generate a world choropleth map with tooltips on mouseover and click selection to grey out unselected countries. I would like to be able to click on a country and have the map pan and zoom in. I have figured out how to use lon/lat…
footfalcon
  • 581
  • 5
  • 16
6
votes
1 answer

Why are Pandas and GeoPandas able to read a database table using a DBAPI (psycopg2) connection but have to rely on SQLAlchemy to write one?

Context I just get into trouble while trying to do some I/O operations on some databases from a Python3 script. When I want to connect to a database, I habitually use psycopg2 in order to handle the connections and cursors. My data are…
swiss_knight
  • 5,787
  • 8
  • 50
  • 92
6
votes
1 answer

How can I rotate a matplotlib map?

Starting with a shapefile I obtained from https://s3.amazonaws.com/nyc-tlc/misc/taxi_zones.zip, I'd like to plot the borough of Manhattan, and have outlines for each taxi-zone. This code rotates each individual taxi zone individually instead of all…
Connor
  • 545
  • 4
  • 20
6
votes
1 answer

Plotly Choropleth combined with ScatterGeo

Can anyone help me spot the error here? fig = go.Figure() fig.add_trace( go.Choroplethmapbox( geojson=counties, locations=df_se['FIPS'], z=df_se['use_values'], colorscale="Viridis", zmin=min(df_se['use_values']),…
mustacheMcGee
  • 481
  • 6
  • 19
6
votes
3 answers

how to add a "North Arrow" on a geopandas map

I created a map using geopandas, but I am unable to add a "North Arrow" on the map. After creating the map, I have tried to add the "north arrow" using matplotlib.image module and tried different ways (see example below) but none of them provided a…
Regis
  • 61
  • 1
  • 3
6
votes
2 answers

Python: how to create square buffers around points with a distance in meters

I have a geopandas dataframe gdf gdf ID longitude latitude geometry 0 80 103.619501 1.2810 POINT (103.619500987 1.281) 1 81 103.619501 1.2855 POINT (103.619500987 1.2855) Following this suggestion I create a square…
emax
  • 6,965
  • 19
  • 74
  • 141
6
votes
1 answer

Calculating correct area for polygons with geopandas

I recently tried to calculate country sizes with geopandas and the included world file; and I am not capable to calculate the correct size for the chosen countries. Maybe someone can give me a hint where I made a mistake? Tried various shapefiles…
Gaelic Miko
  • 71
  • 1
  • 3