Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [geopandas]

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

0
votes
0answers
18 views

Classifying/extracting land cover types and getting percentages from raster image?

I have a rather large raster image and I want to classify land cover types in the image. Land cover types such as: developed land, Planted/cultivated, barren, forest, shrubland, and water. I am not ...
0
votes
0answers
15 views

How to add an additional layer in geopandas?

I've made a visualization of points on a map using geopandas. Now I want to create n rectangles with given heigth and width on the map. I tried using a solution presented in this topic - Create a ...
0
votes
0answers
20 views

Geopandas KeyError: “['__idx1' '__idx2'] not found in axis” during overlay operation

I'm trying to get the intersection area between two geodataframes using the overlay method. gpd_df1 = gpd.read_file("shapefile1.shp") ## US census tract shape file gpd_df1 = process(gpd_df1) ## ...
1
vote
0answers
64 views

Why is Union in ArcMap much faster than other approaches? [closed]

Taking the union* of these two large shapefiles file1 file2 locally using ArcMap takes appr. 10 min. Over the last few weeks, I've tried to obtain the same results using other, open-source ...
0
votes
1answer
17 views

Create Shapely linestring from string of coordinates in text format

I have a DataFrame where one column consists of lines stored like so: '[[-7.61, 42.15],[-6.62, 43.16],[-8.9, 41.0],[-9.2, 40.5]]' Is there an easy way to read these lines directly into shapely ...
2
votes
0answers
66 views

Overlay Union Geopandas improve performance

How to speed up the "union" of two shapefiles using geopandas? I have two large shapefiles: geodataframe_left.shape = (3610, 12) (500 MB) (link) geodataframe_right.shape = (16396, 3) (200 MB) (link)...
0
votes
0answers
32 views

How to delete little geometries without hole in python script

I'm writing a python standalone script from a old PyQGIS script. Input data is a raster of which I would like to delete little areas. In the PyQGIS script, I vectorized it and used GRASS v.clean to ...
1
vote
0answers
28 views

Basic Python plotting [closed]

Sorry if I sound like I don't understand, but I've been reading around trying to figure out how to do geospatial plotting in Python. I keep running into errors despite the examples I've seen appearing ...
1
vote
1answer
33 views

Compute Moran's I on more than one attribute

I am trying to compute global Moran's I to check for spatial autocorrelation among areas of a city. I am using python, in particular geopandas and pysal. My geodataframe looks like: District_name|...
0
votes
1answer
40 views

Compare same values and keep biggest number's value in another column? [closed]

Here is an example to explain what I mean: I want from this: index area key 0 1 50 1f 1 2 60 2 2 3 70 3d 3 5 80 4 4 1 90 5 5 2 100 6 6 ...
1
vote
0answers
22 views

How to identify unique attributes in a column and add them as separate columns and perform spatial join sum in python

I need to extract all unique values from the "CATEGORIES" column from shapefile 2 (from the Shapefile and its data frame is shown below) and add them as columns to the Shapefile-A data table (see ...
0
votes
1answer
33 views

Using GeoPandas, Shapely and Fiona to “select” state from shapefile, save it and display it? [closed]

I have the usual US census states shapefile for the 48 contiguous states. I am trying to select a state of interest from that shapefile then save that shapefile and display. I want to use GeoPandas, ...
1
vote
1answer
48 views

Reprojection of satellite images mosaic to CRS with latitude and longitudes

I downloaded MODIS product MOD13A1 for India. Then mosaiced the granules in GeoTIFF format using rasterio Python library. I have the appropriate shapefile to mask the mosaiced raster. After mosaicing ...
0
votes
0answers
26 views

Support for FileGDB (Esri file gdb API) driver in fiona returns exit code -1073741819 (0xC0000005)

I have installed Geopandas (and all dependencies) for 32 bit Python coming with ArcGIS 10.6 for Desktop (Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 20:19:30) [MSC v.1500 32 bit (Intel)] on win32) ...
3
votes
0answers
63 views

How to create the prj file with fiona and geopandas?

I am trying to create a shapefile and a geojson using geopandas and fiona. import fiona import fiona.crs ... geometry = [Point(xy) for xy in zip(df['longitude'],df['latitude'])] crs = {'init': '...
2
votes
0answers
44 views

How to get fast writing with Geopandas & Fiona?

I have a GeoDataFrame with 1,2M records, and want to write it into a GeoPackage file. Currently, it takes >20 minutes, and, as I calculated, average write speed is 100 recs/sec. As I read in the ...
2
votes
1answer
57 views

Extracting Longitude and Latitude from shapefile?

I am working with a shapefile which can be found here. I am doing some data visualisation and want to see if certain longitude and latitudes are within a certain polygon in the shapefile. This is the ...
1
vote
0answers
46 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
1answer
93 views

PostGIS Symmetrical Difference

Related question I have two tables in PostGIS, each with two features(rows) and a rectangular geometry (polygon). I would like to obtain the Symmetrical Difference from those two layers so that the ...
2
votes
1answer
51 views

Polygon to Point in GeoPandas?

I want to convert a shapefile from polygon to point: pfile = pathtofile file = gpd.read_file(pfile) #it is a polygon Searched this site but didn't find anything similar: http://geopandas.org/...
1
vote
0answers
36 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....
0
votes
1answer
20 views

Left join using merge in geopandas

Is there a way to do a "left join" when using the "merge" command on a geopandas df to merge by attribute? The problem I am running into is that I am joining a geopandas df with CA counites to a ...
0
votes
1answer
31 views

What is the unit of measurement of the distance between two points using geopandas distance function?

I have created three buffers using geopandas in python and I have a few points scattered here and there, some of them are inside the buffers.But the problem is the following: When I obtain distance ...
0
votes
0answers
16 views

Using Pysal in Shapefile?

I am having serious difficulties in generating a Weighted distance matrix using PYSAL. I GeoDataFrame has four columns (Index(['CD_GEOCMU', 'Datetime', 'HAV', 'geometry']) The columns HAV is the ...
0
votes
1answer
26 views

How do I obtain the distances of each point lying inside or outside buffers from the center of buffers?

My aim is to obtain the shortest distance between all the points overlain on a polygon and the center of buffers also overlain on the same polygon. I have done the following to illustrate this: ...
1
vote
1answer
39 views

Adding buffers around each city of user defined region using geopandas?

How do I obtain a buffer around each city on the overlay map of cities on the United States area? I have used the following piece of code to work this out but this does not work out it seems. I am ...
1
vote
0answers
20 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?
0
votes
1answer
46 views

Geopandas - Import CSV: make polygons from X,Y Coordinates based on ID

I'm working on a script, where I want to import a CSV file with coordinates and an ID which should be used to make a polygon shapefile from those. CSV file looks like this (example): ID, X, Y 10,15....
2
votes
0answers
37 views

Memory errors when doing Zonal Statistics on a multi polygon shapefile in Python

I want to calculate the mean NDVI with the EthNdvi.tif file for each zone (there are around 650 admin zones) in the the woreda shapefile. I'm having some issues with running the following lines of ...
0
votes
0answers
19 views

How to indicate colors in geopandas.plot_polygon_collection

I need to plot a map based in ranges of a value as you can see below: indic = gpd.read_postgis( '''select case when data >= 0.0 and data <= 0.2 then 1 ...
0
votes
1answer
56 views

How to convert GeoSeries polygons to lists of coordinates?

I have a GeoDataFrame consisting polygons. How can I convert each polygon into a list of coordinates? Is there any attribute, method or function in GeoPandas to do this?
0
votes
0answers
13 views

selection from point shapefile for each feature of polygon file by python geopandas/gdal

I want to create separate selected point file for each feature in polygon shapefile. import geopandas as gpd from matplotlib import plot poly=gpd.read_file('Test_circle.shp') points=gpd.read_file('...
0
votes
1answer
26 views

Getting bounding box from Point type GeoDataFrame to getting data from Osmnx

I've a point geodataframe which has only point features inside of it. fishnet_Id ... geometry 0 0 ... POINT (403486 4540640) 1 ...
0
votes
0answers
34 views

GeoPandas - df.set_geometry() results in type error

I am trying to take query results from a PostGIS database and load into a SpatialDataFrame to display on a map via Jupyter Notebook and the ArcGIS Python API. The results from the database table seem ...
2
votes
1answer
103 views

Reading data to geopandas using WFS?

I'm new to GIS. Trying to use Finnish population data on 1km tiles available here: http://www.stat.fi/org/avoindata/paikkatietoaineistot_en.html The WFS service is here: http://geo.stat.fi/geoserver/...
1
vote
1answer
29 views

Superposing two plots with Geopandas, with non fill colours in one of them

I would like to plot a map of the edges of the French departments, and the heat maps at the lower scale of the French IRIS. I read both shapefiles using GeoPandas. And now dep.plot(color="white", ...
0
votes
0answers
22 views

pyproj - I get an error when running to_crs

I think there is something wrong with the current install of pyproj in the conda forge geopandas install. Does anyone know a way around this or how I can fix it? Example: data_utm = data.to_crs(epsg=...
0
votes
0answers
49 views

How to query all points within 2000 meters through spatial index in python?

As you can see, I have some data and the projection epsg:4326. For example geometry id 0 POINT (120.681175 27.989723) 1 1 POINT (120.70615 27.97382) 2 2 POINT (120....
0
votes
1answer
61 views

gdal/geopandas data object compatibility in python

Is it possible to convert an ogr datasource into a geopandas GeoDataFrame without writing the datasource first as a physical file and reading it back? I am referring to something like import ogr, ...
0
votes
0answers
36 views

How to convert from EUREF-FIN to WGS84 in geopandas

Trying to convert ETRS-TM35FIN coordinates in the EUREF-FIN projection to WGS84 in geopandas with this: x = 429300 y = 7084490 df = pd.DataFrame([[x,y]],columns=['x','y']) df['Coordinates'] = list(...
0
votes
1answer
28 views

ValueError: Invalid field type <class 'bytes'>?

The ValueError: Invalid field type is caused at the last line of this code: fs.to_file(out,encoding='iso8859_7') Full code: q=gpd.read_file(fname + "\ASTENOT\simplify_centerline.shp",encoding='utf-...
2
votes
1answer
220 views

How do I write a GeoPandas dataframe into a single file (preferably JSON or GeoPackage)?

I'm new to GIS and having a basic beginner problem. I've got data in the form of a geopackage .gpkg from GADM.org. I can read in and use the data without problem using Geopandas (via built-in Fiona)....
0
votes
1answer
84 views

Perform sjoin in geopandas leads to:'AttributeError: 'GeoSeries' object has no attribute 'columns''

I try to find all the polygons in a dataframe thant intersect an other dataframe (made by buffering my polygons) usign sjoin. First I did the buffers gdf['geom_buf'] = gdf.geom.buffer(100) Then I ...
0
votes
1answer
36 views

Generating a raster layer with intersecting line lengths as cell values

I have a polyline vector layer and a template raster dataset. For this polyline vector layer I would like to generate a new raster dataset based on the template raster dataset, but in which each cell ...
2
votes
1answer
55 views

Determining direction of traffic in road network?

I'm working with road segments as LineStrings in GeoPandas, for each segment I would like to determine the direction of travel (they drive on the right). This information is not encoded, how can I ...
0
votes
0answers
15 views

Merging datasets from different timeframes in geopandas

I have two datasets on neighborhoods in municipalities rom two different years. Due to administrative restructuring some data cannot be matched on the given id. When I plot the unmatched data there is ...
0
votes
1answer
58 views

Import PostGis tables into a GeoDataframe unexpected : 'AttributeError: 'NoneType' object has no attribute 'encode''

When I try to import two of my tables from postgis to geopandas I have an error. I guess the problem is due to my geometry columun, but I don't know why. engine = create_engine('postgresql+psycopg2://...
1
vote
1answer
42 views

Joining attributes after selecting one polygon which intersects another using geopandas?

To select the polygons which overlap other layer's polygons, I came up with this code based on what I found on this site: import geopandas as gpd import fiona import os import sys # Get the current ...
2
votes
1answer
52 views

British National Grid and WGS84 conversion doesn't match in reverse in GeoPandas/PyProj

When I try to convert Google Map's lat/long into EPSG:27700 and then add a 50-meter buffer, I'm getting unexpected results. I noticed that conversions in pyproj between WGS84 and BNG are not ...
3
votes
0answers
59 views

Wrong reprojecting of a shapefile with to_crs in GeoPandas

When reprojecting an ESRI Shapefile (EPSG:21781) into an EPSG:4326 with QGIS and then importing the resulting file in GeoPandas and plotting it, the coordinates are correct. When importing the same ...