Questions tagged [geopandas]

an open source project to make working with geospatial data in Python easier.

Filter by
Sorted by
Tagged with
0
votes
0answers
100 views

Issue with GeoPandas method 'contains' for two GeoDataFrames

I want to verify that a GeoDataFrame called mask2 COMPLETELY CONTAINS all the linestrings in another GeoDataFrame called transect_file2. In the image is clearly visible that transect number 16 (TR_ID=...
0
votes
1answer
179 views

GeoPandas Overlay Symmetric Difference: How to get the upper polygon

I have the following code which get the difference of a pie wedges. c= gp.overlay(a,b,how='symmetric_difference') How to get the upper polygon?
0
votes
0answers
117 views

Creating a grid of modifiable hexagonal tiles as overlay in geopandas

I have geo-tagged car sharing dataset which I am analyzing using geopandas. For analysis purposes I would like to create my own polygon overlay of hexagonal tiles. I have managed to find a ...
1
vote
0answers
88 views

Most effective way to find spatial relationships in python

I am trying to find the spatial relationship between two polygon geoDFs as follows: Find geoDF1.geom within geoDF2.geom else (not within) Find geoDF1.geom with largest intersection fromgeoDF2.geom ...
2
votes
1answer
508 views

Python - Convert shapefile lat-long value from Degree minutes seconds to Degree decimal

I am processing shapefiles in python using standard library functions like Python “shapefile” library and GeoPandas. I have two shapefiles having the same projected co-ordinate system-> ...
0
votes
1answer
211 views

Getting geohash of LINESTRING in PostGIS?

I have some LINESTRING in PostGIS. LINESTRING(104.011 30.637,104.014 30.638,104.022 30.640,104.026 30.645) LINESTRING(104.022 30.666,104.031 30.659) LINESTRING(104.044 30.655,104.056 30.655) I ...
1
vote
1answer
323 views

Exception raised when saving Geopandas DataFrame into a file

I am trying to apply the method to_file of a Geopandas DataFrame. My DataFrame contains a column Polygon, a column Point, a string and float columns. Here the output of the describe method: <...
1
vote
1answer
48 views

Check if point in GIS polygon fails to produce correct output

I've tried many, many many, ways to find out if a point is in a GIS polygon based on many great posts, but I can't get any to work properly. Specifically I created a grid of points covering the ...
0
votes
1answer
306 views

Search plugin of Folium doesn't appear [closed]

I'm trying to reproduce the following jupyter notebook : https://nbviewer.jupyter.org/github/jtbaker/folium/blob/geojsonmarker/examples/plugin-Search.ipynb But once I'm trying to create the map I ...
2
votes
1answer
287 views

How can I avoid changes to field types in geopandas?

I am using geopandas in the following routine to create the union of 2 (polygon) shapefiles: import geopandas as gpd def union(fn_A, fn_B, output): shpA =gpd.read_file(fn_A) shpB =gpd....
0
votes
0answers
168 views

Geopandas to_file() gives an error regarding fiona.drivers(). Is it possible to work around this?

I'm using geopandas to get WKT and coordinates from a database: df = pandas.read_sql(con=conn2, sql=test_query) df['Coordinates'] = df['WKT'].apply(lambda x: wkt.loads(x.read())) gdf = geopandas....
0
votes
0answers
32 views

NHGIS census files get lat/lon from polygon

I've never worked with shapefiles before and I'm having a lot of trouble with something that I think should be pretty simple. So I have the census tract files from NHGIS for 1980 and the structure ...
3
votes
1answer
68 views

GeoPandas equivalent of ST_MakePolygon

What is the GeoPandas equivalent of ST_MakePolygon? I want to convert a MULTIPOLYGON to one single polygon. Currently, using GeoPandas.boundary a MultiLineString is returned. How can this one be ...
3
votes
5answers
1k views

Interchange y, x to x, y with geopandas (python) or QGIS

I realized that the order of my geopandas dataframe is wrong, it has y, x instead of x, y. This makes it difficult to use with other modules that needs exactly x, y type of coordinates. Is there any ...
0
votes
2answers
3k 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:\\...
1
vote
0answers
234 views

Write feature collection to S3

Is there a way to write a feature collection from Python memory to an S3 bucket (as Esri Shapefile, zipped Shapefile or something else) without writing it first to disk? I tried writing to a ...
3
votes
1answer
428 views

Creating chloropleth maps in geopands with 'user_defined' bins

As suggested in the geopandas mapping tools documentation, I want to create a chloropleth map using a custom defined bin sizes: world.plot(column='gdp_per_cap', cmap='OrRd', scheme='user_defined') ...
1
vote
1answer
2k views

python mask netcdf data using shapefile (xarray & geopandas)

I am using the following packages: import pandas as pd import numpy as np import xarray as xr import geopandas as gpd I have the following objects storing data: print(precip_da) Out[]: <...
0
votes
1answer
3k views

How to fix 'GeoSeries' object has no attribute '_geom'

I'm working on a python script whose goal is to detect if a point is out of a row of points (gps statement from an agricultural machine). To do this, my idea is to make a buffer around the 10 points ...
3
votes
0answers
405 views

Multiprocessing with geopandas

I am learning how to implement the multiprocessing with spatial data using the module multiprocessing. I am trying to implement a spatial intersection between a polygon file and a grid file. I am ...
0
votes
1answer
436 views

How to create a GeoDataFrame points grid from a numpy.mgrid?

I'm trying to create a GeoDataFrame points grid from a numpy.mgrid. I already have created the numpy.mgrid with coordinates of future points. >>>arr = np.mgrid[-1827342.1753285176:-1827523....
3
votes
1answer
2k views

Open GPKG embedded layers in python

I have a gpkg with multiple tables, and I am trying to load it with geopandas: import geopandas as gpd filename = '~/example.gpkg' gdf = gpd.read_file(filename)' This returns the first table/layer ...
3
votes
1answer
2k views

Calculating distances with lat/long in decimals and WGS 84

I need to calculate the distance between points of two different datasets, once with locations of towns, the other with locations of dams. Both are located in different countries in Africa. The more ...
4
votes
2answers
2k views

Using GeoPandas to create a graph

I have a shapefile with some polygons and I'd like to create a graph that assigns vertices to polygons and creates edges between vertices if the corresponding polygons share a border. Since I'm using ...
2
votes
1answer
734 views

Getting error while importing GeoPandas in Python console

I have installed GeoPandas and its dependencies using pip install package_name. Here is the pip list output: Package Version attrs 18.2.0 Click 7.0 click-plugins 1....
1
vote
2answers
2k views

geopandas can't import

I've installed geopandas on ubuntu 17.10 and can't import geopandas. I can't find this particular error anywhere. from pyproj import _proj ImportError: cannot import name '_proj' I'm using a virtual ...
0
votes
0answers
29 views

Map Town names to its corresponding NUTS code

Is there a way to map the Town to its corresponding NUTS code? I have a file which has IP address and Town too, but I was not able to get the NUTS code from the latitude and longitude information ...
0
votes
0answers
86 views

Splitting aerial photography into images with GPS coordinates

Splitting aerial photography into images with GPS coordinates Given this folder structure of (four) Oblique and (one) Vertical aerial photography of 10 cm resolution: dir/Orientations/footprints.cpg ...
0
votes
1answer
190 views

Geopandas tick labels from a diferent coordinate system

I have a GeoDataFrame that includes points with the relevant geometries (coordinates system WGS84 EPSG:4326) gdf: Name x y Coordinates E -4.375 51.5 POINT (-4.375000000000008 51....
0
votes
0answers
332 views

GeoPandas ParseException: Invalid HEX char error

I am trying to read a geospatial table from a PostGIS database on PostgreSQL. Using the funcion sql = '''SELECT ST_AsText(geom) AS geom FROM my_table;''' df = gpd.GeoDataFrame.from_postgis(sql, ...
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 ...
0
votes
1answer
1k 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
363 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
1answer
163 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 ...
1
vote
0answers
136 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 ...
2
votes
0answers
652 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)...
1
vote
0answers
160 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
0answers
88 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 ...
0
votes
1answer
562 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 ...
1
vote
1answer
2k views

Tim C's cloesed question - Spatialindex is missing for Geopandas. reopend by rk: geopandas is GIS for python [closed]

I can't understand why that one was closed as off-topic by Kersten, BERA, whyzar, aldo_tapia, ArMoraer Dec 5 '17 at 15:56 due to "Questions relating to general IT or with no clear GIS component, ..." ...
2
votes
1answer
380 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|...
1
vote
0answers
294 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
45 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 ...
0
votes
1answer
270 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, ...
3
votes
1answer
799 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/...
3
votes
1answer
3k 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 ...
2
votes
0answers
334 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 ...
1
vote
0answers
389 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
198 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 ...
0
votes
1answer
97 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: ...