Questions tagged [geopandas]

For questions about using GeoPandas in Python

Filter by
Sorted by
Tagged with
1 vote
1 answer
22 views

GeoPandas reading coordinates in inverse order

I have no knowledge or experience related to geosciences. I have a list of addresses from Rio and I used GeoPy's geocoding (the Google API) to find the coordinates associated with these addresses. ...
user avatar
0 votes
0 answers
12 views

ST_AsRaster equivalent function in Python

I have a table in PostgreSQL such as the one below. fid name rating geometry osgb43210 Smith Street 1 POLYGON ((507300.52 428808.91, 507299.2 428814.15, 507298.48 428813.98, 507299.37 428808.68, ...
user avatar
  • 37
0 votes
0 answers
28 views

Can't read a shapefile in geopandas due to encoding

I'm working with ArGIS Desktop 10.5 and python 2.7, and just installed geopandas to try it out. However, when I tried to read a shapefile, I received an encoding error: import arcpy import geopandas ...
user avatar
0 votes
0 answers
13 views

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". sample data and code: import ...
user avatar
  • 323
1 vote
1 answer
22 views

geopandas error "OSError: could not find or load spatialindex_c-64.dll" in PyCharm using OSGeo4W paths

Using https://spatialgalaxy.net/2018/02/13/quick-guide-to-getting-started-with-pyqgis3-on-windows/ I created a .bat file to load the OSGeo4W and QGIS paths into PyCharm. Now I am getting an error ...
user avatar
  • 1,159
1 vote
0 answers
35 views

Reprojecting from EPSG:3857 to EPSG:28992

I'm attempting to reproject a coordinate in EPSG:3857 to EPSG:28992. The problem I'm running into is as follows: When I use GeoPandas (ie. df.to_crs(epsg=28992)) to reproject my coordinates I get a ...
user avatar
  • 11
0 votes
0 answers
19 views

GeoPandas & Rasterio - Overlaying rasters above a shapefile

I'm new to GeoPandas/Rasterio and I'm trying to make a piece of code for generating a map - I want to show a basemap shapefile (PAA.shp) and layer a raster on top (landuse.tif). Landuse.tif has 3 ...
user avatar
0 votes
0 answers
13 views

Getting an geometry error while creating a table in database from Python using SQLAlchemy

I am trying to create a table in PostgreSQL from Python using SQLAlchemy. The data is an GeoPandas data frame that has the below dtypes, when I am trying to create an table using the below code, it ...
user avatar
1 vote
1 answer
18 views

Looking for GeoPandas equivalents of PostGIS "ST_DumpRings" and "ST_Dump" tools

I have a GeoPandas DataFrame with a MultiPolygon geometry that I want to explode into separate line polygons. I do this by using: gdf.explode() I believe this equates to PostGIS's ST_Dump() but i ...
user avatar
  • 37
1 vote
1 answer
36 views

CRS is empty but GeoDataFrame plotted correctly when reading shapefile with GeoPandas

I have a shapefile that I created in QGIS using the projection NAD_1983_2011_StatePlane_Virginia_North_FIPS_4501_Ft_US. When I load the shapefile into Python as a GeoDataFrame, it appears that the gdf ...
user avatar
0 votes
0 answers
11 views

GeoPandas intersection with polygon elements in single geodataframe [closed]

I am new to Python and have a geodataframe of polygons that intersect each other and I want to run an intersection on the polygons within this single geodataframe to return only the intersected areas. ...
user avatar
2 votes
0 answers
28 views

GeoPandas spatial index - passing RTree parameters to index

I am quite familiar how to work with the Toblerity RTree library: import fiona import rtree with fiona.open(input_path,'r') as source: p = rtree.index.Property() p.filename = "index....
user avatar
  • 854
0 votes
1 answer
36 views

GeoPandas input file to shapefile with coordinate system information

I have written some Python code to convert different input files to a shapefile using geopandas. import pandas as pd import os import geopandas as gpd from shapely.geometry import Point #convert to 3D ...
user avatar
0 votes
1 answer
23 views

WFS output limited to 1000

I use WFS quite a lot to collect my data with the script below. It works most of the time, but I notice that some of the WFS-services I come across have a limited output, as only 1000 records are ...
user avatar
  • 35
1 vote
0 answers
33 views

Finding intersection between polygons in one shapefile using Shapely

I'm trying to repair invalid geometries in my shapefile. Before using object.buffer(0) method to repair them I need to extract geometries that intersect in-between with their whole surface cause I ...
user avatar
  • 33
2 votes
2 answers
45 views

Using Shapely methods (explain_validity and make_valid) on shapefile

I'm trying to find and repair invalidity in my polygons. I have already found out that 10 polygons have self-intersection problems in QGIS, trying the same thing with shapely. This is my code: import ...
user avatar
  • 33
4 votes
2 answers
44 views

Difference in QGIS multipart to single parts and geopandas.explode()

I noticed that QGIS tool multipart to single parts produces different results than geopandas explode when used to MultiLineString geometries. Having a multiple lines which are randomly split along ...
user avatar
  • 129
1 vote
1 answer
31 views

Plot scatter plots over a shapefile using Python

I want to plot a scatter plot over a shapefile plot, but when I plot the scatter, the first layer disappears. The code I use is the following: fig, ax=plt.subplots(figsize=(30,30)) barcelona.plot(ax=...
user avatar
-2 votes
2 answers
67 views

UserWarning: Geometry is in a geographic CRS. Results from 'buffer' are likely incorrect

I am create geopandas DataFrames and create a buffer to be able to do spatial joins. I set the crs for the DataFrame and then proceed to create buffers and encounter the warning then. df1 = gpd....
user avatar
  • 323
1 vote
0 answers
31 views

When using GeoPandas in Python, using the gdf.to_crs() method with the built-in gdf.crs method gives an innacurate transformation

I am trying to use GeoPandas to run some coordinate transformations and I am getting an inaccurate transformation when using the to_crs() method. Here is the code sample: import geopandas as gpd ...
user avatar
  • 11
2 votes
1 answer
133 views

Why are my area calculations in Python so small with .area()?

I'm trying to calculate the area of a flood with Python, but the results seem way too small: iceye_breaks = iceye_breaks.to_crs("+proj=cea +lon_0=0 +x_0=0 +y_0=0 +lat_ts=45 +ellps=WGS84 +datum=...
user avatar
0 votes
0 answers
16 views

Projection error of EuroSAT (Sentinel-2) GeoTIFF

I am trying to plot the geospatial positions of multi-spectral satellite images from the EuroSAT dataset. While plotting all positions at once, I have come to the conclusion that I have some ...
user avatar
  • 101
1 vote
1 answer
36 views

Equivalent of PostGIS ST_LineSubstring in Python: GeoPandas/shapely or any alternatives [closed]

I have a table in a db where I'm running some spatial queries but would like to move this to Python using GeoPandas, shapely etc. Example: ST_LineSubstring(geom, 0.005, 0.995) Which Computes the ...
user avatar
  • 37
1 vote
1 answer
33 views

Identifying n-nearest polygons to point in GeoPandas

I have a dataset of fire polygons, and a user inputted lat/lon coordinate. I'm hoping to write a function to subset the 3 nearest polygons to the inputted coordinate, in order to report out their ...
user avatar
0 votes
2 answers
45 views

reading geometries from a web service in python

I have some code that connects to a gis server, esr rest service, and returns the geometries of the features on that layer. I can pick html, json, geojson, kmz, and pdf as returns and I can export the ...
user avatar
  • 1,159
3 votes
0 answers
47 views

Constructing shapely Points from pandas series

I am new to geospatial analysis including geopandas and shapely. My requirement is to do a point in a polygon operation using a spark dataframe and pandas UDF (for performance reasons). The spark ...
user avatar
0 votes
1 answer
88 views

Access each (x, y) within Multipart gdf.geometry.interiors

How would I access each x, y coordinate within a GeoDataFrame.geometry.interior? With: for ids, row in gdf.iterrows(): for interior in row.geometry.interiors: for oring in list(interior....
user avatar
1 vote
1 answer
51 views

Clipping shapefile with MultiPolygon shapefile in GeoPandas

I have a shapefile (will be called source-file hereafter), which I need to clip by a MultiPolygon shapefile so that I can have a clipped shapefile for each polygon. I tried the GeoPandas, though I am ...
user avatar
2 votes
0 answers
32 views

Making spatial pie chart using two columns in GeoPandas

I am trying to make a pie chart that looks like the one below: - I am using GeoPandas for that: us_states = gpd.read_file("conus_state.shp") data = gpd.read_file("data_file.shp") ...
user avatar
  • 291
2 votes
0 answers
53 views

Geopandas: Error trying to create shapefile

I am attempting to create a shapefile for an attribute that I will be using in a model. The code works up until I get to creating the shapefile and then I receive this error: 'tuple' object has no ...
user avatar
4 votes
1 answer
117 views

Creating minimal enveloping polygon to set of geometries in GeoPandas

To be able to do operations on a set of geometries in a GeoPandas GeoDataFrame, I need to be able to determine whether objects are on the outer "rim" of the set. The set of geometries is as ...
user avatar
0 votes
0 answers
27 views

Applying functools.reduce to make Geopandas geometries valid for unary_union

I want to calculate the total area of a GeoDataFrame, year_df, where the geometries overlap so I need to take the union. I was running into an issue with unary_union (some TopologyException that the ...
user avatar
0 votes
1 answer
31 views

Conversion from wgs-84 to Minnesota state plane(NAD83(NSRS2007) / Minnesota South) gives NaN values

I am trying to convert latitude and longitude(EPSG:4326) to projected coordinate systems(NAD83(NSRS2007) / Minnesota South). I followed this tutorial. My code: TRAN_4326_TO_3596 = Transformer.from_crs(...
user avatar
0 votes
1 answer
36 views

Folium map rendering grey squares on data loaded from geopandas frame

I have a geodata frame loaded in from census data that shows the Dutch population density per 500 by 500 meter square. I am trying to load this data into an interactive map with folium and my geodata ...
user avatar
0 votes
0 answers
19 views

Getting the real pixel size from scan and track

I'm using FIRMS's Fire data, and in the datasheet, they note two values per reading: Scan and Track. They say that those two values reflect the actual pixel size. How to use them to obtain the "...
user avatar
  • 1
3 votes
1 answer
165 views

Buffer with no overlap

I have a GeoDataFrame of a (tiny) street network and want to buffer with no overlap. Thus far I have: #- get the stuff rd = gpd.read_file('./data/roads-cput_proj.geojson') rd.set_crs(epsg=32734, ...
user avatar
0 votes
0 answers
23 views

Load dataset and create raster .grd whit python

Hi I'm new working whit geoespatial documents and I'm trying to load data from a plain text file and I want to convert it to a .grd raster. I would be very grateful if someone could guide me on what I ...
user avatar
0 votes
1 answer
50 views

How identify if polygons from layer A are in same polygon from layer B in Python

I have two polygon layers, layer A and layer B. Layer B polygons are much bigger than layer A polygons. Now, some of the little polygons from layer A are located in the big polygons from layer B, and ...
user avatar
0 votes
0 answers
24 views

Problem: changing EPSG projections leads to different spatial merge results

I am using python/geopandas to merge two datasets - one from WRI Aqueduct Global Flood Risk containing river basins info and one containing a list of real estate properties with lat and long I want to....
user avatar
1 vote
2 answers
72 views

Exploding LineString into segments using Shapely

I am trying to find explode lines tool in QGIS equivalent in shapely or geopandas (which uses shapely anyway). does anyone know this? note that geopandas.GeoDataFrame.explode() does not work because ...
user avatar
  • 613
0 votes
0 answers
20 views

expand polygons in geopandas so that they dont overlap each other

I have a list of of ploygons that have areas mapped out on a map Zones value geometry 1 1693 POLYGON ((77.29454313715819 28.47571416392315, 77.3199164281738 28.49027682729388, 77....
user avatar
  • 83
0 votes
1 answer
11 views

Create new column containing values of a xarray variable selected by point coordinates

I have a xarray and a geodataframe. I want to extract spi_1 values of xarray from point geometries of geodataframe by creating a new column spi_1 in geodataframe. print(xr) <xarray.DataArray '...
user avatar
  • 153
0 votes
0 answers
23 views

Filter invalid geometries in a spatial dataframe

I'd like to join two spatial DataFrames using the ArcGIS API for Python, arcgis.__version__='1.9.0', but the join keeps failing, "likely" based on invalid geometries. import arcgis import ...
user avatar
  • 393
0 votes
1 answer
78 views

Query Feature Service on ESRI ArcGIS REST API with Python Requests

I would like to query a feature service from a public resource, such as the Department of Public Works, to see if they have any buildings near a latitude and longitude. However, whenever I query the ...
user avatar
  • 5
2 votes
1 answer
46 views

Polygonize large raster to create mask gives memory error

I have a very large land cover/land use raster for South America with dimensions (y: 162565, x: 188387) at the Landsat 30m resolution. I want to use it to mask another raster for the same area at 270m ...
user avatar
1 vote
0 answers
38 views

A faster way to extract geometry xy of geodataframe

I need a faster way to extract geometry xy of a large dataset which is in a geodataframe format. I have developed a lambda function as below to do that but I need a faster way. The following is a ...
user avatar
0 votes
1 answer
36 views

Plotting multiple subplots with different shapefiles in background

I am trying to plot side by side GeoPandas shapefiles using matplotlib but the titles, xlabel and ylabel are not plotting correctly. fig, axes = plt.subplots(1,2, figsize=(10,3), sharex=True, sharey=...
user avatar
  • 153
1 vote
1 answer
24 views

Overlaying raster and points to identify pixels

I have two elements - geo_df - a set of Points identifying different assets and a raster (grid) where each grid/pixel has an associated value. How do I overlay the points from the dataset upon the ...
user avatar
3 votes
1 answer
70 views

Extract river nodes from linestring [closed]

I want to extract the coordinates of river confluences. I have a shapefile of rivers in a watershed. I want to get the coordinates of each point where a river joins another. import geopandas as gpd ...
user avatar
  • 153
1 vote
0 answers
60 views

Save GeoPandas geodata frame into a file including symbology to open in QGIS [closed]

I'm working in Python with the GeoPandas library, and I would like to save GeoDataframes into shapefiles or geopackage files with symbology. I've read that in QGIS, it is possible to save the ...
user avatar

1
2 3 4 5
24