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

Issue while plotting Raster and Shapefile on tkinter canvas

I am trying to plot shapefile (EPSG:4326) and raster data (EPSG:32645) on tkinter canvas using rasterio and geopandas. I am using the following code to plot the same: from tkinter import * import ...
2
votes
0answers
171 views

Unable to install geopandas using conda install

I'm trying to install GeoPandas using the Command Prompt terminal. I have Python 3 and ArcGIS installed. I keep getting these messages that say there is a conflict with various packages. For example: ...
0
votes
1answer
230 views

Apply same coordinate system to raster image and GeoJSON with rasterio

I have a dataset containing raster images and corresponding features in geojson files. I would like to use rasterio.features.rasterize to create a footprint image of the features on the raster image, ...
0
votes
1answer
295 views

How to extract a specific country boundary data from a GeoPandas dataset

I want to extract Singapore country boundaries from 'naturalearth_lowres' dataset from GeoPandas. world_filepath = gpd.datasets.get_path('naturalearth_lowres') world = gpd.read_file(world_filepath) ...
2
votes
1answer
284 views

How to vectorize creating a Shapely Polygon in Pandas

I have a GeoPandas DataFrame with a polygon in each row. I want to add a column with coordinates of a bounding box of each polygon. I can do it this way: def create_bbox(row): xmin, ymin, xmax, ...
1
vote
2answers
198 views

ogr2ogr large gdb file to SQLite warning: “organizePolygons() received a polygon with more than 100 parts”

I'm trying to write a .gdb file (could also be any other format, geojson, gpkg, etc.) to a Spatialite DB but it takes awhile and I am getting a warning. Command: ogr2ogr --config OGR_SQLITE_CACHE 1024 ...
3
votes
1answer
126 views

Find the nearest point on polygon (coastline)

In python I have a shapely polygon (which defines the coastline of the UK), given a point within the UK I would like to find the closest point on the polygon (coastline) to that point. I have been ...
1
vote
1answer
252 views

Geopandas TypeError when saving a GeoDataFrame after creating CategoricalDtype

I'm trying to prepare a column classification of a GeoDataFrame before exporting to QGIS. So, I use pandas.cut. However, when I want to save it I get a TypeError: Cannot interpret 'CategoricalDtype(...
1
vote
1answer
79 views

How to identify interior rings and set them to empty in a shapefile to avoid warning

import geopandas as gpd from pyproj import CRS I'm working with a lot of shapefiles. I've checked their geometry to be valid .is_valid. I have updated to geopandas 0.81 shapely 1.7.0 python 3.6.10 I ...
1
vote
1answer
127 views

Erase Overlapping QGIS Polygon using Geopandas within Jupyter

I have a Polygon of transects that contain overlapping features where they converge. I need to erase where they overlap, but still keep one of the polygons there (preferably the preceding one). ...
0
votes
0answers
123 views

Plot a map with arrows for commuters

I'm trying to plot a map, where arrows indicate information. In my specific case I have several data from commuters, from town A to town B, from town C to town B and so on. I'm missong some keywords ...
0
votes
1answer
257 views

GeoPandas: Get the maximum length inside a polygon

I'm having a a GeoDataFrame of polygons. I want to find the maximum length of a straight line that can fit inside each polygon. You could call this the characteristic length of the polygon. The length ...
2
votes
1answer
944 views

Converting dataframe with Polygon to GeoDataFrame

I imported a shapefile in the form of a pandas.dataframe and ran operations on it. But I can't convert the dataframe to a geodataframe. I tried with gpd.GeoDataFrame, and with wkt.loads. I think it's ...
0
votes
1answer
74 views

Best method for expanding Multi* geometries to their constituent objects [closed]

I have a SpatiaLite table with a geometry column containing a mix of multi and single geometries, e.g. (Multipolygon, Polygon) or (MultiLineString, LineString). The application that will be reading ...
1
vote
1answer
102 views

Extract shapely polygon from matplotlib hexbin polycollection

I'm trying to extract all the vertices of hexagons that are returned from plt.hexbin. I then want to eventually convert them to shapely polygons, so I can use them with geopandas. At the moment I can ...
2
votes
1answer
116 views

Density per grid cell

I have a shapefile with the following format. These are storm tracks and each unique "Serial" represents one storm track. import matplotlib.pyplot as plt import geopandas as gpd input = &...
1
vote
2answers
294 views

Converting (Polyline Data) JSON to GeoDataFrame using GeoPandas

I have this particular json and I want to make the JSON into a GeoDataFrame (with geometry and its attributes); How to set the geometry and attributes to a geodataframe? I have tried using geopandas....
1
vote
2answers
117 views

Trying to export shapefile attributetable to JSON using GeoPandas without the geometry

I am using GeoPandas' read_file function to read a shapefile and to_file function to save to GeoJSON. This is working fast and good. But I need to save only the attribute table without the geometry or ...
0
votes
0answers
216 views

Shapely WKT dumps and loads does not always preserve rounding_precision

Shapely's WKT loads and dumps can be useful for rounding overprecise geometries, as pointed out here (Rounding all coordinates in shapely?) and here (Geopandas [Shapely] spatial difference: ...
3
votes
3answers
187 views

Finding all possible adjacent/closest geometrical points from a given point

So, I have a dataframe like this, import numpy as np import pandas as pd import descartes from shapely.geometry import Point, Polygon import geopandas as gpd import matplotlib.pyplot as plt df = pd....
2
votes
0answers
108 views

Save GeoPandas spatial index to disk

I'd like to save the R-tree spatial index generated by GeoPandas to disk. GeoPandas automatically generates an index for each shape (points in this case) in the dataframe. I'm attempting to create a ...
-1
votes
1answer
81 views

Dissolve feature in geopandas based on multiple attributes

It is possible to dissolve features in GeoPandas based on the attribute field. However, I would like to know how to dissolve features in GeoPandas using at least two attribute fields. Is it possible ...
1
vote
1answer
123 views

Trying to project GeoPandas geodataframe geometry to new CRS is not working as expected

I am working with GeoPandas and a Point GeoDataFrame. I have data points in WGS84 (EPSG=4326) that are located in New Zealand. I am trying to project them to a local UTM, but I cannot get the geometry ...
1
vote
1answer
86 views

Extract the north-west point of a shapely rectangle

I am using Python in a Jupyter notebook. I'have created a geometry with shapely and I need to extract the coordinate of the north-west corner of it. from shapely.geometry import Polygon lng = -180 ...
1
vote
1answer
152 views

Difference between mask and bbox in geopandas read_file

Geopandas read has as options bbox and mask. https://geopandas.org/reference/geopandas.read_file.html What is the difference between those two options?
1
vote
1answer
3k 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. ...
3
votes
1answer
550 views

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
vote
1answer
116 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
2answers
193 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
134 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
69 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
46 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
421 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 ...
3
votes
1answer
157 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
82 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 ...
2
votes
1answer
57 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
119 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
144 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
74 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="...
1
vote
0answers
32 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
107 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
40 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
85 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 ...
4
votes
1answer
751 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
47 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
37 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 ...
4
votes
0answers
1k 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
70 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
198 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
442 views

Reprojecting 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) ...

1
3 4
5
6 7
18