Questions tagged [geopandas]
an open source project to make working with geospatial data in Python easier.
239
questions with no upvoted or accepted answers
1
vote
0answers
39 views
Calculate distance in meters using results in degrees
I receive some distance differences in degrees, like this:
0.0009698680322606666
using this function:
def radius(gpd_df, cpt, radius):
sindex = gpd_df.sindex
bbox = (cpt.geometry.x-radius, ...
1
vote
0answers
32 views
Pathfinding in mixed network
I have three geopandas GeoDataFrame representing a road network, telecommunication wires and a set of network devices to be connected to the network. They are respectively depicted as yellow lines, ...
1
vote
0answers
2k views
Python: distance of point to polygon border
I want to measure the distance of a point(lat,long) to a the border of a Polygon.
So I have created the polygon with the coordinates.
from shapely.geometry import Polygon, Point
Polygon(zip(lon_list, ...
1
vote
0answers
89 views
Legend of GeoDataFrame does not sort categorical data values
I try to plot a map of temperature with geopandas in Google Colaboratory. This is my dataset:
id = '1LOywA8JPP6vOFDP-CBOBgkSmX7zv2pDc'
downloaded = drive.CreateFile({'id':id})
downloaded....
1
vote
0answers
243 views
Cannot create geodataframe from feature class due to IndexError: list index out of range
I have a function that helps me read in large feature classes and them create a geodataframe:
line_feat = "S_Studies_Ln"
cnms_cols = ['REACH_ID', 'STUDY_ID', 'CO_FIPS', 'CID', 'FLD_ZONE',
'...
1
vote
0answers
33 views
Get all road intersecting a polygon
I am trying to read from a local instance of the OpenStreetMap database all roads intersecting a boundary coming from another database.
I actually get a result with the following piece of code:
#...
1
vote
0answers
256 views
Removing a duplicated coordinate in multipoints using GeoPandas
I have shapefile river data in line format, import this data with GeoPandas and apply it to a .boundary to get as initial and final coordinates of each line. But as lines intersect a coordinate may ...
1
vote
0answers
419 views
Cannot open gdb folder from external drive using geopandas
I am trying to open a .gdb folder from an external drive with geopandas:
import geopandas as gpd
data = gpd.read_file('/Volumes/SSD/data.gdb')
and I am getting the following error:
DriverError: '/...
1
vote
0answers
83 views
Merging adjacent polygons using Geopandas by avoiding filling gaps
I have raster dataset that I would like to convert into vector polygons. Raster to polygon conversion works pretty good. But, having problem when I try to merge adjacent polygons using Dissolve ...
1
vote
0answers
185 views
Adding distance when buffering point geometry in a geodataframe?
I have 2 geodataframes that I want to combine. They the same fields/columns but different geometries (one is points, one is polygons).To do this I want to buffer the points slightly (like 10m or ...
1
vote
0answers
346 views
Create a GeoDataFrame with more than one geo_column
I am working with PostgreSQL/PostGIS and geopandas. I have tables with more than one geometry.
How can I move this kind of tables to geopandas recognizing all the geometries columns? I am using ...
1
vote
0answers
2k views
Changing CRS of geometry in geopandas dataframe efficiently?
I have a shapefile which I am converting into a geopandas dataframe. The CRS of this shapefile is epsg:4326 and I want to convert this to epsg:3857.
import geopandas as gp
file_path = 'zip_poly.shp'
...
1
vote
0answers
162 views
Most effective way to find spatial relationships in python
I am trying to find the spatial relationship between two polygon geoDFs as follows:
Find geoDF1.geom within geoDF2.geom else (not within)
Find geoDF1.geom with largest intersection fromgeoDF2.geom ...
1
vote
1answer
382 views
How to create a shapefile [polygon type] from a Geodataframe, returned from a Oracle Spatial cursor with geometry column type=cx_Oracle.LOB?
I'm trying to create a shapefile [2D polygon type] with a Geodataframe, that result from a SQL made to a Oracle Spatial database.
The SQL and the Geodataframe creation runs without errors, but when I ...
1
vote
0answers
453 views
Write feature collection to S3
Is there a way to write a feature collection from Python memory to an S3 bucket (as Esri Shapefile, zipped Shapefile or something else) without writing it first to disk?
I tried writing to a ...
1
vote
0answers
845 views
Reading data to geopandas using WFS - GML format
This relates to the question here:
Reading data to geopandas using WFS?
Is there a way to to do the same with a service that does not supply the data in GeoJSON format, but in GML-format?
The ...
1
vote
0answers
428 views
GeoPandas geocode error when using Nominatim
I am following this lesson about Geocoding.
I have entered:
# Import necessary modules
import pandas as pd
# Filepath
fp = r"addresses.txt"
# Read the data
data = pd.read_csv(fp, sep=';')
data....
1
vote
0answers
41 views
Python function like SAGA Grid Gridding?
For a python script, I'm searching for a function that does the same as SAGA Grid gridding, an exponential interpolation on GeoPandas GeoDataFrame.
Does anyone know one?
1
vote
0answers
475 views
Overlay two linestring objects in geopandas, accounting for the attributes
This is a follow up to Intersecting MultiLinestring based geodataframes with geopandas? in which I was trying to intersect polyline layers and carry the attributes over to a resulting overlay/...
1
vote
0answers
237 views
geopandas - which files to use?
I'm new to geopandas and want to analyse a Geodatabase.
The information I received contains a zip archive of 45 files, containing
17 ATX files - each 5KB
2 files without extension - each 1KB
7 ...
1
vote
1answer
639 views
When importing shp-file gives an error “No dataset found at path”
I'm trying to follow this tutorial to GeoPandas and am trying to import the "oceans.shp" file, which I downloaded from here (together with the .dbf, .prj, qpj, and .shx files),
When running ...
1
vote
0answers
376 views
Split geopandas DataFrame evenly by distance
Is it possible to split a geopandas DataFrame that contains LineStrings in evenly spaced segments?
I have a DataFrame loaded from a shapefile that contains the track of a railway. I want to project ...
1
vote
1answer
1k 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
0answers
95 views
Set tolerance for intersection in Geopandas?
I want to set tolerance 10^-8 for the intersection.
inte_s=gpd.overlay(shp,shpa,how='intersection')
How can you do that?
1
vote
0answers
483 views
Group by index column, compare area and add values to new column in Python?
I have these columns:
index, area_of_poly, cad_admin
I have to group by index (it is a normal column called index) in order to take the rows that have the same value.
#all the ones, all the twos, ...
1
vote
0answers
1k views
NameError: name data_all1 is not defined in Python 3.x
I have a standalone script using data opened from a Geopackage with Fiona. When I run this portion of my script:
import os
import fiona
import numpy as np
datapath= '/media/sf_SharesShapefiles/'
...
1
vote
0answers
516 views
How to fill the color in choropleth map in absolute value?
Problem
I am planning to publish an article about 'how many votes are counted in each region' every one hour after the June election in Korea is over at 6 p.m. So at 7 p.m., at 8 p.m., at 9 p.m.,...
1
vote
0answers
501 views
How to Clip raster using shapefile and store each shape as a numpy array
I have a raster file in numpy array of size 4x9000x10000.
The raster file has 4 bands - Red, Green, Blue, NIR and 6 different crop types.
I want to create small arrays of size, say 4x100x100 such ...
1
vote
0answers
308 views
Join multiple Points to Polygon and concatenate joined point values of column into Polygon column
My data:
Points:
ID HN Street
1 5 Examplestreet
2 6 Examplestreet
3 2 Otherstreet
4 2 Anotherstreet
Polygons:
Name
Firstpolygon
Secondpolygon
Otherpolygon ...
1
vote
0answers
518 views
Why GROUPBY doesn't work?
I don't know why but pandas groupby doesn't work in this case whereas I used it well in other scripts.
All lines are still there after it.
This is my code:
all_points['WKT'] = all_points['geometry']...
1
vote
0answers
59 views
Confirming coordinate system/shapefile is correct?
I am using Census Shapefiles from NHGIS. I am trying to convert points from it to easy to read latitude and longitude - but am having some trouble. The sample data I'm using for now is data from ...
1
vote
0answers
555 views
Plot the spatial join shapefile boundary in Python
I have two spatial object
Geo_TWS is a shapefile boundary, geo_cell is points and already convert to GeoPandas.
base = Geo_TWS.plot(color='white', edgecolor='black')
geo_cell.plot(ax = base,...
1
vote
0answers
489 views
Add geopandas to cartopy
How can I add a geopandas geodataframe to a cartopy map? My objective is to create a large number of PNGs to turn into a GIF. The geopandas default plotting options are limited so I would like to ...
1
vote
0answers
125 views
Geometry/Geography type issue for US Census TIGER ShapeFiles
I'm loading the ShapeFiles from TIGER into SQL Server (via Python Geopandas/Fiona). It seems the boundaries are all of the Geometry data type (flat-earth).
Do these file exist in the Geography ...
1
vote
0answers
442 views
select by attribute and calculate field: fiona, geopandas
This may be more of a python question than gis, but I have 3 bands in a polygon layer, and I would like to select earthquakes within each band and calculate a new field to note these locations (band 1,...
1
vote
0answers
157 views
Efficient way to identify the many points at which a large set of shapely LineStrings intersect?
I have 10,000 shapely LineStrings in a geopandas GeoDataFrame. What is an efficient Python plus shapely (and/or optionally geopandas) way to produce a list of all the points at which these lines ...
1
vote
0answers
171 views
From the thousands of the overlaid polygons, get clusters of density
I have a few thousands of the polygons, over the given region. Many of them overlay. What I want is to detect areas, where density (number of overlaying polygons at the point) is substantially higher ...
1
vote
0answers
476 views
How to create a custom transverse mercator projection?
I'm working on a script that performs some simple geometric manipulations such as buffering vector data using shapely or geopandas. The input (i.e. original) shapefile could be geographically located ...
1
vote
0answers
393 views
GeoPandas cumulative value sum for intersecting polygons
I have a geojson file for all of the tax areas in the state of Utah. I read it into a GeoPandas dataframe. Now each row represents a tax area polygon.
Many of the tax area polygons overlap each ...
0
votes
0answers
13 views
Error while installing GeoPandas using pipenv “proj executable not found”
I tried to install GeoPandas using the following command:
pipenv install geopandas
But I had an error:
Installing geopandasā¦
Error: An error occurred while installing geopandas!
Error text: ...
0
votes
0answers
32 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
20 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 ...
0
votes
0answers
32 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
32 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 ...
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
25 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,
&...
0
votes
0answers
19 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 ...
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
23 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() ...
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-...