Questions tagged [geopandas]

an open source project to make working with geospatial data in Python easier.

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

Convert the geometry column of a GeoDataFrame with mixed geometry types to a unique multi-type

I have a GeoDataFrame where I have a mix of geometry types in its geometry column, some are multi-geometry types, some are single geometry types, some are empty geometry types, and others are None (...
0
votes
1answer
24 views

Negate the shapely intersection predicate

I have two Shapely geometries: 1 MultiPoint instance named multipoints 1 Polygon instance named polygon I can compute their intersection by: multipoints.intersection(polyon) which results in all ...
4
votes
1answer
97 views

Exploding column in GeoPandas

I have a shp with a column NOM_CONCAT and I can not explode it to have a unique information, Each time, I have the same error message and I can't find solutions. #TypeError: explode() takes 1 ...
3
votes
1answer
26 views

Dissolve spatio temporal data with GeoPandas without missing the temporal part

I am wondering if there's a clever way to use the dissolve() method of GeoPandas with a spatio temporal geodataframe without losing the temporal part. I have a dataset where for different days of the ...
2
votes
1answer
25 views

Using GeoPandas intersections to fit a grid on a geometry

I'm trying to write a function that creates a grid over a vector shapefile using GeoPandas: def grid(src_vector, out_vector, size): # read the vector data in mercator proj gdf = gpd.read_file(...
-1
votes
0answers
19 views

Anaconda Starting powershell error [closed]

I am new and not able to understand this error in Anacoda. Basically I'm trying to install some Python libraries through conda, GeoPandas and some other libraries are not installed in my PC through ...
3
votes
1answer
72 views

Converting DataFrame to GeoDataFrame with Polygon [closed]

I would like to convert my DataFrame to GeoDataFrame, but every post is about points. I need to convert polygons. Coordinates are in df['geometry']. How can I do that? My DataFrame is below: I was ...
1
vote
1answer
48 views

Reconstruct full coordinate reference system stored in a GML file

I have been able to parse a GML file and fetch the polygons I wanted. They can be plotted ok when plotted on their own. I have them stored in a GeoPandas data frame, but I am struggling to set the ...
2
votes
0answers
48 views

What projection is this? Is it van der Griten?

I am trying to convert some maps that came in .dra format from MapMaker to shapefiles. My problem is that the original files have no projection information, which complicates their use after exporting ...
2
votes
1answer
14 views

Can't Form DataFrame from Parallel Offset Output

I've been developing code to take a .csv with lat-long coords and convert them to LineStrings before creating parallel offsets for them. This has been working so far, but yesterday after clearing my ...
5
votes
2answers
45 views

From uploaded zipped shapefile to Geopandas DataFrame in Django Application

I'm trying to get to a point where I can quickly filter thousands of points in a shapefile. My Django application asks for a zipped shapefile to upload, where the zipped file contains at least the ....
1
vote
1answer
66 views

Convert Polygon to Multipolygon with GeoPandas

I'm trying to create a vectors grid from a single geometry, from PostGIS's table to another PostGIS's table; both tables are in the same DB. The input geometry is MultiPolygon and I've previously ...
5
votes
1answer
52 views

Finding the closest point to a polygon in a shapefile using GeoPandas

I have the following map of statistical regions of Belgium: The blue dots correspond to coordinates for which I have temperature data. Surrounded by the red circle is Brussels. As it can be seen, ...
0
votes
0answers
11 views

How to rotate a Contextily basemap in matplotlib and Jupyter notebook

I asked this question on Stack Overflow because I thought the Jupyter Notebook and matplotlib aspects were better suited for that forum, but I didn't have any luck; it is also a geopandas and ...
4
votes
1answer
82 views

Converting Individual Points Instead of Entire Geometries Causes Different Transformation Results in GeoPandas and PyProj

I am working with geospatial data to be used to make calls to the Foursquare API and conduct cluster analysis on extracted data. To do this, it is helpful if I can project data using both GeoPandas....
1
vote
1answer
22 views

How to use GeoPandas buffer function to get buffer zones in kilometers?

I am having trouble with using GeoDataFrame.buffer function. That is probably because of my lack of understanding crs. Here is the case: I have events dataset (points longs & lats) and locations ...
2
votes
0answers
28 views

Not able to extract values from raster TIFF in EPSG:26912, but can in EPSG:4326?

I have an elevation file (.tif) in EPSG:4326 and point data for wildfire occurrence in the same projection. When I use this projection, I can use the following code to extract the elevation value, for ...
3
votes
1answer
78 views

Matplotlib skip color for assigned interval in map plotted from GeoPandas DataFrame, if attribute don't have value in range of user defined bins

I have a GeoPandas GeoDataFrame which I am plotting against a specific column and the colour of the output/map is same for different assigned bins/intervals. The issue is because, sometimes, there is ...
1
vote
1answer
47 views

Legend colour not matching as assigned in the bins in matplotlib map plotted from GeoPandas DataFrame

I have a GeoPandas GeoDataFrame which I am plotting against a specific column and the colour of the output/map is not matching with the colour assigned to different bins/intervals. It should ideally ...
4
votes
1answer
43 views

Removing NaN value from legend in matplotlib map plotted from GeoPandas DataFrame

I have a GeoPandas GeoDataFrame which I want to plot against a specific column. for day in days_list: df2 = csv_file[["state_id", "state_name", "tmx_corrl"]].loc[...
4
votes
1answer
125 views

Geopandas vs QGIS vs ArcGIS area values

I'm calculating areas of a KML in QGIS, ArcGIS and GeoPandas and all of then are different, my results are this: Geopandas ArcGIS QGIS 29.3498 28.500084 25,651554 The original crs of the KML is ...
0
votes
1answer
25 views

How to specify from which file duplicates should be deleted after appending two datasets

I am using python script and ArcGIS Desktop 10.8.1 to synchronize two datasets. There are many (thousands) of duplicate features that I would like to drop in an output. How can I specify that, in the ...
0
votes
1answer
42 views

GeoPandas dataframe from PostGIS table having date column

I have this PostgreSQL PostGIS database and I want to read this data in GeoPandas. I am able to create the GeoPandas database when I exclude the columns having dates/datetime #Reading data from ...
0
votes
1answer
35 views

GeoPandas/Geoplot losing first row when reprojecting

I'm trying to work with the London Borough borders file (https://data.london.gov.uk/dataset/statistical-gis-boundary-files-london) in geopandas/geoplot. It comes in National Grid Easting/Northing ...
1
vote
1answer
23 views

“init” CRS vs regular CRS in GeoPandas

I have a shapefile which I read in via import geopandas as gpd shapes_df = gpd.read_file(shp_f) print(shapes_df.crs) The output was {'init': 'epsg:3857'} I then reprojected via shapes_df = shapes_df....
2
votes
1answer
39 views

How to draw radius buffer around the points and perform intersection with other locations list in GeoPandas Python? [duplicate]

I have two lists of points (latitudes, longitudes) - locations & events: locations = [[54.156014, 53.017209], [2.74284, 103.68141], [3.133688, 102.688424], [24.499918, 55.388891], [21.488382, 61....
1
vote
0answers
31 views

Geopandas .difference between two different shapes produces empty difference

I have been puzzled by this, and I feel like it's a geopandas bug. base = gpd.GeoSeries(dist_to_remove).plot(edgecolor='black', color='yellow') gpd.GeoSeries(prec_shape).plot(ax = base, color='red', ...
1
vote
1answer
44 views

Extracting shapes from GeoTIFF using rasterio returns excessive number of polygons

I am using the shapes interface of rasterio to extract polygons from a GeoTIFF image. rasterio returns an excessive number of polygons which is not expected. It is taking a long time to extract a ...
3
votes
0answers
49 views

Plotting the albedo using Python

import glob import numpy as np import pandas import os import rasterio import geopandas as gpd import matplotlib.pyplot as plt def get_image_stats_only(img_array): raw_stats_dictionary = {'mean':...
1
vote
1answer
70 views

Convert ArcGIS Spatially Enabled Dataframe to Geopandas GeoDataFrame

I have some code that works on geopandas GeoDataFrames but due to a client requirement I suddenly have to access my input data via the ArcGIS Python library, which only allows me to access the data as ...
3
votes
2answers
168 views

PyQGIS is working too slow. Can I use GeoPandas?

I have a layer with classification od buildings. I want to add "Area" to my attributes table and I use PyQGIS. For another layer with 50 records it works, but my layer is huge, contains 6....
0
votes
1answer
44 views

geopandas GeoDataFrame.to_postgis is showing AttributeError: 'GeoDataFrame' object has no attribute 'to_postgis'

I have this geopandas geodataframe which I want to write in the postgis/postgreSQL database. I have followed the steps as shown here by the geopandas docs https://geopandas.readthedocs.io/en/latest/...
1
vote
0answers
13 views

Attribute network features (lines) with data from their endpoint

Goal To prioritize water lines in a network based on the building they service Detail I have a shapefile of water lines in a region. The lines are split at their vertices and form a network (more or ...
1
vote
1answer
25 views

How to split a single polyline shapefile into many shapefiles based on unique value using GeoPandas?

I have a single polyline shapefile with multiple features (row). I want to export each row to separate shapefile with using GeoPandas. But I got Geometry error in the code. This is my shapefile: and ...
1
vote
0answers
35 views

geopandas to_postgis: ValueError: geom (geometry(MULTILINESTRING,4326)) not a string

I have a GeoPandas GeoDataFrame with a column named geom having MultiLineString values as such: print(gdf.to_markdown()) # using package 'tabulate' to display a markdown table | | uid | key | ...
2
votes
1answer
43 views

GeoPandas: Problem with encoding

I have the problem with encoding because I need Polish letters and encoding="utf-8" didn't work. import geopandas df = geopandas.read_file(r'/home/gis/adresypolska/PRG_PunktyAdresowe_POLSKA....
3
votes
1answer
76 views

Calculate Azimuth from polygon in GeoPandas

Is there a simple way / ready-to-go function to calculate the azimuth of 2D-polygons in a GeoPandas DataFrame? My goal is to eventually compute azimuth angles of building footprints. Most of the ...
1
vote
1answer
68 views

How to create a raster delineating all drainage basins using pysheds python

I am going through the tutorial of "Pysheds" available in the following website https://www.hatarilabs.com/ih-en/elevation-model-conditioning-and-stream-network-delimitation-with-python-and-...
7
votes
2answers
54 views

Change linestring values with GeoPandas

I'm working on a stormtracking project, and I realized that the longitude sign of some values in my GeoPandas dataframe are wrong; i.e. I need negative longitudes instead of positive ones. When I ...
0
votes
0answers
94 views

Extract one geometry type from GML file in GeoPandas

I try to use GML data from Landesvermessung Brandenburg in GeoPandas. It generally works to load files like this: df = gpd.read_file(r'/vsizip//vsicurl/https://data.geobasis-bb.de/geobasis/daten/...
1
vote
1answer
21 views

Why is WKT shape empty/not plotting in some tools but not in others?

Why is my WKT Shape: import geopandas as gpd import pandas as pd df = pd.DataFrame({'foo':[1], 'geom_wkt_epsg4326':['MULTIPOLYGON(((16.550706663337998 48.56271555889241, 16.551262218893598 48....
1
vote
0answers
23 views

Calculating ratios between two shapefiles

So I have two shapefiles, one is a grid and one is a map of the world's land. I am trying to find the ratio of land in each cell of the 'grid' shapefile to show the land/water ratio but I'm stuck. ...
6
votes
2answers
123 views

Self split geopandas Linestring geodataframe in a fast way without loosing all attributes

I have geodataframe of many LineStrings. The LineStrings intersect but are not split at those intersections. My current solution to achieve this is from here: network = gp.read_file(filenameNetwork) ...
2
votes
1answer
43 views

Create a raster from polygon

I have a shapefile of thousands of polygons. I'm looking to loop through each polygon and create a raster of the shapefiles boundaries for each polygon. I'm looking for each raster to have the value ...
1
vote
1answer
21 views

Compute area coverage density estimate from very large polygon dataset

I am trying to come up with a pipeline for turning very large OSM PBF files (eg buildings layer for a whole country: ~100M polygons) into a more manageable density estimate (with arbitrary precision). ...
0
votes
1answer
15 views

Drop Linestring geometry from a GeoDataFrame

I try to create a shapefile of the FAO/GAUL/2015/leve1 country regions of the LMIC's countries. For that I decided to use Python as it gave me access to the earthengine API and the geopandas librairy. ...
2
votes
1answer
72 views

Fast way to extract bounding boxes from OSM PBF data…

Is there an efficient way to convert a set of node/relations in a PBF file, to the bounding boxes for each polygon, without going through a conversion to another GIS format? Right now, my pipeline ...
1
vote
1answer
381 views

Error while using sjoin in GeoPandas

I have a problem with GeoPandas sjoin, I work with Ubuntu and I want to use: opolskieadresy = geopandas.sjoin(smallopolskie, adresy, how="inner", op='intersects') and i'm getting error: ...
0
votes
1answer
74 views

How to create a GeoPandas GeoDataFrame from rasterio features?

I try to create a GeoDataFrame of paches of same values in a binary raster using rasterio and GeoPandas. data_file is a binary TIFF raster with 0 where there is no deforestation and 1 if there is a ...
1
vote
0answers
58 views

Getting the center point of a cluster in Pandas

I have a list of of coordinates that have areas mapped out as follows import pandas as pd import numpy as np import folium from folium import plugins from folium.plugins import HeatMap import pyodbc ...

1
2 3 4 5
17