Questions tagged [geopandas]

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

Filter by
Sorted by
Tagged with
1
vote
2answers
309 views

How to pull values from one geodataframe to populate corresponding column/rows in another geodataframe

I have 2 geodataframes; one made from polygons (bldg_res_df) and one from centroid points (parcel_res_df). I used .concat to combine them into a single geodataframe to do some calculations. df_list = ...
0
votes
1answer
234 views

How to create a shapefile [polygon type] from a Geodataframe, returned from a Oracle Spatial cursor with geometry column type=cx_Oracle.LOB?

I'm trying to create a shapefile [2D polygon type] with a Geodataframe, that result from a SQL made to a Oracle Spatial database. The SQL and the Geodataframe creation runs without errors, but when I ...
0
votes
1answer
155 views

Reprojecting data with GeoPandas using 'to_crs'?

I am trying to reproject a polygon so that it has the same projection than a raster dataset. raster.crs CRS({'proj': 'tmerc', 'lat_0': 0, 'lon_0': -183, 'k': 0.9996, 'x_0': 500000, 'y_0': 0, 'datum': ...
0
votes
0answers
29 views

Speed- and COG-aware trajectory interpolation/resampling using Python

I have a set of ship trajectory points that were irregularly sampled and I would like to resample them to a fixed frequency (e.g. every minute). Rather than just linearly interpolating between ...
1
vote
1answer
165 views

Calculating the Area by Square Feet with Geopandas

I have a geodataframe that has no assigned crs. I want to create a column/field called 'area' that has the area calculated as square feet, not meters or km, using geopandas. Note: this geodataframe ...
1
vote
1answer
1k views

AttributeError: 'NoneType' object has no attribute 'bounds'

I have the following geodataframes, corresponding to a regular grid: id grid_id geometry 0 48 0 (POLYGON ((2.052457758079306 41.42493869117656... 1 49 1 ...
1
vote
1answer
101 views

Method 'to_crs' to reproject with GeoPandas is missing

I am trying to reproject data using GeoPandas' to_crs method but it seems to be missing. When I type hasattr(gpd, 'to_crs') I get FALSE. Also, when I type dir(geopandas) in the command prompt it doesn'...
1
vote
2answers
95 views

How to calculate number of vertices in GeoPandas

Is there any method to count number of vertices of polygon (or multipolygon etc.) that is in 'geometry' column in datatable, but using GeoPandas? Example: Let's say I have polygon POLYGON ((552971....
2
votes
2answers
128 views

How to load the geometry field of a feature class to PostgreSQL?

I am trying to load a polygon feature class in a file geodatabse to a PostgreSQL table (extension PostGIS installed). This the process I'm following: I create table in PostgreSQL with required fields ...
2
votes
1answer
54 views

Unable to load geometry field from geodataframe to a PostgreSQL table 'geometry' field

I am trying to load a geodataframe to a PostgreSQL table, but I am struggling with the geometry field. First I read feature class using Geopandas: geodata = (r'path_to_gdb', driver='FileGDB', layer='...
3
votes
1answer
221 views

Setting CRS : TypeError: 'NoneType' object is not callable [closed]

I'm working with a naive geometry column imported from a csv file, like this: name geometry id 1 Abubilla (POLYGON ((424405.897979997 ...
2
votes
2answers
492 views

How to get a Multipolygon object from Overpass QL?

I'm new to OSM/Overpass QL and there's a simple problem that I can't solve. I've been able to figure out the a query that will return the maritime boundary of a country. For example: (rel[boundary="...
1
vote
1answer
181 views

Geopandas read_file only reading first part of KML

I am trying to read the following file with GeoPandas: import geopandas as gp gp.io.file.fiona.drvsupport.supported_drivers['KML'] = 'rw' df = gp.read_file('http://watchthemed.net/index.php/json/...
4
votes
2answers
7k views

Create a polygon grid using with Geopandas

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 ...
1
vote
1answer
87 views

Why is there a difference in length for two lines created from the same points, one with ArcGIS Pro and the other with Geopandas? [closed]

Update Question off-topic because I launched the ArcGIS treatment again and for an unknown reason this time I obtained the 21.56km length I was expecting. It means the error comes from either my ...
4
votes
1answer
401 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 ...
2
votes
1answer
82 views

Why does spatial join on geodataframes return empty result?

I have two geodataframes that I want to perform a spatial join on; one is points, one is polygons. They are both dtype: int64. They both have .crs = {'init': 'epsg:4326'}. I have verified both of them ...
2
votes
2answers
4k views

How to convert a GeoSerie to a GeoDataFrame with Geopandas

I'm new in Geopandas and I try to creat my first script. I succeeded to open a shapefile and maked a union of all entity and an envelope. As it said in Geopandas doc, after these 2 geometric ...
8
votes
1answer
10k views

Turning GeoDataFrame of x,y coordinates into Linestrings using GROUPBY?

I have a dataframe of X,Y coordinates that represent points along the paths taken by several different entities. Pseudo-data here, but it is roughly of the form: entity_id lat lon time 1001 ...
0
votes
0answers
155 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 ...
2
votes
2answers
271 views

Plotting lon/lat point (without manual conversion) on XY map using GeoPandas?

I am data scientist not experienced in GIS and need to do some simple map plotting of the Netherlands. Using Geopandas everything works out nice and dandy for my purposes however I am stuck on 1 ...
2
votes
1answer
284 views

TypeError: Input geometry column must contain valid geometry objects

I'm working in a urban biodiversity project and I have a csv file for a birds inventory with a column index called 'geom' composed by multypolygons as this: name geom ...
1
vote
1answer
35 views

Why does geodataframe never complete?

I had a feature class made up of 1,700,000 polygons. I used Geopandas to create a geodataframe: state = "MD" state_gdb = r"C:\Projects\Pop_Alloc\{}_Data.gdb".format(state) join_feat = "{}...
1
vote
2answers
189 views

Something going wrong trying to transform longitude, latitude to NAD 83 using pyproj

I'd like to convert a latitude longitude pair to NAD 83. I've read NAD 83 is equivalent to epsg:4269 and the shapefile I am working with is a US Census TIGER shapefile, all of which are supposed to ...
1
vote
1answer
1k 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
2answers
35 views

How to create a sub dataframe from a dataframe using specific columns

I have a dataframe that has more fields/columns than I want, so I am trying to create a sub dataframe that only has certain fields/columns. The following throws a TypeError: '(['uniqueid'], ['...
2
votes
1answer
175 views

How aggregate data in a geodataframe by the geometry in a geoseries

I have a geoseries where each row is a (square) polygon. Housing price data is in a geodataframe where the geometry is a polygon of the zip code. I need to aggregate the housing price data by squares ...
0
votes
1answer
129 views

Testing intersection between shapely object and geopandas GeoSeries?

This is a Python question, involving geopandas and the libraries it calls, primarily pandas and shapely. tl;dr: I am trying to run a test using if foo.intersects(bar): and am repeatedly getting one ...
0
votes
1answer
95 views

GeoPandas intersect not working as expected

Using GeoPandas 0.4.0 with Python 3.5, I'm finding that geopandas.intersects does not behave as I expect it to. For example, a buffer around Switzerland does not appear to intersect with neighbouring ...
0
votes
0answers
82 views

Improving speed of GeoPandas dissolve?

I am trying to dissolve grid spaces by category using GeoPandas' dissolve function, but it doesn't finish after hours of running and I want to make sure I'm not doing something wrong and/or there isn'...
3
votes
1answer
15k views

Create a polygon from coordinates in GeoPandas with Python

I was trying to create a simple Polygon from a list of coordinates and export it to multiple formats (including shapefile and GeoJSON) and wanted to automate it using Python. There were some good ...
1
vote
1answer
188 views

Error: Input [<shapely.geometry.point.Point>, <shapely.geometry.point.Point>] is the wrong shape for a LineString

I'm trying to create a linestring out of a dataframe of latitudes and longitudes. geometry = [Point(xy) for xy in zip(linkdf.lon, linkdf.lat)] linkgdf = GeoDataFrame(linkdf, geometry=geometry) ...
0
votes
0answers
284 views

Can't open shapefile with GeoPandas

I downloaded a shapefile from the Brazilian Institute of Geography and Statistics (IBGE). I can open it on QGIS and work with it perfectly there, but I need to work with it using Python. I'm trying ...
13
votes
2answers
6k views

Adding GeoPandas Dataframe to PostGIS table?

I have a simple GeoPandas Dataframe: I would like to upload this GeoDataframe to a PostGIS table. I have a Database setup with the PostGIS extension already but can't seem to add this Dataframe as a ...
2
votes
1answer
238 views

How to merge geoseries to geodataframe based on geometry attribute

I have 5868 points in a geodataframe with some columns/attributes. Between points which have distance less than 10 m, I just want to select only one point as representation in that area. I have done ...
1
vote
0answers
345 views

Geopandas simplify results in gaps between polygons

The goal is to simplify the geometries of a shapefile containing multipolygons. However, when I use Shapely's simplify in geopandas, the result contains gaps between the polygons. I was hoping that ...
3
votes
1answer
326 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 ...
0
votes
0answers
66 views

Loading spatialite tables into GeoPandas GeoDataFrame

Using information from here, I am trying to load a result of a SQL Python selection into a Geopandas geodataframe. I know pyspatialite is not longer maintained, so have tried using the dbapi2 module ...
4
votes
2answers
183 views

Geopandas and QGIS Calulating Different Polygon Area Values?

I am just trying to understand why Geopandas and QGIS might calculate areas differently despite using exactly the same shapefiles and exactly the same projections. Both shapefiles are using EPSG:...
0
votes
1answer
144 views

geopandas: “LineStrings must have at least 2 coordinate tuples” when reading gpx files

I am trying to use geopandas to read in some gpx files (generated from a Garmin vista HCX). For many gpx files, given this code: >>> import geopandas as gpd >>> data = gpd....
3
votes
1answer
85 views

Read N number of rows from shapefile using GeoPandas

Pandas has a parameter nrows for selecting how many rows will be read into the dataframe. Does GeoPandas have a similar parameter? Couldn't find in the documentation.
1
vote
1answer
481 views

Performing sjoin on polygons and lines without intersection using GeoPandas?

I want to join a GeoDataFrame with Polygons (circular, were created from Points with buffer) with a GeoDataFrame that has Linestrings. These polygons and lines do not necessarily intersect nor ...
3
votes
1answer
125 views

Re-project GeoJSON from pixel-space to lat-long in Python

I have created a GeoJSON of linestrings in pixel space using Python. However, I now need to re-project the file to match the same projections and extent of the .tiff file I wish to layer the GeoJSON ...
1
vote
1answer
82 views

GeoPandas does not identify points inside polygon

I am trying to intersect some points with a polygon in GeoPandas. First I create a Point GeoDataFrame from a text file. import geopandas as gp import numpy as np import pandas as pd from shapely....
0
votes
0answers
57 views

Opening geodata in GeoPandas?

I've downloaded some geodata but I'm unable to import it into GeoPandas. This is a sample of the geodata (I've trimmed the JSON object): {'displayFieldName': 'NAME', 'fieldAliases': {}, '...
0
votes
2answers
317 views

How to inverse the orientation of the holes coordinates of a polygon in geopandas

I have a polygon shapefile which I am reading with geopandas. The polygon contains holes. My purpose is to add a random point inside each hole. In order to create the points inside the holes (...
0
votes
0answers
203 views

Geopandas ImportError: DLL load failed (in pyviz tutorial geographic data examples) win7

I'm trying to run the geographic data examples from pyviz tutorial. I'm getting the error list in modules below. My Geopandas module work fine (and the others dependent modules) with 3.5 python ...
0
votes
0answers
157 views

TypeError: object of type 'Polygon' has no len() - When trying to plot from a Dataframe

I need to create a LISA map for my work, and I am having problem when I'm trying to plot using geopandas. My data sources are: map_df # A Dataframe A geopandas series : hh = map_df.loc[(map_df['...
2
votes
2answers
275 views

Rounding coordinates to 5 decimals in GeoPandas?

I have a shapefile, which I converted into geopandas dataframe. I would like to round the coordinates to 5 decimals. Is there a method/function in geopandas that can do this? My shapefile contains ...
3
votes
1answer
111 views

Changing CRS in GeoPandas?

I'm trying to plot a bunch of points on a map of Britain and Ireland, and I've been using GeoPandas for that. I've basically just been following the tutorials to do that, and slicing a world map with ...