Questions tagged [geopandas]

GeoPandas is an open source project to make working with geospatial data in python easier.

Filter by
Sorted by
Tagged with
1
vote
0answers
60 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
2answers
2k views

How to list all polygon vertice coordinates using geopandas

Im trying to list all polygon vertice coordinates of a rectangle with four corners and a hole with four corners. I drew the vertices in this order: import geopandas as gpd import matplotlib.pyplot as ...
1
vote
1answer
2k views

Intersect points and polygons in shapely

I have some polygons and points that I know overlay which look like this: One thing to note is that in the polygon shapefile there can be multiple which overlap and I want to intersect through all of ...
0
votes
1answer
306 views

See the source fields of a shapefile in Geopandas?

I want to access the source fields(like in QGIS) shp(right click properties->Source fields) but in Geopandas. The logic is to access the source fields (maybe export it in txt) of a valid ...
5
votes
2answers
2k views

Calculating length of polygon in geopandas?

For example to calculate the area is like this: df['area']=df['geometry'].area How do we find the length of the perimiter?
5
votes
1answer
689 views

Dissolve causes 'No Shapely geometry can be created from null value' in geopandas

When I do dissolve: With this specific shapefile happens with other similar it is working fine. Also I checked for null values in the geometry and there weren't any. data2 = pst[pst['PROP_TYPE'].str....
0
votes
1answer
584 views

How to merge polygons that have the same values in one column in Geopandas?

I have an shp. with these columns: ind code area 1 12 200 1 12 100 1 12 23 2 30 223 2 30 112 3 29 234 4 20 232 5 23 211 I want to combine each polygon with the same ...
2
votes
1answer
2k views

float() argument must be a string or a number, not 'LineString'

I am using GeoPandas to create a new database, and I can't assign a multiLineString to the first row of the geometry field. If I assign any other geometry object like a point, lineString, etc. the ...
1
vote
0answers
332 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, ...
4
votes
1answer
293 views

Cannot find polygons that are inside a big polygon using GeoPandas

First of all, some info about my system characteristics: Python 2.7 GeoPandas 0.3.0 I am working on a program, where I filter out the data of two shapefiles -link with data- (each shapefile is a ...
1
vote
1answer
616 views

No Shapely geometry can be created from null value during dissolve in Geopandas?

d1= gpd.read_file(aq.shp) asttom = gpd.read_file(es.shp) data2 = d1[d1['TYPE'].str.startswith(('01'))] dslv=data2.dissolve(by='TYPE') While it reaches the dissolve procedure it causes the error. How ...
0
votes
0answers
516 views

Geopandas causes recursion error in pyinstaller

When trying to turn to exe a py file this happens: RecursionError: maximum recursion depth exceeded It turns out after a lot of trial and error by deleting libraries that may cause issues that after ...
0
votes
1answer
361 views

Turn dissolved polygons to singlepart in geopandas?

I have performed a dissolve but I want to turn it to singlepart.I have searched in the docs but haven't seen something that does it. What do you think? Actually, I want to make it singlepart and then ...
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/' ...
2
votes
1answer
1k views

ValueError: Invalid field type <class 'shapely.geometry.polygon.Polygon'> when exporting shp?

I try to export an shp from Python using geopandas with this: #Create a output path for the data out = r"C:\Users\hhh\Desktop\ge.shp" ## Write those rows into a new Shapefile df.to_file(out) and I ...
1
vote
0answers
179 views

GeoPandas causing issues with PyQGIS standalone

I have a code where I would like to be able to use both GeoPandas and PyQGIS. However, it seems that including GeoPandas is causing issues in the output of PyQGIS. Here is a small illustration using ...
1
vote
1answer
508 views

Extract and sort x coordinates in groups from a column to a new one in geopandas?

I am working with geopandas There are these columns:geo,cat and I have to make the new column called rank. rank should contain according to the groups with the similar cat number an increasing ...
0
votes
1answer
370 views

Densify Shapely polygon using OGR Segmentize

I am trying to densify geometry of polygons loaded by GeoPandas using ogr.Geometry Segmentize. When I print new geometry, it is densified as intended, but it will never save into the shapefile. It ...
1
vote
1answer
137 views

Wildcards in feature selection using geopandas?

I need to select the rows that are according to the following line: Like this is for numbers: data[data['field']<4] I need this: where the words do are inside the name of a given row data[data['...
1
vote
0answers
22 views

How can I plot a map having on my left Asia and on my right America using Geopandas? [closed]

The lowres map comes with the conventional mapamundi (America at the left and Asia at the right).
0
votes
1answer
696 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 ...
0
votes
1answer
503 views

Displaying geopandas points with cartopy

I am trying to display a GeoDataFrame containing points, using cartopy. I first tried to follow the indications given in the documentation of geopandas. However, the points are not displayed: ...
3
votes
1answer
2k views

Convert polygon bounding box to geodataframe?

I have a pandas dataframe that contains bounding box information for tiled raster data in the following format. left bottom right top 466583.40921 3135701....
1
vote
1answer
849 views

Geopandas Proj4 reproject to global equal area projection

I have a geoDataFrame with crs {'init': 'epsg:4326'} The data has a global extent and my goal is to calculate the area (in m2) per feature. Therefore I want to reproject the geoDataFrame using the ...
0
votes
3answers
99 views

Populate missing fields/labels for a grid of polygons with python? [closed]

I have an Esri polygon feature class in a grid that covers a geographic region, and one field, which we'll call 'Label' has an arbitrary label that consists of two digits for north/south, and two ...
2
votes
0answers
335 views

draw map scale in geopandas

Is there a geopandas version of basemap's m.drawmapscale function? If not, can I somehow utilize basemap's drawmapscale function within geopandas?
2
votes
1answer
2k views

Geometry Data in GeoDataFrame will not plot

I want to import a CSV to use as a geodataframe. When I plot it, nothing shows, which makes me think I'm doing something wrong. Here's my code. import pandas as pd from geopandas import GeoDataFrame ...
3
votes
2answers
8k views

Filter a GeoPandas dataframe for points within a specific country

I have a dataframe of health survey data which is geotagged, called momdata. I have converted the dataframe to a GeoPandas dataframe, and used the geotags as the geometry column within the dataframe, ...
0
votes
1answer
347 views

Geopandas Overlay and ValueError

I am trying to get an overlay (intersection) of two geodataframes of polygons, but it returns me a ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all(...
1
vote
0answers
367 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.,...
3
votes
1answer
528 views

How to define boundary numbers without decimal points - Geopandas

Problem The numbers in a legend has the decimal points (eg. 0.00-4.80 at the top of the legend box), when I want them to be integers without decimal points. All I care is that the boundary values are ...
1
vote
0answers
507 views

Get raster pixel value within a shapefile polygon

I have the below GeoPandas dataframe that has: two columns: geometry and raster_val 13 rows The first row is shown below. geometry raster_val 0 ...
5
votes
2answers
2k views

Find all neighbors using geopandas

I am wondering whether it is possible to identify all neighbors to each polygon using only python (with, e.g., geopandas) in the same way that can be done with python in QGIS (Find neighbors polygon).
1
vote
0answers
252 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 ...
0
votes
2answers
1k views

TypeError when trying to plot a combined geopandas geodataframe

I have GeoDataFrame that I am trying to plot in relation to 4 reference points. I'm creating the reference points as part of a separate GeoDataFrame, combining them and then trying to plot the result. ...
2
votes
1answer
560 views

Known Intersecting Polygons returning false for .intersects() in geopandas

I have 2 geodataframes: An original shapefile of water features read in as a geodataframe. (playas) A gdf as a result of a convex_hull operation with only polygon geometries. (polygons) There should ...
0
votes
2answers
2k views

Geopandas equivalent to select by location

I have 2 geodataframes: A single multi-part polygon Many points I have read them in with the following: poly=gpd.read_file('C:\\Users\\srcha\\Desktop\\folder\\poly.shp') points=gpd.read_file('c:\\...
0
votes
0answers
170 views

geopandas geometry.within problem ValueError: Geometry column cannot contain mutiple geometry types

I'm trying to do an overlap of some lines with polygons with geopandas. For a reason I don't understand, gpd.overlay(grid, hel, how='intersection') is not made for lines and polygons, so I'm trying ...
0
votes
1answer
607 views

Why gdf.explode() doesn't work?

I'm trying to merge 2 geodataframes and combine all entities. So I use : cloudNshadow = gpd.overlay(cloud, shadow, how='union') cloudNshadow = cloudNshadow.unary_union() But it returns me : ...
4
votes
2answers
4k views

Calculate distance between a coordinate and a county in GeoPandas

I have a single coordinate and a GeoPandas Dataframe representing US counties whose geometry is polygons that form the boundary of counties. Each of these polygons is also given through lat/lon pairs. ...
0
votes
1answer
138 views

How to keep empty entity during Geopandas Spatial Join

Is that possible to keep entities who haven't join entities in Geopandas Spatial Join ? In join = gpd.sjoin(buf, grouped_aquis, op='contains') I would like to keep buf's entities that haven't ...
0
votes
0answers
114 views

Why Geopandas dissolve failed?

After polygonization of a raster, I would like to dissolve all polygons with same value. So I tried to use : gdf.dissolve(by='column') gdf.dissolve(by='column', aggfunc='first') gdf.dissolve('column'...
3
votes
1answer
2k views

Shapely polygon union results in strange artifacts of tiny, non-overlapping areas

I am not sure if this is a shapely bug or a problem with my polygons. I have a bunch of polygons that look like this: They are level-12 watersheds provided by HydroBasins, and are presumably non-...
4
votes
1answer
1k views

GeoPandas ValueError: A LinearRing must have at least 3 coordinate tuples

I am trying to read a multi-polygon GeoJSON file in GeoPandas, but I am getting the following error: 'ValueError: A LinearRing must have at least 3 coordinate tuples' command used is gpd.read_file(...
1
vote
1answer
5k views

Re-Projecting lat and long in python Geopandas but geometry unchanged

Here the question: the original dataset is like this: and I want to convert it to normal location like this kind: I try load the original file in into geopandas and set the projections, to ...
1
vote
0answers
216 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
195 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']...
0
votes
1answer
1k views

How to self union a GeoDataFrame?

I have a GeoPandas dataframe with lines all originating in the same location. I want to partition the lines into segments and merge them to get a dataframe containing all the unique segments. I tried ...
1
vote
1answer
3k views

Cannot access coords property of LineString in GeoDataFrame

How can I access the coords property of a LineString in GeoDataFrames? I can access other properties, such as area, length, etc, as documented in the Shapely documentation. See reproducible example ...
3
votes
1answer
2k views

How to create a raster from csv points file [duplicate]

I have a CSV points file, with NDVI values. My goal is to create a GeoTiff with 10 meters pixel, where each pixel value is calculated as the mean of points values in this square. I read the CSV with ...