Questions tagged [geopandas]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
38 views

Nearest neighbours with Python

I'm learning Python and this has been a bit of a challenge! My DataFrame looks like this below. name geometry 0 Uimastadion POINT (24.93045 60.18882) 1 Hartwall ...
1
vote
0answers
26 views

Parallel processing in GeoPandas

Using this implementation of parallelization raises a TypeError: 'Series' object is not callable. The following code tries parallelization with the "denominator" function and should give me the sum of ...
1
vote
1answer
27 views

Make a list from shapefiles using GeoPandas

I have a number of shapefiles (protected areas for different years) which I would like to dissolve using one attribute. I have not found a line of code to create a list from the shapefiles so iterate ...
1
vote
1answer
26 views

Check if function-argument is valid vector-geometry in Python GeoPandas

I wanto to build a function (let's call it clip) that accepts a vector-file (can be a shapefile, a geopackage....) and a raster. How can I make sure the argument that the users gives to the function ...
2
votes
1answer
48 views

Using CRS EPSG:3857 but misalignment between Stamen background and coordinates of polygons in GeoPandas

Using GeoPandas and Contextily to create maps with a Stamen background map I notice a misalignment between the background map and the coordinates of polygons drawn on the map. The shapefile is from ...
0
votes
0answers
26 views

Issue exporting GeoPandas dataframe

I am trying to export a GeoPandas Dataframe looking like this to an external file: id geometry 0 POLYGON ((39.92713 1.41394, 39.92703 1.41394, ... 1 POLYGON ((39.95126 1.41866, 39.95116 1....
4
votes
1answer
79 views

Assigning new values to polygon based on overlapping area with other polygons

I have two square polygons df1 and df2. Both polygons are assigned a value of 10 (df1) and 20 (df2) in the "content" column. Let's assume, I have a circle with the midpoint 1.5,1.5 and a radius of 1. ...
4
votes
1answer
73 views

Setting CRS to ESRI:102001 using GeoPandas

I've been passed some GeoJSON shape data that I've been told is in the CRS ESRI:102001, although that property has not been written into the GeoJSON file. I've been able to confirm that is the correct ...
1
vote
1answer
33 views

Finding distance of consecutive points in a GeoPandas data frame

I am trying to find the distance between every consecutive points in a GeoPandas dataframe. Let's say we have the following data frame: import pandas as pd import geopandas data=pd.DataFrame() data['...
1
vote
0answers
29 views

Folium choropleth plots markers [closed]

I have this code to plot a choropleth from a GeoPandas DataFrame. def create_gpd_dataframe(self d = {'Angle of point': yard_list, 'Latitude': yard_lat_list, 'Longitude': yard_lon_list} ...
0
votes
1answer
44 views

Extract/export Attribute Table of pixel information from Classified Raster in Python?

I am at beginner level in image processing with python. I have classified satellite image with python in 10 classes. I am able to write the image in geotiff format. However, I do not know how extract ...
3
votes
1answer
47 views

Summing four rasters to one suitability raster using Rasterio & GeoPandas in Python

I am trying to create a basic suitability raster from three vector sources and one raster source using Rasterio & GeoPandas in Python. I have already clipped and rasterized the vector sources to ...
0
votes
0answers
55 views

Python, Folium choropleth, plot by value

I have a GeoPandas dataframe: self.geopd = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.Longitude, df.Latitude)) Angle of point Latitude Longitude geometry 0 ...
1
vote
0answers
62 views

GeoJSON as string to GeoPandas geometry Python

I have this (subset) Pandas dataframe: I read it from an XLSX file. I would like to convert it to geopandas GeoDataFrame. In order to do so, I need a valid geometry column. The GeoJSON column in my ...
2
votes
2answers
107 views

How to import GeoPandas in QGIS 3.10

Here is the situation: I've installed QGIS 3.10 with the downloadable .exe file and accepting all as predefined. The Python version used with it is 3.7.0 like here: import sys sys.version '3.7.0 (v3....
1
vote
1answer
49 views

Python, GeoPandas, how to extract to a list by range of a column

I have GeoPandas dataframe: d = {'Angle of point': plot_angles_list, 'Latitude': lat_list, 'Longitude': lon_list} df = pd.DataFrame(d) gdf = gpd.GeoDataFrame( df, geometry=gpd....
3
votes
1answer
53 views

GeoPandas to PostGIS database

New to using GeoPandas instead of Pandas. I am trying to export a GeoPandas dataframe to a PostgreSQL database (with PostGIS extension). The import is from the same database as I try to export to ...
2
votes
1answer
108 views

Accelerating GeoPandas for selecting points inside polygon

I have one dataset with about 10 million points (lat, long). I would like to select the points that fall within a map. I have this map as a shapely object (.shp). To do this, I transformed the ...
0
votes
2answers
113 views

CRS error working with Solaris [closed]

result_polys = sol.vector.polygon.georegister_px_df(mask2poly, affine_obj=tile_tfm, crs= 'epsg:4326') ...
2
votes
2answers
75 views

Accelerating the code for random selection of polygons

I have a shapefile with thousands of features (polygons). I need to randomly sample one polygon at every 1 sq. km. area if at least one polygon is available. I wrote the following code which works. ...
4
votes
1answer
58 views

GeoPandas Intersect function gives different result to Shapely

Using this example dataset of country geometries, I seem to get a different result on whether or not the USA and Mexico intersect when I do the calculation with GeoPandas as opposed to directly with ...
0
votes
1answer
46 views

Loading Geodataframe to PostgreSQL with psycopg2 connection

I have created a Geodataframe from a PostgreSQL table with the following instruction (where 'con' is a psycopg2 connection): gdf = gpd.GeoDataFrame.from_postgis("SELECT id, geom FROM {0}".format('...
1
vote
1answer
33 views

Creating custom proj4 string from components

I'm trying to work with NOAA's NDFD weather data, which are released as rasters in GRIB format. Specifically, I'm currently trying to get the pixels that intersect an arbitrary geometry. Information ...
1
vote
2answers
58 views

Reading raster values in points gives back a generator object instead of actual value

Given a raster TIF file and a point feature class in a geodatabase, I am trying to extract the values of the raster on the points and add them as a new column on the point feature class. I am using ...
1
vote
0answers
46 views

Link point to nearest line using GeoPandas [closed]

I use GeoPandas to link a point feature to the nearest line feature with the code below. I thought I might share it for anyone to comment on it or offer a better solution. Pay attention to the comment ...
1
vote
1answer
46 views

Load table with GEOMETRY column to Pandas DataFrame

I am trying to load table (from Postgres DB) with GEOMETRY column to Pandas DataFrame using pd.read_sql_table method. I am getting error becuase GEOMETRY type seem to be not supported: C:\Anaconda3\...
2
votes
2answers
77 views

Building GeoDataFrame row by row

I am trying to build GeoDataFrame row by row, from an empty one. The equivalent using only pandas would be something like this : df = pandas.DataFrame(columns=['a','b','c','d']) df.loc['y'] = ...
2
votes
1answer
73 views

Matching X and Y axis coordinates of two GeoPandas geometries to overlay them

I have two GeoPandas GeoDataFrame objects with their corresponding geometry columns. GeoDataFrame 1: counties --> has polygons and multipolygons of Dominican Republic counties. The source data was ...
1
vote
1answer
87 views

Line and polygon intersection in GeoPandas/Python

I am trying to intersect two GeoPandas data frames, the first one is the street data (streets) and the second one is a buffer (polygon) around a point (buffer). I want to find the intersection of ...
0
votes
0answers
22 views

GeoPandas drops .prj file

I'm trying to create a df through a GeoJSON url, merge it with a df created out of a SQL query, and create a shapefile/GeoJSON from the output. The output has everything put the .prj file (in the ...
1
vote
1answer
35 views

Create LineString from lat/lon coords form CSV. with beginning and ending lat/lon?

I am iterating through a CSV file of tornadoes, and for each row getting the beginning lat, beginning long, ending lat, and ending long. and trying to plot their line geometry on a map. I got the ...
1
vote
1answer
34 views

Failing Unions due to Non-Noded Intersections

I'm trying to perform lots of unions in GeoPandas. I've got around fifty sets of between 7-12 GeoDataFrames of the same place at different times that I'm trying to union into one layer per set. Right ...
1
vote
1answer
53 views

Building Raster Attribute Table (RAT) from GeoPandas dataframe with rasterio or GDAL

I am trying to figure out how to generate a RAT for a 1-band raster with rasterio or GDAL given a GeoPandas dataframe. My GeoPandas dataframe has 4 columns (X, Y, PERC_VALUE, LANDUSE_LABEL) which I ...
0
votes
1answer
29 views

Adjacency Matrix from linestring using GeoPandas

I got my adjacency matrix wrong way round. I got the intersection of edges. I need to have information per node instead. as per https://math.stackexchange.com/questions/1890620/finding-path-lengths-by-...
0
votes
0answers
15 views

Faster way to truncate the coordinates than pandas.apply?

If have a GeoDataFrame with loaded coordinates. I'm using apply to truncate the coordinates precision - is there a faster way than using apply? gdf.geometry = gdf.geometry.apply( lambda p: sg....
2
votes
0answers
52 views

Plotting GoeDataFrame on a raster

I have a bunch of polygons which I loaded from a shapefile into a fields GeoDataFrame: geometry raster_val 0 POLYGON ((8.56799 47.80800, 8.56799 47.77200,...
0
votes
0answers
21 views

Reading password protected shared file geodatabase using GeoPandas

I'm trying to read a geodatabase that is stored in a password protected shared geodatabase using GeoPandas. Is there a way to do so? I attempt to connect using this. import geopandas as gpd ...
1
vote
1answer
65 views

Writing osmnx queried footprints to shapefile

I'm attempting to pull a set of building footprints from open street map using a shapefile boundary. I have success getting the buildings into a geodataframe, but when I attempt to write them out to ...
1
vote
1answer
60 views

Matching GPS trackers POINT data between Nodes of OSM (Open Street Map) [closed]

I have GPS point data of vehicles from XYZ Tracking Company. The data has following columns: UnitID RecordDateTime LATITUDE LONGITUDE Speed Direction Reason Altitude Data Dictionary is given below:...
1
vote
1answer
52 views

Using vmin and vmax does not change anything for my plots

I have this code here for plotting 2 variables with different values Min:0 Max:33 Min:0 Max:13 import geopandas as gpd import pandas as pd import matplotlib.pyplot as plt pm10_base = gpd....
2
votes
1answer
114 views

Convert GeoJSON to GeoPandas GeoDataframe

I created the following GeoJSON object with this code: from rasterio.features import shapes polys = [] for shape, value in shapes(segments, transform=affine): polys.append(shape) [{'type': '...
3
votes
1answer
38 views

GeoPandas geometry is different on Windows and Linux

Building a same application both on Linux and Windows I noticed that the geometry is handled differently after transferring the dataframe from WGS84 projection to OSM. The results of the program ...
0
votes
1answer
64 views

Grid polygon generation by converting meter to degree using Python

When given a shapefile as below as an Input, I would like to generate a 100x100 meter polygon grid using python. I went through Creating a regular polygon grid over a spatial extent, rotated by a ...
2
votes
0answers
27 views

Create sequential ID column type when loading GeoDataFrame to PostGIS

Is there a way to define GID column as sequential (auto-incremental) when loading GeoDataFrame (created from Shapefile) to PostGIS? I use Geopandas and "to_sql" method: geodataframe.to_sql(tablename, ...
2
votes
1answer
127 views

Save GeoDataFrame to .jpg file

I have a GeoPandas DataFrame (loaded from a shapefile) containing a number of polygons which looks like this: geometry raster_val 0 POLYGON ((8.56799 47....
0
votes
1answer
34 views

ValueError geopandas.sjoin: why does it not read my GeoDataFrame?

I'm working on a spatial join between a polygon from a shapefile and points from a CSV file, using geopandas.sjoin. I want to assign each point with a name of the province it is located in. I do know ...
1
vote
2answers
37 views

Loading GeoDataFrame to PostGIS when GEOM column contains MULTILINESTRING and LINESTRING

How can I load GeoDataFrame (populated from shapefile) to PostGIS when GEOM column contains MULTILINESTRING and LINESTRING e.g.: LINESTRING (14.2384666 46.6304714, 14.2386703 46.6304123) ...
2
votes
1answer
54 views

Modify bounding box of GeoDataFrame

I have a GeoDataFrame which is a multipolygon and represents boundaries of a country: 0 MULTIPOLYGON (((10.10112 46.23346, 10.10099 46... Its bounding box/extent is: minx miny maxx ...
1
vote
0answers
38 views

Intersecting 'n' shapefiles in Python and get the sum of a specific attribute in intersection areas [closed]

I have 'n' shapefiles and where they intersect i need to sum a specific attribute. In some points they all intersects, in other points only some of them intersects while in others i don't have any ...
0
votes
0answers
41 views

Is it possible to read temporary QgsVectorLayer with fiona or geopandas?

I want to change all features' attribute without for loop. I checked pyQgis, geopandas and fiona api. However, I can't find a method. Geopandas and fiona want to file path but I don't have any path ...