Skip to main content

Questions tagged [geopandas]

For questions about using GeoPandas in Python

Filter by
Sorted by
Tagged with
0 votes
1 answer
17 views

GeoPandas error: AttributeError: You can only set the value of existing options

When I try to set pyogrio globally like this: gpd.options.io_engine = "pyogrio" I get the error: AttributeError: You can only set the value of existing options This however works: test = ...
i.i.k.'s user avatar
  • 1,607
0 votes
0 answers
15 views

After installation of pyogrio Could not detect PROJ data files. Set PROJ_LIB environment variable to the correct path. when importing gpkg

When I import a geopackage with only geopandas all is fine, however, if I try to use pyogrio like this in my jupyter notebook: gpd.options.io_engine = "pyogrio" network = gpd.read_file(r&...
i.i.k.'s user avatar
  • 1,607
3 votes
2 answers
140 views

How to get a GeoPandas GeoSeries with all the points and their coordinates from a GeoSeries that has multiple types of geometries?

I'm writing a program that reads two MultiLineString shapefiles and intersects them, then process the result in various ways. The intersection normally will give me a GeoSeries of points, like this: ...
cfnnm's user avatar
  • 33
0 votes
0 answers
19 views

Testing for joint spatial clustering across multiple variables

I have an analysis that I'm uncertain how to conduct. I have a GeoPandas dataframe that consists of a few hundred sample points (rows) and for each point I have counts of different variables. These ...
clifgray's user avatar
  • 409
1 vote
0 answers
27 views

Projection with transformation returns unexpected results using GeoPandas compared to ArcPy

I am using GeoPandas to project a geodataframe of polylines representing water crossing locations across the USA from ESRI:102039 (NAD 1983 USGS Contiguous USA Albers) to ESPG:3857 (WGS 84 / Pseudo-...
mafbarth's user avatar
0 votes
1 answer
41 views

MultiPolygon to Polygon in Python [closed]

I need to change geotype from MultiPolygon to Polygon. Most of the original features are Polygon, but are automatically imported through API as MultiPolygon. How can I change all the types ...
Ilya's user avatar
  • 1
0 votes
0 answers
19 views

Colouring MapInfo polygons from Python

I'm using rasterio and geopandas to generate MapInfo TAB files. The resulting file contains a lot of polygons (~10 000). Here is the function I use: with rasterio.Env(): with rasterio.open(...
Riuss's user avatar
  • 1
0 votes
1 answer
51 views

How to round or limit the number of decimals in geodataframe

I need to limit or round decimals in my GeoDataFrame so that when importing to a shapefile and opening a file in QGIS, the number of decimals remains the same as in the dataframe. In GDF looks like: ...
Ilya's user avatar
  • 1
0 votes
1 answer
39 views

Can't change geometry in GeoPandas

I have an extremely strange issue with my code. I have a dataframe with 2 columns with point geometries, startgeom and endgeom. I want to assign a geometry from startgeom, do some calculations and ...
Geocarto's user avatar
0 votes
0 answers
36 views

How to clip a raster file using a GeoJSON?

I am trying to clip or crop out the area of interest from a multi-spectral tiff file downloaded from Sentinel-2, using Rasterio and GeoPandas. For reference here are the code snippets - import ...
Anurag-Sharma's user avatar
2 votes
1 answer
38 views

Remove OGR_STYLE field while/after writing

I'm using an OGR_Style field to set the styles for a MapInfo Tab file with Geopanadas. Does anyone know if there's a way use the OGR_Style field for styling but not include it as a field in the file?
Prosper's user avatar
  • 83
4 votes
1 answer
111 views

Reasons of slow intersection of two GeoDataFrames using Python [closed]

I am trying to find the largest intersecting area for each Polygon in a layer1 compared to the geometries in a layer2 in python. I use geopandas.overlay for it. However, the geometries in layer2 don't ...
tetje's user avatar
  • 99
2 votes
1 answer
49 views

Converting GeoPandas points to polygons and retaining column information

I have a geodata frame that looks something like this: Index Side UniqueID GroupName geometry 0 Blue S1A1B1-D1 Group1 POINT(##.#####, ##.#####) 1 Blue S1A2B1-D1 Group2 POINT(##.#####, ##.#####) 2 ...
Cardiff's user avatar
  • 23
0 votes
0 answers
14 views

Clip NetCDF data by point shapefile in Python [duplicate]

I have .nc files containing global chl-a data. I want to clip these files using a point shapefile and get the chl-a values specifically for those points. However, every similar code that I have come ...
saba moshtaghi's user avatar
2 votes
1 answer
31 views

Does geopandas overlay use spatial indexing

I have a general question about geopandas overlay method. I want to know whether it already uses spatial indexing or not. If not, how would I apply indexing? Background I do an intersection with ...
tetje's user avatar
  • 99
2 votes
1 answer
72 views

GeoPandas giving wrong distances between polygons and points

I'm trying to get GeoPandas to give me the distance between suburbs (polygons) and the city centre (a point). However, no matter what coordinate reference system I use for the distance measurement (...
aiwl's user avatar
  • 123
-3 votes
1 answer
88 views

How to create a file geodatabase (.gdb) in Python without ArcPy?

I want to make a file geodatabase (.gdb) with GeoPandas and Fiona, but as long as I know there is no way to make a feature class without using ArcPy. Is there a way to make it?
Maldonado's user avatar
2 votes
1 answer
62 views

is this posible to extract coastline or border line from multipolygon geojson but keep them separate

i have multipolygon cities , how to get coastline or border line that not intersect with other cities, and keep separate each cities, is that possible? there any software or programing method (like ...
good112233's user avatar
1 vote
2 answers
77 views

Merge partially overlapping line geometries into a single line feature with QGIS, pyqgis, geopandas, shapely

I have a geopackage file with multiline features. The features are extractions from the same line geometries. Some of those extracted lines do overlap, so they partially share the same geometry. Some ...
i.i.k.'s user avatar
  • 1,607
0 votes
2 answers
57 views

GeoPandas join nearby polygons

I have a geodataframe with polygons I would like to join the polygons with the same 'Name' and that they are separated by less than 5 units and summarize the value of the 'Value' field Starting ...
Eduardo 's user avatar
0 votes
1 answer
67 views

Extracting segment of specified length from line geometry using pointgeometry as middlepoint (not as geometry centerpoint) with Python [closed]

I have a line and point geoemtry. I need to extract segments of the line geoemtry based on the point geometry. The point geometry contains the length of the segment I need to 'cut' as an attribute ...
i.i.k.'s user avatar
  • 1,607
0 votes
1 answer
91 views

Convert WKB geometry to WKT

I am using DuckDB in order to access buildings polygons (an open dataset). query = f""" SELECT type, height, level, class, JSON(names) as names, JSON(sources) as ...
ReutKeller's user avatar
  • 2,159
0 votes
0 answers
82 views

How to infer the cordinate system dynamically from a wkt point, for create buffers?

What about if you have a multiple point of the world? How can infer the cordinate system dynamically from a place in Python, for example Mexico, Brazil, Chile, Canada, etc.? The goal is to create a ...
Cristián Vargas Acevedo's user avatar
0 votes
2 answers
126 views

Open GDB file in Python

I would like to be able to open and view a GDB file (GIS file for raster data) in Python. The data is official US government GIS data, the file can be downloaded publicly here: https://www.fs.usda.gov/...
Mustard Tiger's user avatar
1 vote
1 answer
52 views

Inconsistent plot behaviour between geopandas/folium/leaflet and plotly

I need to plot an interactive map of German postal code regions. For this I would like to employ a plotly.express.choropleth map. For roughly ~7500 of the 8300 regions this works like a charm. ...
J Berz's user avatar
  • 13
5 votes
1 answer
90 views

GeoPandas dissolve only adjacent polygons

With GeoPandas I want to do a dissolve for a field but only for the adjacent polygons. For example, I have the following geodataframe geojson_str = '''{ "type": "FeatureCollection",...
Eduardo 's user avatar
0 votes
0 answers
15 views

Error while installing any libraries in ArcGIS Pro Python notebook

I'm trying to install libraries, but the same error is shown for all library installation.
mangotree's user avatar
0 votes
0 answers
78 views

Could not convert the GeoJSON to ee.Geometry()

My GeoJSON file's structure: { "type": "FeatureCollection", "name": "10", "crs": { "type": "name", "properties&...
Muhammad Waqas's user avatar
0 votes
1 answer
29 views

Why does the polygon saved in geodataframe have a different value from the shapely polygon it came from?

I'm working with Jupiter and ipywidgets and Ipyleaflet , trying to draw polygons on a map and saving to a geodataframe. I have the following in a notebook cell: myDrawControl = DrawControl( rectangle={...
user1592380's user avatar
1 vote
2 answers
77 views

Intersecting geodesic lines with coordinate grid using Python

I am performing an analysis using Python where I am trying to assign emissions properties of flights to individual cells in a 4x5 degree coordinate grid proportional to the length of the segment ...
nsteins's user avatar
  • 11
0 votes
0 answers
62 views

GeoPandas colormap normalization for folium explore

When creating static plots a GeoDataframe with matplotlib, I can use colormap normalization to plot data on a robust scale centered at zero. For example as shown in this question Center / normalize ...
ogb119's user avatar
  • 1
0 votes
1 answer
42 views

Selecting the right CRS for a KML file in Jupyter

I'm working with Ipyleaflet to display a KML file in a Jupyter Notebook I have the following in a cell: import fiona import geopandas as gpd from ipyleaflet import GeoData, Map, basemaps fiona....
user1592380's user avatar
0 votes
0 answers
23 views

Create new rasters by interpolating between pre and post rehabilitation digital elevation models

I have two rasters that cover a regional watershed. For most of the watershed, they are exactly the same, but over a small area defined by a shapefile (remediation_zones), the rasters are different. ...
Em_kath_white's user avatar
2 votes
2 answers
69 views

Colorizing polygons based on a user-defined color scheme determined by the column value

I have a shapefile, and the population density for each polygon is provided in a separate CSV file.I would like to assign colors to each polygon based on a user-defined color scheme determined by the ...
user240392's user avatar
1 vote
2 answers
421 views

GDAL warning when importing GeoPandas

When I import geopandas I get the follwing warning: Warning 3: Cannot find header.dxf (GDAL_DATA is not defined) Cannot find header.dxf (GDAL_DATA is not defined) Though everything seems to be ...
Christian 's user avatar
0 votes
1 answer
38 views

shapely.nearest_points wrong result: floating point error?

I am loading a .shp file through GeoPandas that consists of several LineStrings that should be united, but they are not. So I would like to unite them. I am using shapely.nearest_points and creating a ...
Pablo's user avatar
  • 1
0 votes
1 answer
72 views

GeoDataFrame.overlay parallelization with multiprocessing

I'm trying to speed up the calculation of the intersection between two geodataframes with multiprocessing. I'm using GeoPandas with JupyterLab from Anaconda on Linux. My multiprocessing code currently ...
banana store's user avatar
0 votes
0 answers
19 views

How can I reverse the effect of geopands.affine_transform?

Beginner question here... I'm a little unclear on how to go about reversing a transformation of a matrix from the format of Ax=b (or if it's possible for that matter). I started out with a 6x6 matrix ...
Kevin K's user avatar
  • 41
0 votes
0 answers
41 views

How can I read the Geometry of IHO S100 products (S123 and S127) geometry (a GML file) in Python?

I am working on the IHO (International Hydrographic Organization) S100 products, especially, S-123 and S-127. These marine products are the data related to S-123 Marine Radio Services and S-127 Marine ...
milad's user avatar
  • 719
0 votes
0 answers
53 views

Area of intersection between two polygons: TopologyException: Input geom 0 is invalid

I am trying to compute the area of the intersection of two polygons as follows: inter = geomap_ilot.sjoin(df_final_quartiers_arrond) def f(frame): """A function to calculate ...
bravopapa's user avatar
  • 475
1 vote
1 answer
57 views

How do I insert labels or annotate the points in a plot with multiple things?

I'm trying to make a simple study area map which consists of basin boundary shapefile, sampling points and river shapefile. Here's the dataframe of the sampling points: And here's the code to plot ...
mfirdaus_96's user avatar
0 votes
0 answers
34 views

Intersection of polygons [duplicate]

I have a brown polygon which intersects two purple polygons: I d like to make sure that the brown polygon (64981Cas) is allocated to the purple polygon with the highest intersection area (the polygon ...
bravopapa's user avatar
  • 475
1 vote
1 answer
119 views

Cannot plot geometry on a CSV file (Python)

I'm trying to plot a data about Istanbul's metro lines. The actual data is in CSV format and all of the data is in string. The data is from Istanbul Metropolitan Municipality (https://data.ibb.gov.tr/...
Hilmi Emre's user avatar
2 votes
2 answers
111 views

Selecting points which are not in polygons using GeoPandas

I have got two geodataframes: df1 which has got points as geometry type and has around 2.5 million rows, df2 has got polygons/multipolgyons as geometry type and has over 2.6 million rows. I want to ...
user2293224's user avatar
4 votes
4 answers
196 views

Dropping nearly-identical point locations with GeoPandas

I have a GeoDataFrame (gdf) of several thousand point locations. I want to drop duplicate records from the gdf - that is, records with the same attribute information and the same location. However, ...
neirbom9's user avatar
  • 167
1 vote
1 answer
93 views

DataFrame to GeoDataFrame Error: could not convert string to float

I have two Excel sheets with x und y coordinates (EPSG 4326) and several other attributes. My aim is to match both Excel sheets via the coordinates (geopandas.sjoin_nearest). I try to convert the ...
noj's user avatar
  • 13
1 vote
0 answers
409 views

Python script to convert CAD DWG to shapefile

I'm trying to write a python script which will convert a CAD .dwg file to a shapefile (or GeoJSON - whichever is more viable) I don't want to have to use pyautocad as that requires AutoCAD to be ...
guest_231213's user avatar
2 votes
1 answer
73 views

Aggregating points into polylines, sorted by timestamp using GeoPandas/Python

I have a geodataframe that contains positions (point geometries). For each position, we know the individual's id (id_individ), DOY (doy), year (année) and timestamp. I want to aggregate the ...
fab's user avatar
  • 48
0 votes
0 answers
38 views

Getting an empty Python geodataframe while I perform spatial join operation on - polyline/line and points

import os os.environ['USE_PYGEOS'] = '0' import geopandas as gpd sv=gpd.read_file(r"D:\Sampledata\Kerala\Schools.shp") sr=gpd.read_file(r"D:\Map\Kerala\Road_line.shp") gh=gpd.sjoin(...
mangotree's user avatar
0 votes
0 answers
129 views

How do I merge 8 data frame without having duplicate suffixes?

I'm trying to merge a grid cell data set with 7 travel time (to shopping centres) data sets. Here's the head of the grid cell data: Here's the head of one of the shopping centre data sets(The other ...
mfirdaus_96's user avatar

1
2 3 4 5
33