Category "geopandas"

How do I find all the polygons of a GeoDataframe that contain any point of another GeoDataframe in GeoPandas?

I have a GeoDataframe of about 3200 polygons, and another GeoDataframe of about 26,000 points. I want to get a third GeoDataframe of only the polygons that cont

GeoPandas.GeoDataFrame: type "geometry" does not exist

Ubuntu 20.04.3 LTS (WSL2) fiona 1.8.21 geopandas 0.10.2 geopandas-base 0.10.2 geopy

Geopy distance between two point tuples of (lat, lon) coordinates

I've been trying to measure geographic distance between points in a GeoDataframe (gdb['geometry']) and one specific point, let's say, b_xy. gdb['geometry'] is a

Geopandas not plotting correct colors

My Geopandas DataFrame has 3 polygons and 9 points with color_rgba column computed with matplotlib.colors.to_rgba function: import contextily as ctx import geop

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 poi

Installing the GeoPandas

GeoPandas Installing When I am installing GeoPandas they show me a error in Anaconda prompt several times. They indicated me Failed with initial frozen solve of

Combine and sum values of overlapping Polygons in GeoPandas

I have a GeoPandas dataframe with a.o. polygons as 'geometry' column and a corresponding value in a different column. E.g. like such: import numpy as np import

Replacing ID values of polygons in a geodataframe to values of polygons from another geodataframe

I have polygons inside another bigger single polygon and I want to be able to replace the ID values (for example) of the former polygon to that of the latter. S

Flipping longitude and latitude coordinates in GeoPandas

I'm working with datasets where latitudes and longitudes are sometimes mislabeled and I need to flip the longitudes and the latitudes. The best solution I could

Creating custom colourmap for geopandas.explore plot

all code: def rgb2hex(r,g,b): return '#{:02x}{:02x}{:02x}'.format(r,g,b) def rg(num): num = int(np.round((num / 100) * 124)) r = (124 - num) g

Geopandas: How to relate the length of a linestring to the linestring point used to find distance to polygon

I’m trying to find the length of the linestring between the starting point of the linestring and the point which are used to find the nearest distance to

Plotly Dash - TypeError: Object of type Polygon is not JSON serializable

I am attempting to plot choropleth map using dash and mapbox. At runtime, I am getting an error "TypeError: Object of type Polygon is not JSON serializable". sa

"name 'pygeos' is not defined"

When doing df = gpd.GeoDataFrame(df1, crs = 'EPSG:4326', geometry = geopandas.points_from_xy(df1.longitude,df1.latitude)) I get "name 'pygeos' is not defined",

Update patch edge colours in Geopandas plot

I've plotted a GeoDataFrame as a choropleth using the following code (geopandas 0.2.1, matplotlib 2.0.2, in a Jupyter notebook, using %inline: fig, ax = plt.su

Unable to use "scheme" attribute when plot GeoDataFrame

I am rerunning the code in https://www.kaggle.com/skalskip/using-regression-to-predicting-earnings-in-france under Python 3.6, and in the plotting stage I ran t

Plot polygons with buffer of some radius using folium not working properly

I am trying plot the intersection between a buffer circle and the mesh blocks (or boundaries) within that circle of some radius (in this case, 80 km). I got the

Plot polygons with buffer of some radius using folium not working properly

I am trying plot the intersection between a buffer circle and the mesh blocks (or boundaries) within that circle of some radius (in this case, 80 km). I got the

GeoDataFrame is Inverted when I converted from Raster to Vector using RasterIO

I'm currently using this code to convert a raster file to a geodataframe: import rasterio from rasterio.features import shapes mask = None with rasterio.open

Convert Points to Lines Geopandas

Hello I am trying to convert a list of X and Y coordinates to lines. I want to mapped this data by groupby the IDs and also by time. My code executes successful

How to mantain aspect ratios after overlay in geopandas?

I'm trying to overlay some cities on top of a map. import pandas as pd import geopandas as gdp import matplotlib.pyplot as plt from shapely.geometry import box