2,804 questions
1
vote
1
answer
102
views
Bizzare "kernel has died" error in pandas df.to_excel() caused by geopandas
When pandas.read_excel(), df.to_excel(), geopandas.read_file() and gdf.to_file() are called in a certain order in different environments, pd.read_excel() sometimes causes "Kernel has died" ...
2
votes
1
answer
74
views
In GeoPandas, list of latitude and longitude points not being classified into a boundary area
I’m working with the Ceremonial County Boundaries of England shapefile available here:
https://www.data.gov.uk/dataset/0fb911e4-ca3a-4553-9136-c4fb069546f9/ceremonial-county-boundaries-of-england
The ...
-3
votes
0
answers
29
views
Why does VS Code sometimes say "trust this notebook" [duplicate]
I'm new to coding. I'm in VS Code, working with geopandas, leaflet, etc. I'm using the .explore() method to show interactive maps. Sometimes, after I run the .explore() method, the output tells me I ...
0
votes
0
answers
40
views
Plotly Choropleth not showing with Geopandas
I've seen this issue come up in other pages but none of their solutions worked for me.
import plotly.express as px
import geopandas as gpd
import cartopy.crs as ccrs
regions = gpd.read_file("...
1
vote
0
answers
102
views
"GEOSException Error: Shell empty after removing invalid points" when trying to buffer with geopandas
First time posting so apologies if I miss important info. I keep getting this error but it only happens intermittently so I have had a hard time narrowing down the problem. I have an input of a ...
-1
votes
1
answer
228
views
How to merge many nearly parallel line segments into a single density-weighted segment (Python/Shapely)?
I have a dataset of line segments derived from many GPS traces, where users have followed the same roads but their paths aren’t identical (think of thousands of cars driving along a road, each with ...
2
votes
1
answer
226
views
How to read a geojson file when an attribute/column values are lists. WARNING:pyogrio._io:Skipping field paths: unsupported OGR type: 5
Here an example of the geojson written using: geopandas.to_file(path/to/example.geojson)
{
"type": "FeatureCollection",
"name": "example",
"crs": { &...
4
votes
2
answers
139
views
Does geopandas overestimate distances?
I was recently doing some statistics based on openstreetmaps. When I used overpass to export the German Autobahnen and geopandas to calculate their length, I found that the lengths do not match the ...
0
votes
2
answers
90
views
Calculating the closest intersection based upon latitude and longitude
I have a geojson file containing the latitude and longitude coordinates of all of the streets and avenues in New York City - they're all formatted as either LineString and MultiLineString as follows:
{...
2
votes
0
answers
48
views
GeoPandas: write to GPX track with timestamps
I have a GeoPandas data frame with ‘time’ (datetime with timezone) and ‘geometry’ (geometry) columns that I want to export out to a GPX track file with timestamps for each point. It seems that ....
2
votes
1
answer
118
views
How to display a legend when plotting a GeoDataFrame
I have a GeoDataFrame I want to plot. This works fine, however somehow I cannot easily plot its legend. I have tried a number of alternatives and checked solutions from googling and LLM, but I do not ...
1
vote
1
answer
61
views
A random line over Greenland when reprojecting to lon=30
I'm making a map on Pyhton and someone recommended that I reporject it to lon=30 for better visuals. But when I do that a random line over Greenland appears. I can't seem to get rid of it.
import ...
1
vote
0
answers
35
views
read geopandas dataframe with gpd.from_postgis passing parameters to sqlalchemy query [duplicate]
I'm trying to pass parameters to sql query to be read with from_postgis function in order to get a geopandas dataframe from a postgis database.
from sqlalchemy import create_engine
from sqlalchemy ...
0
votes
0
answers
50
views
Invalid offset for entity 11037970
I'm reading a polygon file using geopandas:
import osgeo
import geopandas as gpd
polygon_path = "F:\\data\\LPJP\\gwl2020_ch\\gwl_2020.shp"
polygon = gpd.read_file(polygon_path)
print(...
0
votes
1
answer
87
views
Geopanadas subplots:
I am using geopandas and want three subplots. But I could not get pass the subplot axis with geopandas. I am using the geopandas 1.0.1 version.
Here is my plotting code:
df=pd.read_csv('/home/ruby/...
0
votes
0
answers
97
views
How do I modify a Matplotlib colorbar so the labels are integers? [duplicate]
I have a GeoDataFrame that I'm plotting in Matplotlib as a choropleth map.
gdf.plot(ax = ax,
column = 'column to color by',
legend = True,
legend_kwds={"label": ...
0
votes
1
answer
76
views
How export z values with shape file
I have successfully created a filled contour map with UTM data from a numpy array and exported to a shape file, but the shape file only has polygons with no other data. The partial code is:
#Convert ...
1
vote
0
answers
52
views
ValueError: could not convert string to float: '76.4984018.904527.000':geopandas
I am working with geospatial data and attempting to apply machine learning for prediction. Here’s how I read my data:
import geopandas as gpd
import fiona
from fiona.drvsupport import ...
3
votes
1
answer
183
views
How to properly convert a Snowpark DataFrame with GEOGRAPHY to GeoPandas
I've a Snowflake table with a GEOGRAPHY datatype (polygons), which I try to convert to e GeoPandas DataFrame. The Snowpark Dataframe holds the SHAPE column as (GeographyType)
Calling
gpd.GeoDataFrame(...
0
votes
0
answers
50
views
Efficiently Rasterizing a Shapefile into Slant Range with Sentinel-1 SAR Data
I'm currently working with Sentinel-1 SAR data and need to rasterize a shapefile into the slant range. *
To achieve this, I created a GeoTIFF image with two bands (latitude and longitude) using the ...
1
vote
1
answer
47
views
Geopandas - Plot poly-lines with colomap legend
I need to plot poly-lines from a geopandas file, where every line has its own color based on same value (see plot). I am using this script for plotting:
line = geopandas.read_file(shapefile.shp)
ax =...
1
vote
0
answers
55
views
How do I get rid off the outerbox of this cartopy projection?
The cartopy projection ( 0-1 ) is overlapping with my lat and lon ticks
fig, ax = plt.subplots(figsize=(10, 8))
projection = ccrs.PlateCarree()
ax = plt.axes(projection=projection, frameon = False)
...
0
votes
0
answers
52
views
How to flatten column headers in a Python geopandas.geodataframe.GeoDataFrame object?
when I run nodesA.head(), I can see this object has a multi-dimensional hierarchy of headings. I have tried to flatted it by using drop level and flatten as shown in the commented out lines. How can I ...
2
votes
2
answers
72
views
How to calculate distances within boundary of a polygon in geopandas?
I've got two geopandas geodataframes. One is a series of points of locations. Locations of bus stops, for example. Let's call it bus_stops
I've then got another geodataframe where geometry column is ...
1
vote
1
answer
111
views
Creating a Adjecency matrix fast for use in path finding to calculate gird distance from origin
Goal
I'm working on a project that requires me visualize how far a given budget can reach on a map with different price zones.
Example with 3 price zones, water, countryside, and city, each having ...
-1
votes
1
answer
60
views
How to convert ESRI shapefile into .csv with the following fields
I am trying to convert the data shown here into a .csv that contains these following fields
The current script I have takes in the .shp using geopandas and outputs it as a csv. However, the normal ...
0
votes
0
answers
176
views
Shapely intersection function not giving desired result
I am using python to work on polygons. I want to find intersection of two polygons and then find the intersection of the intersected polygon with two lines.the intersection of a polygon with a line ...
0
votes
1
answer
97
views
Folium + GeoPandas plot rendering Issue: missing geometries (despite existing)
Can someone help me understand why my approach for creating a basemap in folium with geopandas is problematic?
I have aggregated counts that I want to pass as a popup using folium and geopandas. I ...
0
votes
0
answers
29
views
Deck map not appearing in databricks
I am trying to visualize a map in databricks. I am creating a geodataframe and converting it to geojson. It looks like this:
{"type": "FeatureCollection", "features": [{&...
1
vote
1
answer
85
views
Plotnine printing point geometry legend as polygon
In my map I have multiple layers. One being points and others being polygons. I want show proper legend (points to show points, polygons to show polygons), whatever way I try I cannot get it to wok.
...
0
votes
0
answers
57
views
Change .shp polygon color based on .csv single cell value
I have a pyplot with three .shp polygons as sublots. I would like to change the color of each polygon based on the values from a .csv file of 3 columns and 2 rows (headers and values). I would like ...
0
votes
0
answers
106
views
geopandas to_crs() returns all coordinates infinite from EPSG:29615 to EPSG:3857
I'm trying to convert a publicly available data set of counties in Minnesota MN Counties from EPSG:26915 to EPSG:3857 for a project I am working on. I downloaded the shapefile from the link above and ...
2
votes
1
answer
369
views
Create geoparquet file from large data set in chunks in python
I am trying to achieve chunkwise writing of geoparquet files.
While writing a parquet file chunkwise via pyarrow.RecordBatch is trivial for pandas chunks and also well documented, doing the same when ...
-1
votes
1
answer
65
views
NCO and CDO manipulations cause "GEOSException: TopologyException: side location conflict"
Edit:
Raw files for the years 1996 and 2005 for testing can be found here.
I have output from two modelling scenarios in a climate risk model (evergreen and control). I want to find differences ...
1
vote
1
answer
596
views
geopandas.read_file of a shapefile gives error if crs parameter is specified
All,
I use ESRI World Countries Generalized shape file, that is available here
using GeoPandas
shp_file =gpd.read_file('World_Countries/World_Countries_Generalized.shp')
print(shp_file.crs)
The CRS I ...
0
votes
1
answer
75
views
Wrap_lon of the regionmask does not work with data span from -180 to 180
All,
I use regionmask package 0.13.0 to mask climate NetCDF data. I found that if my data extends from -180 to 180, the mask function returns all NAN even after I set wrap_lon=180 and I did not set ...
2
votes
1
answer
210
views
Problems obtaining an intersected linestring using GeoPandas
I am having an issue obtaining a linestring from an intersection with a polygon using GeoPandas. The linestring is self-intersecting, which is what is causing my issues.
A line intersecting a polygon:
...
1
vote
1
answer
180
views
Why does geopandas dissolve function keep working forever?
All,
I am trying to use the Geopandas dissolve function to aggregate a few countries; the function countries.dissolve keeps running forever. Here is a minimal script.
import geopandas as gpd
shape='/...
1
vote
1
answer
44
views
Multi Columns Legend in Geodataframe
I tried to plot Jakarta's map based on the district.
fig, ax = plt.subplots(1, figsize=(4.5,10))
jakarta_mandiri_planar.plot(ax=ax, column='Kecamatan', legend=True, legend_kwds={'loc':'center left'})
...
0
votes
0
answers
35
views
Geojsonio does not render jsonfile
All,
The geojsonio package is not rendering simple JSON files on geojson.io as it should be. I get empty map as shown below
Here is the Python code I use to render the geojson file.
import geopandas ...
1
vote
1
answer
394
views
geopandas is missing states.geojson file
All,
I got the following error when trying to import states.geojson file as described in this page https://www.twilio.com/en-us/blog/geospatial-analysis-python-geojson-geopandas-html. I think that ...
2
votes
1
answer
72
views
How can I plot a column that's full of nan values?
I have code that runs through a GeoJSON file and plots columns from that file one by one to show the user the costs of an optimisation. It ran fine, until it came across a column of just nan values.
I ...
-1
votes
1
answer
138
views
Prevent matplotlib from redrawing while data are being added
I was trying to plot some points (via geopandas) and discovered adding them gets progressively slower and slower up to the point where each takes a second and more at only few hundreds. This is harly ...
0
votes
1
answer
89
views
Overlapping Polygon in Latitude/Longitude Space
I have a set of longitudes and latitudes for which I need to create an enclosing Polygon. In some cases, these sets of points overlap and creating a Polygon has been giving me a lot of trouble. I have ...
0
votes
0
answers
51
views
Does downloading Rust/Cargo impact python package installs?
I downloaded and set up Rust and Cargo two days ago. I know this is working correctly since I managed to write and run some very basic programs in the two on the terminal. Today I tried to download ...
1
vote
1
answer
156
views
NetworkX find largest fully connected subset of points
I am new to graph theory and am trying to find the largest subset of x,y coordinate points in which all points in the subset are within a specified distance of one another. I am currently using the nx....
0
votes
0
answers
59
views
Geopandas plot: Image size of 833x81232 pixels is too large. It must be less than 2^16 in each direction
I am plotting a global choropleth map in Jupyter Notebook displaying each country's share of electricity production from fossil fuels (%). I managed to plot the original shapefile on a map, so I know ...
1
vote
1
answer
57
views
How do I make alterations to this shapefile in python with geopandas or cartopy?
How do I add light grey state lines, change the background to white, and change certain areas to certain colors? This is from the EPA Level2 ecoregion map. I'd like to color each ecoregion a separate ...
0
votes
1
answer
95
views
Formatting of Geopandas colorbar text
I want to modify the text format of the colour bar in my Geopandas plot, to include a $ and a comma thousands separator. I also want to set a minimum lightness so that there is still a hint of blue ...
0
votes
0
answers
54
views
Python stacking multidimensional arrays from geotiff, grabbing index of max value of each pixel across stacks
I am fairly new to GeoSpatial coding and coding in general. I have roughly 100 geotiff files of the same region. I'd like to index each stack with the datetime, go pixel by pixel and solve for the max ...