Questions tagged [geopandas]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
21 views

Finding distance of consecutive points in a GeoPandas data frame

I am trying to find the distance between every consecutive points in a GeoPandas dataframe. Let's say we have the following data frame: import pandas as pd import geopandas data=pd.DataFrame() data['...
3
votes
1answer
563 views

Writing GeoPandas data frame to PostGIS?

Similar question has to this has been asked before Adding GeoPandas Dataframe to PostGIS table? I have followed the example but I am running into an issue I cannot solve. There is some geometry ...
3
votes
1answer
45 views

Summing four rasters to one suitability raster using Rasterio & GeoPandas in Python

I am trying to create a basic suitability raster from three vector sources and one raster source using Rasterio & GeoPandas in Python. I have already clipped and rasterized the vector sources to ...
1
vote
0answers
26 views

Folium choropleth plots markers [closed]

I have this code to plot a choropleth from a GeoPandas DataFrame. def create_gpd_dataframe(self d = {'Angle of point': yard_list, 'Latitude': yard_lat_list, 'Longitude': yard_lon_list} ...
1
vote
1answer
33 views

Create LineString from lat/lon coords form CSV. with beginning and ending lat/lon?

I am iterating through a CSV file of tornadoes, and for each row getting the beginning lat, beginning long, ending lat, and ending long. and trying to plot their line geometry on a map. I got the ...
0
votes
1answer
33 views

Extract/export Attribute Table of pixel information from Classified Raster in Python?

I am at beginner level in image processing with python. I have classified satellite image with python in 10 classes. I am able to write the image in geotiff format. However, I do not know how extract ...
2
votes
2answers
89 views

How to import GeoPandas in QGIS 3.10

Here is the situation: I've installed QGIS 3.10 with the downloadable .exe file and accepting all as predefined. The Python version used with it is 3.7.0 like here: import sys sys.version '3.7.0 (v3....
0
votes
1answer
2k views

Importing Geopandas gives OSError: Could not find libspatialindex_c library file

I would like to begin with geopandas but I have an issue when I import it. Terminal return me this message : >>>import geopandas Traceback (most recent call last): File "<stdin>", ...
0
votes
0answers
41 views

Python, Folium choropleth, plot by value

I have a GeoPandas dataframe: self.geopd = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df.Longitude, df.Latitude)) Angle of point Latitude Longitude geometry 0 ...
0
votes
1answer
28 views

Adjacency Matrix from linestring using GeoPandas

I got my adjacency matrix wrong way round. I got the intersection of edges. I need to have information per node instead. as per https://math.stackexchange.com/questions/1890620/finding-path-lengths-by-...
2
votes
1answer
248 views

Geopandas and significant digits of coords

I trying to put coords of a points GDF in 2 columns. But i'm a little bit surprised by result. In geometry all points have 6 significant digits but in columns only 5 (rounded)... My code to put ...
3
votes
4answers
2k views

Fiona throws no dataset found when attempting to read a KMZ file

I downloaded a NOAA-provided KMZ file (link). When I point geopandas at the file: gpd.read_file("/Users/abilogur/Downloads/NSIDC_SepSeaIceExtent.kmz", driver="KMZ") I get: FionaValueError: No ...
-7
votes
0answers
28 views

How to find Nearest Neighbour points for a route (Line or poliline)? [closed]

'''No code yet, I will edit and add here later: Python3 with Folium and GeoPandas'''
1
vote
0answers
46 views

GeoJSON as string to GeoPandas geometry Python

I have this (subset) Pandas dataframe: I read it from an XLSX file. I would like to convert it to geopandas GeoDataFrame. In order to do so, I need a valid geometry column. The GeoJSON column in my ...
1
vote
1answer
42 views

Python, GeoPandas, how to extract to a list by range of a column

I have GeoPandas dataframe: d = {'Angle of point': plot_angles_list, 'Latitude': lat_list, 'Longitude': lon_list} df = pd.DataFrame(d) gdf = gpd.GeoDataFrame( df, geometry=gpd....
3
votes
1answer
46 views

GeoPandas to PostGIS database

New to using GeoPandas instead of Pandas. I am trying to export a GeoPandas dataframe to a PostgreSQL database (with PostGIS extension). The import is from the same database as I try to export to ...
2
votes
1answer
96 views

Accelerating GeoPandas for selecting points inside polygon

I have one dataset with about 10 million points (lat, long). I would like to select the points that fall within a map. I have this map as a shapely object (.shp). To do this, I transformed the ...
1
vote
2answers
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[]: <...
20
votes
5answers
18k views

GeoPandas: Find nearest point in other dataframe

I've got 2 geodataframes: import geopandas as gpd from shapely.geometry import Point gpd1 = gpd.GeoDataFrame([['John',1,Point(1,1)],['Smith',1,Point(2,2)],['Soap',1,Point(0,2)]],columns=['Name','ID','...
0
votes
1answer
220 views

Equivalent method for .withcolumn() for geodataframe

I am trying to use a user-defined function in pyspark in order to check whether the points in CANmep_GDF lie within the polygons in gda_GDF. from geopandas import GeoDataFrame def check_exist(geom):...
-1
votes
1answer
74 views

geopandas overlapping check

How we can check if feature has intersections or not with other features in one shapefile data? I want to make sure if in that file there is no overlaps between polygon, I have read this approach "...
0
votes
1answer
339 views

Spatial overlays : Union between multiline and multipolygon with geopandas

I try to overlays (apply union) my multipolygon on the multiline with GeoPandas, but it seem like the GeoPandas overlay function work only with (Multi)polygon. Is there any way to make that with ...
2
votes
2answers
71 views

Building GeoDataFrame row by row

I am trying to build GeoDataFrame row by row, from an empty one. The equivalent using only pandas would be something like this : df = pandas.DataFrame(columns=['a','b','c','d']) df.loc['y'] = ...
1
vote
2answers
88 views

CRS error working with Solaris [closed]

result_polys = sol.vector.polygon.georegister_px_df(mask2poly, affine_obj=tile_tfm, crs= 'epsg:4326') ...
3
votes
2answers
4k views

List all polygon vertices coordinates using geopandas

I'm trying to list all polygon vertices 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 ...
1
vote
2answers
54 views

Reading raster values in points gives back a generator object instead of actual value

Given a raster TIF file and a point feature class in a geodatabase, I am trying to extract the values of the raster on the points and add them as a new column on the point feature class. I am using ...
1
vote
2answers
37 views

Loading GeoDataFrame to PostGIS when GEOM column contains MULTILINESTRING and LINESTRING

How can I load GeoDataFrame (populated from shapefile) to PostGIS when GEOM column contains MULTILINESTRING and LINESTRING e.g.: LINESTRING (14.2384666 46.6304714, 14.2386703 46.6304123) ...
42
votes
2answers
41k views

Convert a pandas DataFrame to a GeoDataFrame

This seems like a simple enough question, but I can't figure out how to convert a pandas DataFrame to a GeoDataFrame for a spatial join. Here is an example of what my data looks like using df.head(): ...
0
votes
1answer
527 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://...
0
votes
1answer
710 views

Python geopandas dataframe of polygons — determine nearest neighbor polygon?

I am trying to figure out how to dynamically create expanded regions of interest based on polygon geometries in geopandas until some threshold is satisfied (essentially custom regions across the ...
8
votes
4answers
11k views

Handling KML/CSV with geopandas - DriverError: unsupported driver: u'CSV'

I'm trying to import a dataset of UK postcode districts UK postcode districts from Google Fusion tables into geopandas with the aim of splicing it to a dataset of house prices. The problem is that ...
4
votes
3answers
7k views

How to use GeoSeries.distance to get the right answer

When I want the distance between two points [(117.454361,38.8459879),(117.459880 ,38.846255)] (longitude,latitude) on the earth, I take the GeoSeries.distance method, but the method does not give me ...
0
votes
1answer
41 views

Loading Geodataframe to PostgreSQL with psycopg2 connection

I have created a Geodataframe from a PostgreSQL table with the following instruction (where 'con' is a psycopg2 connection): gdf = gpd.GeoDataFrame.from_postgis("SELECT id, geom FROM {0}".format('...
2
votes
2answers
73 views

Accelerating the code for random selection of polygons

I have a shapefile with thousands of features (polygons). I need to randomly sample one polygon at every 1 sq. km. area if at least one polygon is available. I wrote the following code which works. ...
0
votes
1answer
280 views

AttributeError: 'Series' object has no attribute 'has_z'

I got the following GeoDataFrame taken from a CSV file and after some slincing and CRS and geometry asignment ctf_nom geometry id 0 Prunus ...
4
votes
2answers
8k views

Creating polygon grid using Geopandas [closed]

I'm working with a geodataframe of points and I need to create a grid of rectangular polygons. I know how to have bounds of the geodataframe with gdf.geometry.bounds. Now using this information and ...
6
votes
3answers
7k views

GDAL ImportError: DLL load failed: The specified module could not be found

I'm running Python 3.5.4 on Anaconda and i'm trying to install geopandas. I've followed the instructions to install geopandas here - http://geoffboeing.com/2014/09/using-geopandas-windows/ - but ...
4
votes
1answer
58 views

GeoPandas Intersect function gives different result to Shapely

Using this example dataset of country geometries, I seem to get a different result on whether or not the USA and Mexico intersect when I do the calculation with GeoPandas as opposed to directly with ...
1
vote
1answer
32 views

Creating custom proj4 string from components

I'm trying to work with NOAA's NDFD weather data, which are released as rasters in GRIB format. Specifically, I'm currently trying to get the pixels that intersect an arbitrary geometry. Information ...
0
votes
1answer
116 views

using histogram2d with categorical dimension

This is a scatterplot of business addresses in Melbourne by ANZSIC division names. sns.pairplot(x_vars=["x coordinate"] , y_vars=["y coordinate"] , data=d , hue=...
1
vote
2answers
308 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 ...
1
vote
0answers
45 views

Link point to nearest line using GeoPandas [closed]

I use GeoPandas to link a point feature to the nearest line feature with the code below. I thought I might share it for anyone to comment on it or offer a better solution. Pay attention to the comment ...
1
vote
1answer
40 views

Load table with GEOMETRY column to Pandas DataFrame

I am trying to load table (from Postgres DB) with GEOMETRY column to Pandas DataFrame using pd.read_sql_table method. I am getting error becuase GEOMETRY type seem to be not supported: C:\Anaconda3\...
2
votes
1answer
65 views

Matching X and Y axis coordinates of two GeoPandas geometries to overlay them

I have two GeoPandas GeoDataFrame objects with their corresponding geometry columns. GeoDataFrame 1: counties --> has polygons and multipolygons of Dominican Republic counties. The source data was ...
1
vote
1answer
69 views

Line and polygon intersection in GeoPandas/Python

I am trying to intersect two GeoPandas data frames, the first one is the street data (streets) and the second one is a buffer (polygon) around a point (buffer). I want to find the intersection of ...
2
votes
1answer
2k views

Geopandas Intersects Speed

I have recently started using Geopandas and am having a problem with the performance of intersects. The intersect tests whether land parcels have a road within (or across the boundary). Parcel data (...
1
vote
1answer
33 views

Failing Unions due to Non-Noded Intersections

I'm trying to perform lots of unions in GeoPandas. I've got around fifty sets of between 7-12 GeoDataFrames of the same place at different times that I'm trying to union into one layer per set. Right ...
4
votes
1answer
580 views

Rasterizing polygon grid in Python (geopandas & rasterio)

I am trying to rasterize a custom polygon grid with one or more columns. Preferably I'd like to create multi-band rasters from multiple GeoDataFrame columns (in polygon grid), but I have got stuck ...
0
votes
0answers
20 views

GeoPandas drops .prj file

I'm trying to create a df through a GeoJSON url, merge it with a df created out of a SQL query, and create a shapefile/GeoJSON from the output. The output has everything put the .prj file (in the ...
0
votes
2answers
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?