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.

Filter by
Sorted by
Tagged with
0 votes
0 answers
6 views

geopandas find row of POINTS by given coordinate

I have a geopandas file and I am looking for an efficient way to identify the POINT by a given coordinate. For example, I have a geopandas variable like gpd1 = gpd.read_file('file_path') If I have a ...
  • 407
0 votes
0 answers
11 views

geopandas to_crs() return ProjError: x, y, z, and time must be same size

How can I convert this geodataframe with polygons in it from epsg:32748 to epsg:4326? I have a geodataframe called poi_shp_utm_buffered which looks like this | | ...
-1 votes
0 answers
4 views

geopandas group points based on geometry

I have one layer of points data. Some points are overlapped but they share different empty features. For example, point1's feature 1 and feature 2 are nan and point 2's feature 3 is nan. These two ...
  • 407
0 votes
0 answers
12 views

AttributeError: 'LineString' object attribute '__UDT__' is read-only

I'm using Shapely==1.8.6, geopandas==0.9.0, and pandas==1.3.5 and without upgrading/ downgrading to another version of these libraries. I'd like to fix for this issue that I'm facing while I try to ...
1 vote
1 answer
18 views

what does shapely_object.bounds do?

I am working with folium and shapely, and just came across a keyword named as bounds. Can anyone explain what does it exactly do. I found an explanation but i dont understand the point behind it : ...
1 vote
1 answer
50 views

Dictionary of polygon sides/edges (including MultiPolygons)

This question is related to here. How do I create a dict of all the polygons [including MultiPolygons], in a GeoDataFrame, that share a side/edge. The polygons will intersect but never cross. polys = ...
  • 173
1 vote
1 answer
37 views

How can I add bar charts at certain locations to a geopandas map using the same coordinate reference system?

Using official NUTS polygon data from Eurostat (Year: NUTS2021, File format: geojson, Geometry type: Polygon (RG), Scale: (20M), Coordinate reference system: EPSG 3857 and geopandas, I create a map of ...
0 votes
0 answers
23 views

How to make geoplots interactive with python and put it into a wordpress article?

do someone know how to create an interactive geo plot in python and export it to html/js and put it into a wordpress article? Because I would like to put plots like on the following page as ...
0 votes
0 answers
21 views

Is there a way I can get the latitude and longitude of the cities?

I have a shape file which has polygon for cities in the UK. Is there a way I can get the latitude and longitude of the cities?
0 votes
1 answer
43 views

Approach for improving runtime of Python function

I have a function that relies on a dictionary to identify the files it needs to read and the variable names they're linked to. The function then reads the file, calculates the outputs (in this case a ...
  • 514
0 votes
1 answer
30 views

Account for MultiPolygons with geopandas.apply

How do I amend the following python code: that determines the number of sides/edges of a polygon; to account for MultiPolygons? ---interiors aren't necessary. exteriors only please. Without looping ...
  • 173
1 vote
1 answer
24 views

Can you pass arguments to a pipe method of a DataFrame when using lambda?

I have a series of transformations on a dataframe, i wonder if i can use a function inline with the pipe method without having to use a defined function to apply it. What i want: import pandas as pd ...
0 votes
1 answer
42 views

AssertionError in Python 3.9

I am trying to calculate stats on features that fall within a cell, because the dataframes are quite large I am using multiprocessing to speed up the process. When I run the code on a sample dataset ...
0 votes
0 answers
22 views

How do I add and reduce the size of multiple legends in one GeoPandas plot?

usa_path = "New Folder/USA/" nation = gpd.read_file(os.path.join(usa_path, "USA_States.shp")) roads = gpd.read_file(os.path.join(usa_path, "USA_Roads.shp")) rivers = gpd....
0 votes
1 answer
20 views

How would you use Dask to recursively find neighbouring polygons in a Dask.Geodataframe?

I am new to Dask. I've been trying to get it to do the following task: I have two geodataframes and a set: # Main chunk and combined chunk are a list of polygons of tessellated cells main_chunk = gpd....
  • 49
1 vote
1 answer
35 views

Plotly choropleth with area labels

I am trying to make a choropleth with this data (source links in code). The below does produce one, but it's hard to really get anything meaningful from it without knowing which area is which. I have ...
  • 403
1 vote
1 answer
35 views

How to fix the scale of several choropleth maps?

I am creating multiple choropleth maps for different time frames (because I want to do a gif) and wondering if there is any way to fix the scale for each map to do easy visual comparison ? My current ...
1 vote
1 answer
36 views

How to add arrow labels to points in python geodataframe?

My code currently outputs a visualization that looks something like this: And I would like to be able to add a feature which has arrows pointing to each location dot, in which each arrow has a label ...
0 votes
0 answers
28 views

Geopandas plot with contextily basemap south face up

I was wondering if it is possible to plot a map using geopandas and contextily basemaps in an orientation other than North up. Example code with a map that I would like to plot upside down, but with ...
0 votes
1 answer
22 views

Possible in Geopandas to calculate number of entities that can fit into a given shapefile?

I'll preface this question with the caveat that I am a complete newbie to GIS / spatial calculations. Apologies if this is obvious. Is it possible (easy? hard?) with GeoPandas to do the following... ...
  • 3,091
0 votes
0 answers
21 views

Geopandas - Is it possible to undo an unknown translation?

I have two different maps of Spain: The first one shows the scale of risk of the whole Spanish territory The second one shows the shapes of the different municipalities. I need to overlap those maps ...
0 votes
3 answers
122 views

Highlight polygons that share a side/edge

How do I create a... ---I don't know; list, dict of all the polygons, in a GeoDataFrame, that share a side/edge. The polygons will intersect but never cross. import geopandas as gpd from shapely....
  • 173
0 votes
2 answers
25 views

How do I loop through two geodataframes to find the number of intersections between a given line in one gdf and all lines in the other?

I have two geodataframes of line features. For each line in the first dataframe, I want to figure out how many lines from the second dataframe intersect it and append that number to a new column in ...
  • 13
0 votes
0 answers
28 views

How to create Geopandas buffers for locations around the World

I have a location dataset (points long & lat) for events that happened around the World. I want to create 5km rings around these locations using Geopandas.buffer function. As explained in a ...
0 votes
0 answers
17 views

Geopandas with Sublime & IDLE (Python)

I get an error when I try to run my python script in Sublime and Python's IDLE. However I can run the same script in Command Prompt with no problem. I installed all the modules.whl locally. MyScript: ...
  • 1
1 vote
1 answer
43 views

Create a raster from points (gpd.geodataframe object) in Python 3.6

I want to create a raster file (.tif) from a points file using a geopandas.geodataframe.GeoDataFrame object. My dataframe has two columns: [geometry] and [Value]. The goal is to make a 10m resolution ...
  • 113
2 votes
1 answer
40 views

Highlight polygons incident at a vertex

How do I create a ---dict might be best--- of all the polygons, in a GeoDataFrame, incident at a vertex. The polygons will intersect but never cross. import geopandas as gpd from shapely.geometry ...
  • 173
1 vote
1 answer
37 views

How to make the colorbar of a geopandas plot independent of vmax?

I use the following code to make nice world map with some statistics: import pandas as pd import matplotlib.pyplot as plt import matplotlib.colors as mplc from mpl_toolkits.axes_grid1 import ...
0 votes
1 answer
30 views

Geoplot Choropleth map - AttributeError: 'Point' object has no attribute 'exterior'

I am trying to create a choropleth map using Geoplot. The data comes in the form of a CSV and I am trying to create a choropleth map of a grid created over a specific area, in this case over the Tampa ...
  • 11
0 votes
1 answer
44 views

problem with plotting the lat and lng to map(shp file)

I am working with Asheville Airbnb dataset and want to plot the neighborhoods based on their lat and lng, but it won't map together! shp_path = '../Airbnb_Asheville/Asheville_City_Limits/...
  • 105
-1 votes
0 answers
13 views

Problem with geopandas Colorbar: Can't fill the colorbar with the values from my legend

I have problems filling my colorbar with the values from the legend which come from the column 'name': I have read that I can set them with vmin and vmax but then I have to set them manually, which I ...
1 vote
1 answer
54 views

Shapely removing disconnected geometries after a unary_union of two MultiPolygons

I have two MultiPolygons, both of which are made up of disconnected polygons. I need to join them such that they "cut" each other out. The two shapes are these; I perform a unary union to ...
1 vote
1 answer
60 views

Plotting points on Australia Map in Python

I have the following pandas df import geopandas as gpd import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns # Define the list of cities and their latitudes/...
  • 289
0 votes
1 answer
16 views

How can I add the geometry of a geodataframe to a list that's the output of a specific function?

I'm running a the function maxp_greedy() of pygeoda library. This function creates clusters from a given data values, this values came from a geodataframe. The problem is that the mentioned function ...
  • 105
1 vote
1 answer
37 views

Sorting/ordering geometry column by longitude in Geopandas dataframe

I have a bunch of POINT Z (x,y,z) values in a Geopandas geometry column. I want to take these points and construct a LINE which in turn I can buffer to create a POLYGON. To generate the line I use: ...
  • 35
0 votes
0 answers
39 views

momepy: How can I use GeoDataframe Points and Linestrings to build a Networkx graph?

I have 2 GeoDataframes, one is points object, the other is Linestrings. Points are on Linestrings. How can I use these 2 gdfs to build a networkx graph? # Import import osmnx as ox import networkx as ...
  • 1
0 votes
1 answer
36 views

geopandas renaming columns when saving to file

I am trying to save a shape file locally with GeoPandas, preferably as a zipped file, however I have tried both compressed and uncompressed methods. I'm noticing that after saving the file locally, ...
  • 109
0 votes
0 answers
26 views

Trying to use the OSMnx tag "element_type" to retrieve all the "way" objects contained within a polygon

I'm trying to get all the structures (polygons) contained within a set polygon by calling for the tag "element_type":"way" but I can't seem to get it to work. I've tried the code ...
0 votes
0 answers
16 views

How can I solve this error while trying to create cluster via pygeoda library

I'm trying to create clusters of a dataset with 'pygeoda' library based on a distance based wight and the max-p greddy algorithm, using the area of each polygon to indicate the maximum area that each ...
  • 105
1 vote
2 answers
33 views

How to aggregate duplicate rows that have the same geometries?

Below is a example of my data set. I want to combine duplicated points together and get the sum of values in columns a , b and c into a single row. I have looked at a previous example using groupby....
0 votes
1 answer
24 views

Any way to change the colour of a legend on a geopandas map?

I have created the attached data visualisation using geopandas. When I save this as a png the background becomes black (in the attached picture the background is not black) and therefore the scale on ...
0 votes
0 answers
22 views

Create user defined color scheme in geopandas using explore()

I am trying to create an interactive map with UserDefined ranges for color scheme. I was able to create the map, but color scheme is not being plotted correctly for the associated values. import ...
  • 301
0 votes
1 answer
35 views

Geopandas cannot remove axis and set title simultaneously

I have a geopandas dataframe and I am plotting chloropheth maps no problem. However, when I want to customise the map, by removing the axis and setting a title, I can only seem to do one or the other. ...
-1 votes
0 answers
25 views

How to calculate distance between 2 poins along a linestring?

I have 2 geodataframes.One contains points, the other contains lines. Points are in lines. I'm wanting to calculate the path distance between any 2 selected points along the linestring , not euclidean ...
  • 1
0 votes
0 answers
42 views

Geopandas: OSM download problem (UrbanAccess)

Complete beginner here, just crash-coursing the sample code of a python package "UrbanAccess". Everything was going well, except one part where I have to download the OSM: (The geopandas ...
-2 votes
0 answers
26 views

Netcdf timeseries subplots using cartopy and geopandas

I am unable to 24 timesteps subplots in one page using for loops. The subplots are ploting in the first row only. There is np errors in the code. from netCDF4 import Dataset;import numpy as np; from ...
  • 1
1 vote
0 answers
25 views

Postgis geom IN clause

I have a situation where I need to find which of my geodataframe geometries already exists on my postgis table. For that I was thinking in use something like a IN clause for my sql. But I don't know ...
1 vote
1 answer
56 views

Geopandas has no attribute hvplot

I am running this code to generate a choropleth map of landprices in Germany. I have installed the pyviz, panel and geoviews packages. Even yesterday this was generating the plots with the hovering ...
  • 23
0 votes
0 answers
30 views

Python Folium Drawing Polyline and adding metadata/attribute information

# Download the OSM map data for the bounding box G = ox.graph_from_bbox(north, south, east, west, network_type='drive') # Convert the graph to a GeoDataFrame gdf = ox.graph_to_gdfs(G, nodes=False, ...
-1 votes
0 answers
21 views

Saving SHP as KML using geopandas results in coordinates containing newlines

I'm processing a set of SHP files, and I need to convert them to KML to be processed by some internal program that can only handle KML files. Normally, that'd be quite simple, and I've done it ...

1
2 3 4 5
51