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
14 views

Plot a circle with a given radius around points on map using Python

I have created a map using GeoPandas with a few markers that represent some coordinates on the map. I want to do draw a circle around each marker with the marker placed in the center of the circle. ...
1
vote
0answers
23 views
+50

Using shapely interpolate to evenly re-sample points on a linestring geodataframe at specified interval

I have a GeoPandas LineString GeoDataFrame. I am trying to evenly interpolate the spacing of the nodes that make up each line, with a couple constraints: keep endpoints unchanged, and specify maximum ...
-1
votes
0answers
24 views

Issue while writing the geodataframe to GPKG format in Jupyter Notebook [closed]

I have import packages such as GeoPandas, Fiona and Shapely, however, while I tried writing the geodataframe to GPKG format, the error (in the picture attached) is observed.
1
vote
1answer
32 views

Using pyproj inverse transform with GeoPandas and GroupBy + SortBy constraints

I am using pyproj inverse transform to add azimuth and distance "info" to a grouped and ordered geodataframe. I asked a similar question earlier here, but I didn't realize grouping was a ...
1
vote
1answer
34 views

How can I convert a LineString GeoDataFrame to a Points GeoDataFrame while retaining the vertice order?

I have a LineString GeoDataframe that I am trying to convert into a Points GeoDataframe, but I want to retain the GroupBy and SortBy features inherent in a LineString (i.e., all the vertices that make ...
1
vote
1answer
32 views

How to get the bounds of a GeoJSON file in GeoPandas as a seperate file?

I am trying to generate a polygon which circumscribes all shapes in the given GeoJSON (could be either point, line, or polygon shapes). I figured out how to do this with bounding boxes (.total_bounds)....
0
votes
0answers
31 views

Distance computation for geospatial clustering of lat/lon points

I am working with a pretty large dataset (~500K data points) in Python (GeoPandas) and I would like to perform geospatial clustering on some subsets (~60K points) of the data. My question has to do ...
0
votes
1answer
40 views

Identifying and removing bad lines in a shapefile

I downloaded some shapefiles of Houston from the Open Maps data using this tool. I am plotting the roads and I have a weird thing happening. Most of the lines are correct, but there are clearly ...
0
votes
1answer
21 views

How do I change the display size of a map from a shapefile with matplotlib?

I'm completely new to shapefiles. I was able to use GeoPandas to plot some data over a map of the US I got from census.gov. I'm having getting the map to be at a viewable size. I adjusted the figsize ...
1
vote
1answer
41 views

How do I create centroids inside polygons in Python?

When creating centroids from polygons, ArcMap has an option to placing the centroids inside (within the bounds of) the polygons. I am attempting to create centroids in Python. I have tried: df['...
1
vote
1answer
37 views

Using pyproj inverse transform to get azimuth, row iteration and lambda apply (I'm close to the answer!)

I am using pyproj inverse transform to add azimuth and distance "info" to an ordered geodataframe. I am trying to iterate over all the rows in the geodataframe to add the "info" as ...
0
votes
0answers
17 views

Change GeoPandas column value from PostGIS query

I have some QGIS layers and I am performing some spatial queries with them using GeoPandas. I'm using psycopg2 to make a connection to a local PostgreSQL/PostGIS database. Then I use the read_postgis()...
0
votes
1answer
24 views

Clipping points with complex polygon geometry using GeoPandas

I have a huge point dataset with almost 300.000 points and I want to intersect them with a country geometry that has a complex geometry (multiple islands and borders). What I've done so far is to ...
0
votes
1answer
44 views

Using GeoPandas to find crossing azimuths

I have got a series of UTM coordinates and azimuths like that: Point one: Z23, 603484.00m E,7781714.00m S, Azimuth 222° Point two: Z23, 600593.00m E,7781310.00m S, Azimuth 137° Those azimuths (should) ...
1
vote
1answer
21 views

Error when saving geodataframe to geojson after a spatial join

I am writing a simple python code to perform sjoin on two geodataframe. gdf1 = gpd.read_file(polygon1.geojson) gdf2 = gpd.read_file(polygon2.geojson) gdf = gpd.sjoin(gdf1, gdf2, how="...
0
votes
0answers
24 views

Finding “most frequently intersected area”?

I have a geodataframe that contains geometries of droughted area for several years. To identify consistently droughted areas, I want to find areas that are droughted for the largest number of years. ...
1
vote
1answer
41 views

Rasterize function from GDAL in Python has problem with “GetGeoTransform”

I'm trying to rastrize a shapefile that I have. I read the shape using GeoPandas. I would like to give the new raster values based on the shape column called "class" which has numerical ...
0
votes
0answers
37 views

Find polygon geometry of a place

I am reading in a shapefile of Metro areas in the US and then select the metro area of interest. # Read shape file px_shp = 'data/map/az/cb_2018_us_cbsa_500k.shp' geodata = gpd.read_file(px_shp) ...
0
votes
0answers
21 views

Creating a Origin-Destination flow map with Non-Spatial dataset

I am working on a project where I am trying to learn some geopandas. The dataset that I am using is the LEHD Origin-Destination Employment Statistics that gives you a csv that has a work/home geoid ...
3
votes
1answer
70 views

How buffering works in GeoPandas?

I try to add a buffer on a set of lines via the buffer attribute of geopandas. But by testing on a simple case (see code below) I realize that the size of the buffer is not kept according to the ...
0
votes
0answers
25 views

Shapefile extremely slow to read in Jupyter Notebook

I have a shapefile of Phoenix, AZ of size 172mb which I am loading in to the Jupyter notebook. It's a extremely slow process to read the file in. I am running the notebook on locally and the files are ...
1
vote
1answer
26 views

Keep / append attributes to buffered PolyLines in QGIS

I have a shapefile containing multiple line files with key attributes. I buffered each using cap_style=3 to get the correct buffer, but all of the attributes are lost. I'm either looking for added on ...
1
vote
0answers
33 views

Exporting GeoTIFF raster to GeoPandas dataframe

I'm just starting in the field of GIS (mostly worked with just python before) and got stuck on a problem. I'm looking for a way to polygonize an already masked GeoTIFF raster with population data in a ...
1
vote
1answer
53 views

Can I publish a QGIS processing plug-in written in GeoPandas?

Or do I need to rewrite my script using "pure Python" and PyQGIS? My script is basically a recreation of ArcMap's Tabulate Area tool (vector layers only for now). The goal is to make it ...
1
vote
1answer
28 views

Problem getting correct area for polygon and choosing a CRS

Using GeoPandas and I'd like to calculate the areas for the geometries in my dataframe. I'm also doing other things like finding the area of overlapping regions of geometries from different ...
0
votes
1answer
25 views

Reproojecting unequal number of latitude and longitude: pyproj.exceptions.ProjError: x, y, z, and time must be same size

I have a rectangular matrix of geographic climate data with a 1d row of latitude coordinates (size= 834) and a 1d column with longitude coordinates (size= 1115). They are both in unit of m (EPSG:32630)...
0
votes
1answer
76 views

“Spatial join” between raster and shapefille- give raster the shapefile values with python

I have raster which has NDVI values .In addition, I have shapefile(geopandas) on top of this raster but it doesn't fully covers the raster (illustration): the shapefile has column which contain data ...
5
votes
1answer
93 views

Get points within maximum distance from any point in GeoPandas

Given a set of points (with meters coordinates), I am trying to create lines between them. But I don't want to create lines of each pair of points, Iwant to create thoses lines if the distance between ...
4
votes
1answer
53 views

GeoPandas groupby is omitting columns

I am using this answer to calculate some basic statistics of some points that fall within the bounds of a polygon (a vector grid), such that: gridfile = 'grid.shp' pointfile = 'points.shp' point = ...
0
votes
0answers
28 views

Display raster with earthpy shows one color raster without values

I'm new to Earthpy, I am trying to display raster and on top of it I want to display polygon. The problem is that when I display the image it looks like blue rectangle and doesn't have different ...
1
vote
1answer
56 views

GeoPandas statistics of points within a multi polygon (grid) [duplicate]

I usually use numpy for my processing but I'm trying to make the most of the power of GeoPandas for my spatial data. I have some point data (shapefile) and a vector grid (fishnet) as a separate ...
2
votes
1answer
65 views

How to put this in a for-loop? I'm recreating ArcMap's 'Tabulate Area' tool in Python

I have two shapefiles, a province with 39 municipalities and a land cover of the province. Goal: get the sqm of each land cover classification for each municipality. For example, how much open forest, ...
2
votes
1answer
22 views

Create GeoDataFrame polygon geometry from coordinates list of lists

My current dataframe (clean_geoms) contains two columns (field_geom_type, field_coords) that I want to convert to a single geometry (GeoSeries) This is a representative sample of my data: print(...
2
votes
1answer
76 views

Getting only the exterior boundary of a 'donut-shaped' GeoSeries object

GeoSeries.boundary() finds the entire object's perimeter, so I supposed that wouldn't work. I made my GeoSeries donut-like shape using unary_union of smaller GeoSeries objects.
0
votes
0answers
20 views

OSM or Google Tile problem fitting to Geopandas Dataframe

I found this good post on how to get basemap tiles from open sources like OSM, Google, Bing, ESRI using python in geographic lat/long. I'm now trying to add the tiles I successfully got into a ...
1
vote
0answers
21 views

How to extract lat, long coordinates from Geography type column in dataframe using SQLAlchemy?

This is the SQL command that works perfectly. SELECT lonlat, ST_Y(lonlat::geometry) AS latitude, ST_X(lonlat::geometry) AS longitude This is the output of the SQL command. lonlat ...
0
votes
1answer
22 views

Problem with intersection between two Geopandas Dataframes

I have 2 shape files one "country.shp" (containing the tiles geometry covering the whole country) & other "district.shp"(containing one particular district). Now I want to get the tiles ...
0
votes
1answer
54 views

Empty geometry error in GeoPandas dataframe

I want to reproject my ground truth data (land reference map) to UTM. # Load Reference Data (reference map = ground truth data): labeled vector data in a shapefile (crops in Jendouba) LULC_filename = ...
1
vote
1answer
22 views

Invalid geometry objects in Shapely list

I have a creating a list of shapely polygons. While I am trying to create a geodataframe from that list it gives an error: intersec_ls = [poly1, poly2, poly3] cu = cascaded_union(intersec_ls) differ =...
1
vote
0answers
25 views

How to write to geopandas dataframe directly to (Google) Cloud Storage?

I would like to write a geopandas.Dataframe directly to (Google) cloud storage, from the documentation fiona enables this, however I am not sure how to supply the correct **kwargs for the geopandas....
1
vote
1answer
31 views

Aggregating DateTime and GPS latitude/longitude

I have a dataframe with multiple columns including SerialNumber, DateTime, GPS latitude and GPS longitude. Background: Tractors marked with Serial numbers are working(driving) on fields, sending data ...
2
votes
1answer
56 views

Find nearest polygon (from GeoSeries) to point (from GeoSeries)

I have two GeoSeries, consisting of points and polygons. I want to find the polygon in dataframe B that is closest to each point in dataframe A. The polygons are rooftops from https://github.com/...
0
votes
0answers
56 views

Optimising Cross Join PostGIS Query

I have tried performing the query shown below via ogr2ogr and the gpd.GeoDataFrame.from_postgis() method in geopandas. from osgeo import ogr import psycopg2, os import geopandas as gpd import pandas ...
2
votes
1answer
75 views

Seperate each row of points from shapefile with latitude and longitude information

I have a shapefile which has point geometry points with latitude and longitude values.The image when opened in QGIS looks similar to the below picture and I want to know whether I can separate each ...
0
votes
0answers
19 views

Assigning attribute field to polygons within Multipolygon

I have a geodataframe with geometry column having MultiPolygons. For each index I have a Multipolygon having 4 polygons. I have a name label for each polygon within MultiPolygon. How can I assign the ...
2
votes
1answer
30 views

.sjoin Geopandas returns too many results

I have two dataframes, both containing geometry columns. The first dataframe contains MULTIPOLYGONs while the second one contains POINTs. My aim is to join the dataframes so each POINT will be ...
3
votes
1answer
48 views

What is the best way to handle CRSs in Geopandas so that both versions <0.7 and >=0.7 are handled?

I am developing a python package called RivGraph. I've recently run into an issue related to geopandas' decision to overhaul CRS representation, as described here and here. The short of it is that in ...
1
vote
1answer
36 views

Automatic map creation problem [closed]

I have two layers, first one is the ROAD layer and second one is the PARCEL layer (both polygon layers) as shown in Figure 1. I can get the data both in DXF and shapefile formats. My task is to ...
2
votes
0answers
24 views

How to overlay and combine a choropleth and a shaded raster in Python?

I want to make a choropleth map of regions but shade it according to local population density. This is not the problem of masking a raster with a shapefile but to overlay two representations of data ...
1
vote
1answer
33 views

Rotating a map/projection in GeoPandas

I'm trying to get a map of Manhattan that is aligned vertically. I have a GeoJSON file with polygons in EPSG:4326 in fname that I've been transforming to EPSG:6539 gdf = gpd.read_file(fname).to_crs("...

1
2 3 4 5
14