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
121 views

Intersection of two shapely polygon geometries

I have Shapely polygon geometries, A circle(c) and list of polygons within the circle. I want to find the union of the circle with the intersections. (circle + intersections) I was trying to ...
0
votes
1answer
17 views

Simplifying Polygons and MultiPolygons for Visualization

I completed a computation with Canadian Census data and discovered, when trying to visualize the results with Bokeh 2.0.2, that the Polygon and Multipolygon paths were very high resolution with a ...
0
votes
2answers
51 views

Convert multiple JSON files to a single shapefile or geodatabase feature in ArcGIS or Python

I have been querying one feature in Esri ArcGIS REST Service, but because it is a large data, I had to query it several times (1000 features query limit). This results in many JSON files as parts of ...
1
vote
1answer
68 views

How do you validate longitude and latitude coordinates in Python?

I am working on a bunch of shapefile data, and I need to process it and after some kind of processing, I need to feed the data to an indexer (in this case ElasticSearch). The problem is I just ...
2
votes
1answer
38 views

Check Conditions on Geopandas

I have a GeoDataFrame : df gid complement geom 0 0 None POINT (601719.697 6316169.550) 1 1 None POINT (889885.470 6766441.264) 2 2 None POINT (841297.833 6819921.974) 3 3 ...
0
votes
0answers
19 views

When I get the total bounds of a shapefile, which are llcrnrlon, llcrnrlat, urcrnrlon, and urcrnrlat? Need it to use Maptlotlib Basemap

The goal is to use an ESRI webmap as a basemap beneath a shapefile for a script that visualizes earthquakes in the Philippines. But first, I'm practicing in using Basemap in a separate script. ...
2
votes
1answer
39 views

GeoPandas .sjoin polygon in polygon - works fast for some countries, but not for others

I am new to working with geodata. Setup: GeoPandas, Python3.6 I have a dataset of square polygons of 10x10km for countries. However, some of these squares are already completely in a neighboring ...
2
votes
1answer
19 views

Merging sets of polygon from adjacent image tiles

I have two geodataframes that describes objects in two adjacent tiles. I would like to merge these two dataframes so that I can obtain a single dataframe that contains all the polygons. Using the ...
1
vote
0answers
46 views

Value error when trying to load line and polygon GEOJSONs into PyCharm/Python

I'm a newb so apologies if there's incorrect formatting etc here. I'm trying to use GEOJSON files to visualise some data in Python using GeoPandas (GDAL, fiona, shapely, numpy, matplotlib are all ...
0
votes
1answer
61 views

Loading GeoDataFrame as QGIS vector layer without exporting to shapefile

I'm using Python console in QGIS to manipulate geospatial data using geopandas. I want to load the output (GeoDataFrame) to the canvas as vector layer directly without exporting it to a file first. Is ...
0
votes
1answer
31 views

Is this transformation using square metres or kilometres (3857/32633)?

I am using geopandas to compute population per km2. However, I don't know if this transformation is using meters or kilometers. gacs_df = gpd.GeoDataFrame(acs_df.merge(census_gdf2, on="geo_12", how="...
4
votes
1answer
89 views

Plotting a CSV with coordinates one row at a time via GeoPandas

I have a CSV of all earthquakes in my country for the last 10 years arranged by date and time. My goal is to plot each line chronologically one by one, so that I can compile these maps and produce a "...
0
votes
1answer
107 views

ValueError: Cannot transform naive geometries

I was trying to execute this code: # Load geojson files country = gpd.read_file('svn_buffered.geojson') train_shp = "large_training_aoi.geojson" test_shp = "large_test_aoi.shp" train_polyg = gpd....
0
votes
0answers
12 views

Fast way of selecting Points that are in a Shape

I am using GeoPandas to select the points that are part of a shape. The dataset is quite large, with 10's thousands of points and shapes. This is how I do it right now, and it takes me days to run for ...
2
votes
1answer
47 views

Is there an equivalent argument to index_col in geopandas.read_file() function?

I am looking for the equivalent argument to pandas.read_csv(index_col='column') in the geopandas.read_file() function. My goal is to read a shapefile and specify the index column. However, the ...
0
votes
0answers
29 views

Plotting via GeoPandas but only one point shows. What's wrong with my code? Map and points are in same projection

I've been stuck at this for two weeks and have tried already solutions online. I am using Python 3.8. from shapely.geometry import Point import geopandas as gpd from geopandas import GeoDataFrame ...
1
vote
1answer
21 views

How to combine labelling with limited boundingbox when plotting a geodataframe

I am trying to plot a limited boundingbox of my geodataframe setting up some x and y limits to the ax. Everything works but the labelling. This is my piece of code and current result: fig, ax = plt....
0
votes
0answers
26 views

Try to merge multiple shapefiles and write as one new shapefile via Geopandas in Python

The goal is to use Geopandas in Python to merge all shapefiles into one new shapefile. I ran a test code before creating the loop to merge all shapefiles together, import geopandas as gpd import os ...
0
votes
1answer
94 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 ...
0
votes
0answers
24 views

Ploting a GeoDataframe in Python

I'm trying to plot a geodataframe in python using Pycharm IDE but the result of the operation is a white vaccum plot. When i try to do the same operation with a colab notebook it works. Any ...
1
vote
1answer
38 views

Geoplot/GeoPandas missalignment in Windows (no Anaconda)

I am trying to familiarize myself with creating geographic plots in Python using geopandas and geoplot. So I am working my way through tutorials and documentation. Currently, I am looking at the user ...
0
votes
0answers
29 views

Shapely's unary_union very slow!

I am trying to execute unary_union on a GeoDataFrame to run Shapely's nearest_points() method. It is taking a very long time! The set is around 6,500 points. Is there a better way to find nearest ...
1
vote
0answers
68 views

How to find and remove invalid geometry in a multilinestring python geodataframe?

I have original data as a 700000's rows excel, with geometry data in hexwkb format. I want to plot it and make some spatial operations on it like intersect, distance and buffer, on a jupyter notebook. ...
1
vote
1answer
48 views

Shapely affine transformations with bounds of GeoDataFrame

I understand that I can use Shapely's affinity.translate to translate a geometry like the below: from shapely import affinity from shapely.geometry import Polygon poly = Polygon([(0, 0), (1, 0), (1, ...
0
votes
1answer
27 views

How to drop rows from a GeoPandas dataframe that are raising errors, in this case: TopologyException, Ring Self-intersection

I am trying to find the points from a geopandas frame that are inside the polygons from another geopandas frame. The code that I am using is the following: points[points.geometry.within(polygons....
0
votes
0answers
193 views

Geopandas geodataframe copy with where clause causes geometry issues

Question up front: What is likely happening here, where when I take copy of the dataframe with a where clause present that there is an apparent break in the geometry, as implied by the linestring ...
1
vote
0answers
41 views

geopanda plots / scale in km bar

how to set such scale in km on a map in geopandas as in the picture below. I am using geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres')) map. thanks
0
votes
1answer
41 views

Shapefile is saved in EPSG:4326 despite being set to EPSG:32651 via geopandas

This is the code def loadPoint(): df = pd.read_csv(r'C:\Users\imper\Documents\new_GISfiles\earthquakesPH\emscPhilippines2008to2020_lonLat.csv') geometry = [Point(xy) for xy in zip(df....
2
votes
1answer
30 views

Spatial join in GeoPandas: Line within multiple polygons

I'm having a GeoDataFrame of lines and a GeoDataFrame of polygons. The polygons have an attribute with the altitude of that polygon. For each line, I want to find in what polygon it is located. As ...
2
votes
1answer
57 views

How to display together a shapefile (country basemap) and points (from CSV) via geopandas?

So, I wrote this code that tries to do it but I end up with the map and points being displayed separately import pandas as pd import geopandas as gpd from geopandas import GeoDataFrame from shapely....
3
votes
0answers
43 views

How do I find where a line intersects itself?

I am using Python 3.7 with Shapely and GeoPandas. I have a big line of 181,000 points, and would like to find all the points where the line intersects itself. It does so a lot. I don't need a new ...
0
votes
1answer
57 views

Splitting polygons based on points density [closed]

I have a geojson file with polygons representing administrative regions. I also have a shapefile from which I can extract a list of points of interest (schools). I can iterate over this list of ...
4
votes
2answers
174 views

GeoPandas 0.6.1 installed instead of 0.7.0 in conda windows 10

I have problems using the .clip utility from the GeoPandas package. I found in this post that the problem might be due to the GeoPandas version, since this utility is only available in > 0.7 version. ...
0
votes
0answers
19 views

How to efficiently pass QgsMapLayer to geopandas.read_file()?

I want to do statistics using geopandas/pysal on existing layers - all geopackage loaded in QGIS. Now layer.source() >>>'/path/to/gpkg|layername=layer' uri = sel_bystr(layerStr).source()....
0
votes
0answers
92 views

shapely wkt.loads - skip bad geometries?

I'm trying to convert an excel file into a Geopandas dataframe. I'm trying to use shapely and wkt to do so. After reading the file into pandas, I have a geometry column. I'm trying to do the ...
1
vote
1answer
56 views

Typerror when using Geopandas.to_file

I am trying to save some Shapely Polygons to a .shp so that I can view and map them in QGIS. This data resides in my projects.hull column. I am running into a Typeerror which I am finding difficult to ...
1
vote
0answers
133 views

Geodataframe to PostGIS or shapefile

I have a GeoDatFrame df : df.geometry.name >>>'geometry' df.loc[:, 'geometry'] >>> Identifiant 0 MULTIPOLYGON (((2.827 42.691, 2.828 42.691, 2.... 1 MULTIPOLYGON (((2....
2
votes
1answer
286 views

Convex Hull in GeoPandas

I have a shapefile with a number of points. Using GeoPandas, I am trying to create a convex hull around the set of points. However, my output layer returns the same points as were fed in. My ...
3
votes
1answer
61 views

CSV containing GeoJSON format geometries to DataFrame

I have a CSV file I open as a DataFrame. Among the columns is one named geom 1 : df.loc[:, 'geom 1'] >>> 0 {'type': 'Polygon', 'coordinates': [[[2.826589... 1 {'type': 'Polygon', ...
1
vote
1answer
20 views

How to update attributes of a GeoDataFrame based on another database of the same geometry

How to update the attribute of a GeoDataFrame based on another database? I have a master GeoDataFrame with line features. I have another GeoDataFrame (say obs) which is a subset of the master ...
0
votes
0answers
93 views

Unable to install GeoPandas

Trying to install GeoPandas using Anaconda for Python 2 (geopandas version in anaconda navigator is 0.6.1). I also have ArcGIS 10.7 pre installed. First when I tried to install it through the ...
1
vote
1answer
110 views

How to append the .csv data into GeoJSON using Python

The .CSV file has 6 indents, we need to append all the indent with GeoJSON file and updated file ready for open in QGIS import json import copy import csv import sys #print(sys....
1
vote
1answer
55 views

Export Polygons as Polygons and not MultiPolygons in shapefile

I have a problem when trying to export my Polygons with geopandas in shapefiles as Polygons. When I import the file later on in QGIS, they are analised as MultiPolygons. I believe it is a tendency ...
1
vote
1answer
493 views

GeoPandas installation errors

(base) C:\WINDOWS\system32>conda install -c conda-forge geopandas Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with ...
0
votes
0answers
88 views

Fixing encoding error when exporting GeoPandas dataframe to Esri shapefile

When I try to export a list of geodataframe to esri shapefile like this: out_path = os.path.join(out_folder, filename) df.crs= "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs" df....
1
vote
1answer
39 views

Shrinking a bulky GeoJSON

I converted shapefile to GeoJSON, the shapefile is 10mb and the result of GeoJSON was around 30. In order to make this conversion, I used the following code: import geopandas as gpd SHP_FILE = './...
1
vote
1answer
69 views

How to obtain mean, maximum, and mininum of all points located within polygons using spatial joint in python?

I am trying to estimate summary statistics of points located inside a polygon. Each points in the point layer is associated with N attributes. My target is to summarize (say mean, min,..) the ...
2
votes
0answers
35 views

How to do nearest neighbor search more quickly?

I am currently using geopandas and scipy.spatial to do a nearest neighbor query. I have a data set of close to a million points and I need to find all of the closest points from another data set that ...
0
votes
1answer
45 views

How to extract long and lat of start and end points, to seperate columns, from the geometry column in GeoPandas?

I have a line shapefile in GeoPandas. How can I extract the start and end coordinates as (x,y) pairs in two separate columns? import geopandas as gpd gdf = gpd.read_file(pth_line_shapefile) gdf['...
0
votes
0answers
22 views

How to plot pies or histograms around points (GeoPandas) containing different level values indicators?

This is my code (a simple sample of df). I'd like to have around each point on a map, an histogram or pie showing the mechanical bikes out of the total. import pandas as pd pd.DataFrame( {'...

1
2
3 4 5
14