A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.

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
20 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
73 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
58 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
30 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
28 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
40 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
45 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
46 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
50 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
97 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
43 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
46 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
100 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 ...
1
vote
2answers
95 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
74 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
43 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
56 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
45 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
40 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
73 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
66 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
72 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
20 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
33 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
50 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
28 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
48 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
20 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
55 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
56 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
47 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
91 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
105 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
30 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
49 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 ...
2
votes
2answers
89 views

Point in doughnut hole incorrectly identified as within KML polygon

I have read in a KML file of CA firezones and for a certain area (around LOMPOC, CA), it seems to include anything inside a non-fire zone doughnut hole. Most of the processing is fine, just there are ...
1
vote
1answer
122 views

GeoPandas - calculate distance a point from a polygon

t1 = Polygon([(4.338074,50.848677), (4.344961,50.833264), (4.366227,50.840809), (4.367945,50.852455), (4.346693,50.858306)]) t = geopandas.GeoSeries(t1) t.crs = {'init':'espg:4326'} t2 = geopandas....
0
votes
0answers
33 views

Error converting a DataFrame to a GeoDataFrame

I have a two DataFrames, one with a Point column and the other with a MultiPolygon column. I need to convert both of then into a GeoDataFrame. To do it with the first one I have used this: geometry =...
0
votes
1answer
43 views

Setting projection parameters in Geopandas

I have a shapefile which I want to reproject to lambert conformal conic and set the projection parameters such as the following: False_Easting, False_Northing, Central_Meridian, Standard_Parallel_1, ...
1
vote
0answers
47 views

Generating transects perpendicular to Shapely/Geopandas Line

I'm doing an analysis on transects going perpendicular to a 1000m topographical contour line and I'm struggling to find a good way to create evenly spaces transects perpendicular to that contour. As ...