Questions tagged [geopandas]

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

Filter by
Sorted by
Tagged with
2
votes
1answer
19 views

Matching points to polygons and handling points NOT in polygons

I have two GeoDataFrames: one with 191k address points and another with 18 polygons representing catchment areas for specific schools. Theoretically, every address should fall into one of the zones. ...
1
vote
2answers
20 views

Parallel offset on Folium

Is there any way to add parallel offset for those lines which oneway road are False? All line here are straight (segment). So We just have two points for each line (start and end points). # There is ...
0
votes
0answers
22 views

GeoPandas legend not displaying correctly the colors

I need a legend where for every bin that I defined there is a color from a colorscale. I wrote this: ax= merge.plot(column=dates, figsize=[15,15], cmap='OrRd', ...
0
votes
0answers
15 views

Clustering adjacent polygons with values over a given threshold with Python

I have a GeoPandas dataframe that looks like the following geometry raster_val 0 POLYGON ((1.85626 49.12003, 1.85626 49.11171, ... 28.530001 1 ...
2
votes
1answer
2k views

Buffer with dissolve - Geopandas - unary_union multipolygon

I am trying to buffer points which are quite close together, and then dissolve the overlapping buffer polygons into larger polygons. After doing the buffer is where I have the issue. I have tried ...
1
vote
2answers
30 views

GeoPandas dissolve using an attribute filter

I am wondering if it is possible in one pass to use GeoPandas' dissolve to merge together only the records matching a query. Specifically, I have many small areas that should be merged to the larger ...
0
votes
0answers
28 views

Iterating over dataframe and checking points using shapely

I am getting the error when I try to delete row from dataframe. The code checks if polygon contains points. If not I would like to delete this row, but I am getting the error. Why? Error: IndexError: ...
0
votes
0answers
38 views

How to write merged geodataframe to shapefile

Tried the following code. I am able to see the merged data in the console but I don't get any output file. Running my code does not raise any errors either. import geopandas import pathlib import ...
0
votes
1answer
41 views

Counting points and adding to column with shapely

I have a small dataframe and created new column. I would like to add to every record in column 'vertex_counter' value of n. I have the problem because it is doesn't work and I have in every record in ...
1
vote
1answer
30 views

Crop a raster image with the coordinates in a CSV file in Python

I am trying to crop a satellite image with geographical coordinate from a CVS file. I have never cropped an image using coordinates from CSV file. I tried searching a lot but I can only find cropping ...
3
votes
1answer
32 views

Converting a string to LineString

I have a string read from a csv file: 'LINESTRING (-79.494722 43.777724, -79.494805 43.777636, -79.49503799999999 43.777581, -79.495277 43.777524)' I want to convert this string object to shapely....
0
votes
0answers
30 views

Using GeoPandas to generate shapefile from GeoJSON that could be open for ArcGIS

I got from an API a layer of parcels in format GeoJSON, just like the file in this .zip https://www.dropbox.com/s/5eqi8bbqt6ej6lc/json_data.rar?dl=0 I need to convert this to a shapefile that could ...
1
vote
0answers
20 views

Adding custom names to a GeoPandas legend

I have a shapefile which has an attribute table with a column I would like to make a map/plot of. The attribute values are numerical (integer). I have made two dicts to map the colors and names I want ...
1
vote
1answer
30 views

Creating a grid from pixels of a georaster in Python with GeoPandas

Let say we have a georaster file with a given resolution. Is is possible to create a grid where each cell of the grid correspond to each pixel? Is it possible to store this grid as a GeoPandas ...
2
votes
2answers
792 views

Dataframe of points to PostGIS

I have a csv file with some info and coordinates and I want to create a table in PostGIS with that CSV file. This is what I have so far: import pandas as pd import geopandas from datetime import ...
1
vote
0answers
16 views

Spatial join two identical layers

I'm working with Python and GeoPandas. I have two parcel layers that are identical and in the same coordinate reference system. The parcel number field is not unique so I am unable to join on that ...
43
votes
6answers
34k views

GeoPandas: Find nearest point in other dataframe

I've got 2 geodataframes: import geopandas as gpd from shapely.geometry import Point gpd1 = gpd.GeoDataFrame([['John',1,Point(1,1)],['Smith',1,Point(2,2)],['Soap',1,Point(0,2)]],columns=['Name','ID','...
0
votes
0answers
13 views

Problem with Python code to visualize a map in the geospatial analysis

You can download relevant files to execute my python code as below: https://drive.google.com/drive/folders/1WmkZ9t3RnAsd4Dy83TRdjWIsAdby4IwI I want to visualize data at the postal code level with ...
0
votes
0answers
24 views

Choosing coordinate reference systems for esriGeometryPolygon in GeoPandas

I extracted a layer of parcel Geometry Type: esriGeometryPolygon and save as JSON, this is a fragment of one row of this JSON: { "attributes": { "OBJECTID": 171195, &...
1
vote
1answer
51 views

Dump multiple geometry columns of a GeoDataFrame to Features in a FeatureCollection (GeoJSON) instead of properties?

I have a GeoDataFrame with some of its attributes that are geometries (only the position is the one which was interpreted as the active geometry when loading the data from PostGIS): import psycopg2 ...
0
votes
0answers
810 views

Visualize big data HTML file created with Folium

I have written a Folium map of a French city with the possibility of visualizing attributes information on click for each of its polygon which makes a huge file after 2 hours of calculation with the ...
2
votes
1answer
928 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 ...
1
vote
0answers
16 views

Opening gkpg in geopandas throws: UnsupportedGeometryTypeError: 12

I wanted to open a gkpg file in geopandas 0.8.2, on windows, using conda mith channel conda-forge obj = r'path.gpkg' layer="layername" gdf = gpd.read_file(obj, layer=layer) Throws the ...
1
vote
1answer
998 views

Dividing Geographical region into equal sized grid and retrieving indexing position

I have GPS coordinates of human mobility in Beijing Area. I want to divide geographical space in to rectangular grid, for example 2 sq. km (delta), and access the indexing position of any point inside ...
1
vote
2answers
33 views

Exchange of coordinates in GeoPandas

I was plotting some points with the plot function in GeoPandas. I realized that when I plotted using Point.lat, Point.long, the points didn't fall at the right place but when I exchanged the ...
6
votes
1answer
157 views

Adjusting edges around markers in legends in GeoPandas plot

I am trying to adjust the edges around the markers in my legend. Currently my code looks like this import matplotlib.pyplot as plt fig, ax = plt.subplots(figsize=(15,10)) lri_map.plot(column= '30', ...
1
vote
0answers
49 views

Detect one-way road from origin_id and destination_id

How do I detect the one-way roads? I have a graph G( MultiDiGraph(G) with origin(Id) and destination(Id) nodes. I would like to detect one-way roads. Example if there is an edge from the origin "...
1
vote
0answers
43 views

Count overlapping features using Geopandas

Is there a way to easily count overlapping polygons using Geopandas, the same way as the ArcGIS Pro Count Overlapping Features works? So far my approach was to do union overlay and then dissolve with ...
0
votes
0answers
18 views

Adjusting pixel values of a raster based on geopandas colums or fields

I have a geodataframe with geometry column containing Polygons and 5 fields or columns('Crop1', 'Crop2', 'Crop3', 'Crop4' and 'Crop5') as well as a raster image. There are 159 rows in the geodataframe ...
1
vote
1answer
22 views

How to ensure the values set in the CSV are captured within the GeoJSON feature values when merging CSV attributes into a GeoJSON

I create a GeoJSON but the merged values are null. The length of the datasets do not match -- is this a potential issue? If so, how do I merge for all covid matches. (FYI this isnt Covid19 related COV ...
1
vote
1answer
46 views

Find vertices of LineStrings within Polygon - Shapely

I would like to use Shapely to find the vertices that are located within the boundaries of a Shapely Polygon. So far, I could only manage to get it running by converting the LineString and the Polygon ...
0
votes
0answers
29 views

How to fetch lightning data with Python Pandas?

My code which I have effectively takes in as input the lightning data (in its case- http://wwlln.net/ but in my case, it's GHRC data), the global shapefiles, and population density data. How would I ...
0
votes
0answers
22 views

geopandas: clip() not working as expected

I have two dataframes--one with a polygon (POLYGON Z in region column), and one with one linestring (LINESTRING Z in path column) per row. I was expecting that the following code calling .clip() ...
7
votes
1answer
6k views

GeoPandas spatial join and count

I have following two GeoDataFrames. One with the crime count per polygon per year. Polygon Year total_crime shape_area geometry 0 0 2009 1 3.266388e+06 ...
0
votes
0answers
28 views

Error d'initialization pyproj

I have an Access database(.mdb) and I want to create a shape points from this database by using a library of GeoPandas. My script is working properly, but recently I encountered this problem after re-...
2
votes
1answer
31 views

Adding columns to GeoDataFrame

I would like to add columns xmin, xmax, ymin, ymax and I take coordinates from column 'geometry'. I have exemplary dataframe with 1 records. Where is the problem? Data: FID_1 GODLO ...
5
votes
2answers
112 views

From uploaded zipped shapefile to Geopandas DataFrame in Django Application

I'm trying to get to a point where I can quickly filter thousands of points in a shapefile. My Django application asks for a zipped shapefile to upload, where the zipped file contains at least the ....
1
vote
1answer
17 views

Python: Cannot construct empty GeoDataFrame with columns

My script import geopandas as gp test = gp.GeoDataFrame(columns=['geometry', 'costs']) the error: File "/usr/local/lib/python3.7/dist-packages/geopandas/geodataframe.py", line 89, ...
0
votes
0answers
19 views

Reading text-anchor and text-angle from DXF using geopandas -> fiona -> gdal

I am working on a Pyhton desktop app that publishes CAD-files (dxf) to Postgresql/ GeoServer. It uses geopandas to import the dxf-file. The resulting geodataframe doesn't contain the anchorpoint and ...
0
votes
0answers
48 views

Read / write MapInfo Tab and convert it to CSV format

I am very new in python and trying to read MapInfo (.TAB) file and convert it in to CSV format in following way: import geopandas as gpd input_file = 'F:/.../QGIS/sites.tab' test = gpd.read_file(...
0
votes
1answer
842 views

Spatial overlays: Union between multiline and multipolygon with geopandas

I try to overlays (apply union) my multipolygon on the multiline with GeoPandas, but it seems like the GeoPandas overlay function work only with (Multi)polygon. Is there any way to make that with ...
0
votes
1answer
425 views

geoplot: axis limits cannot be nan or inf

I am trying to plot a geodataframe with geoplot, and cannot work out the solution to ValueError: Axis limits cannot be NAN or Inf Context: Linux (Ubuntu 19.10, x86_64) cugdf.head(): Cu_ppm ...
1
vote
0answers
17 views

Return Geometry in a Pandas Dataframe Google Earth Engine

I have found some sample code that returns features from a GEE image to a pandas dataframe based on specific points in my feature collection. The challenge is I need the geometry on these points to be ...
2
votes
1answer
62 views

Create 3D lines at a specific distance and bearing from a 2D polygon using Shapely and Geopandas

I have a shapefile of the runways(polygons) of different airports: I want to build a line that represents the 3D trajectory followed by an airplane 9 km after take off and 18 km before landing and ...
1
vote
1answer
36 views

Set geometry in geodataframe to another column fails : TypeError: Input must be valid geometry objects:

I have CSV file which I read with geopandas. I use "read_file",define the crs , but seems like it doesn't know to choose the correct geometry column. I have tried to use "set_geometry&...
0
votes
1answer
155 views

Converting GeoDataFrame to DXF using GeoPandas [closed]

I have ten geodataframe; I would like to export each one of them to DXF: geodataframes= [gdf1,gfd2,gdf2] for geodataframe in geodataframes: #geodataframe to dxf it would be possible?
3
votes
1answer
2k views

Folium heatmap not displaying

I have an output file data.json [{"5403": 2, "9734": 1, "2565": 5, "5087": 2, "9061": 1, "1761": 4, "4811": 7 "1111": 5, "3891": 3, "1962": 3}] and a shapefile converted to geojson https://www....
2
votes
0answers
26 views

GeoPandas: Calculate coordinates of a point within a linestring [closed]

I have two datasets, one is a GeoJSON of a highway with around 1509 linestrings. The other is a list of incidents that have occurred along said highway, but, instead of coordinates, the file specifies ...
0
votes
0answers
40 views

Field length in geopandas shapefile output

I am converting an excel sheet to .shp via pandas i.e. I have a dataframe with 150+ columns and ~900 records (increasing by about 50 every day), that I convert to geodataframe and export to shp: ...
1
vote
1answer
67 views

Get geopandas geo or affine transform

Does anyone know how to get the affine transformation from a geopandas dataframe? I need this for rasterising geospatial vector data with rasterio. shapes = ((geom,value) for geom, value in zip(...

1
2 3 4 5
18