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

GeoJSON issues with Plotly choropleth_mapbox

My approach to creating a choropleth map via plotly seems pretty straightforward--load in the DataFrame, load in the geojson, assign the necessary features to the custom polygons, and plot. Obviously there is a missed step somewhere when referencing…
Jkiefn1
  • 91
  • 3
  • 16
7
votes
3 answers

Efficiently match point to geometry (point in poly) for large collections of both points and polygons

There are a lot of questions here about matching points in polygons efficiently (examples: Here and Here). The primary variables of interest in these are high number of points N, and number of polygon vertices V. These are all good and useful, but…
amquack
  • 837
  • 10
  • 24
7
votes
2 answers

AttributeError: module 'fiona' has no attribute '_loading'

I am new in python and I am trying to work with geopandas library. I have already installed the package using: conda install -c conda-forge geopandas but when I try to import the library, I get back: ERROR SCREENSHOT But searching in my computer…
Giorgos Tsim
  • 91
  • 1
  • 4
7
votes
3 answers

Error when importing geopandas OSError: Could not find lib c or load any of its variants []

I'm using Spyder with Anaconda and since MacOS last update (Big Sur 11.0.1), when doing import geopandas, I get the following error: OSError: Could not find lib c or load any of its variants []. There are several subjects on the matter…
clematologie
  • 177
  • 1
  • 9
7
votes
3 answers

Python Georasters: geotiff image into geopandas dataframe or pandas dataframe?

I want to convert geotiff file into geopandas dataframe or pandas dataframe. I found this solution here but #!pip3 install georasters import georasters as gr import pandas myRaster = 'demo.tif' elevation = gr.from_file(myRaster) #elevation…
hhh
  • 50,788
  • 62
  • 179
  • 282
7
votes
2 answers

TopologicalError: The operation 'GEOSIntersection_r' could not be performed

Hi Guys, I am trying to map the district shapefile into assembly constituencies. I have shape files for Both.Basically I have to map all the variables given at district level in census data to assembly constituency level. So I am following a pycon…
jatin rajani
  • 495
  • 1
  • 6
  • 15
7
votes
1 answer

Add legend to geopandas

I have a map of Chile (http://labgeo.ufro.cl/fichas/chile_geo/ficha_cl_geo.html first link that says "Chile continental) and would like to plot it and add some points of centers for which I have latitude and longitud data. I am newbie with geopandas…
Isa
  • 93
  • 1
  • 1
  • 7
7
votes
1 answer

matplotlib geopandas plot chloropleth with set bins for colorscheme

How do I set a consistent colorscheme for three axes in the same figure? The following should be a wholly reproducible example to run the code and get the same figure I have posted below. Get the shapefile data from the Office for National…
Tommy Lees
  • 1,293
  • 3
  • 14
  • 34
7
votes
2 answers

python mask netcdf data using shapefile

I am using the following packages: import pandas as pd import numpy as np import xarray as xr import geopandas as gpd I have the following objects storing data: print(precip_da) Out[]:
Tommy Lees
  • 1,293
  • 3
  • 14
  • 34
7
votes
4 answers

can't open shape file with GeoPandas

I don't seem to be able to open the zip3.zip shape file I download from (http://www.vdstech.com/usa-data.aspx) Here is my code: import geopandas as gpd data = gpd.read_file("data/zip3.shp") this gives me the error: CPLE_AppDefinedError: b'Recode…
Fred R.
  • 557
  • 3
  • 7
  • 16
7
votes
2 answers

RTree: Count points in the neighbourhoods within each point of another set of points

Why is this not returning a count of number of points in each neighbourhoods (bounding box)? import geopandas as gpd def radius(points_neighbour, points_center, new_field_name, r): """ :param points_neighbour: :param points_center: …
ZHU
  • 904
  • 1
  • 11
  • 25
7
votes
2 answers

Choropleth map from Geopandas GeoDataFame

I'm trying to make a choropleth map from polygons in a Geopandas GeoDataFrame. I want to symbolize the polygons by quantiles of a value in one of the GeoDataFrame columns. I'm trying to figure out different options and see what best fits my needs.…
AJG519
  • 3,249
  • 10
  • 36
  • 62
6
votes
1 answer

Why do I get an error when trying to read a file in geopanda's included datasets?

I've just installed Anaconda in my new laptop, and created an environment with geopandas installed in it. I've tried to upload the world map that comes with geopandas through the following code: import geopandas as gpd world =…
Fernando
  • 63
  • 1
  • 5
6
votes
2 answers

how to find the nearest LINESTRING to a POINT?

How do I fund the nearest LINESTRING near a point? First I have a list of LINESTRING and point value. How do I have the nearest LINESTRING to the POINT (5.41 3.9) and maybee the distance? from shapely.geometry import Point, LineString line_string =…
helpme
  • 163
  • 3
  • 9
6
votes
1 answer

Calculate centroid of entire GeoDataFrame of points

I would like to import some waypoints/markers from a geojson file. Then determine the centroid of all of the points. My code calculates the centroid of each point not the centroid of all points in the series. How do I calculate the centroid of all…
user3439702
  • 345
  • 3
  • 10