Questions tagged [geopandas]

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

Filter by
Sorted by
Tagged with
0
votes
1answer
86 views

Length of intersections from a linestring and a grid shapefile by using Python geopandas & QGIS

I am using Python geopandas and I have two shapefiles. One of them is a grid file containing equal polygons. The other shapefile is a linestring file with several lines and its Attributes. The idea ...
2
votes
1answer
24 views

'Must have equal len keys and value when setting with an iterable' error message

I have a postgres spatial table that I want to convert to a geopandas GeoDataFrame. In order to do so I wrote the following piece of code: #'pg_tab_clip' is the name of the postgres spatial table #'b'...
1
vote
1answer
42 views

Cutting a portion of a satellite image based on coordinates in GDAL?

I have a satellite image of 7-channels (Basically I have seven .tif files, one for each band). And I have a .csv file with coordinates of points-of-interest that are in the region shot by the ...
0
votes
0answers
38 views

Checking for geospatial similarity in Python?

Say I have two pandas dataframes in a format similar to this one where each 'Point' represents a person and where they were at. Assume that there are multiple line strings representing different ...
2
votes
0answers
26 views

Plotting Geopandas Gallery example fails?

I have been having trouble getting the figures from the example provided in Geopandas Gallery examples. When I ran these scripts in Jupyter console: import geopandas import geoplot import matplotlib....
2
votes
1answer
36 views

Retaining last position of vessel position in geodataframe including time series?

I have geodataframe about vessel position which include unique code called 'mmsi' and time series. In the following 'mmsi' column has more than 1 'mmsi' code and time series (* mark). mmsi ...
3
votes
0answers
34 views

Nearest neighbour joins for two geodataframes using KDtree from scipy/sklearn

I have a number of large geodataframes and want to automate the implementation of a Nearest Neighbour function using a KDtree for more efficient processing. The process I want to achieve here is to ...
0
votes
0answers
26 views

Possible To Add Text Inside Geopandas Bubble Markers?

I've got a chloropleth base map of one variable and then a bubble overlay of another variable. Is it possible to add text within the bubble markers, for say what number is represented by the size of ...
1
vote
0answers
85 views

GeoPandas matplotlib linewidth not working in loop

I am trying to plot a line in a GeoPandas dataframe via matplotlib. also I am adding a basemap and a polygon. However as seen in the picture below on the right top, the line is plotted with only a ...
1
vote
1answer
182 views

Error installing GeoPandas?

Can someone help me with this error concerning installation of geopandas even after installing 'shapely'? Error: cwd: C:\Users\JASHVA~1\AppData\Local\Temp\pip-install-ccci6ax2\fiona\ ...
1
vote
0answers
25 views

Adding distance when buffering point geometry in a geodataframe?

I have 2 geodataframes that I want to combine. They the same fields/columns but different geometries (one is points, one is polygons).To do this I want to buffer the points slightly (like 10m or ...
1
vote
0answers
26 views

Set-overlay collection of polygons on itself [closed]

I have a GeodataFrame in Geopandas, that consists of a number of polygons, each overlapping its neighbors. What I want is to generate every single possible polygon from all the intersections, so that ...
4
votes
1answer
65 views

Center / normalize choropleth colors in GeoPandas

I'm looking to plot a choropleth with a divergent colormap. I need to center the colormap in such a way that the middle color is displayed for a specific value (e.g. 0). How could I do this in ...
0
votes
0answers
31 views

GeoPandas plot choropleth line color

I'm using GeoPandas to create a categorical choropleth of my data. I managed to get the correct colormap applied to the polygon fill but there are tiny slivers between the polygons that I would like ...
1
vote
0answers
31 views

Create a geodataframe with more than one one geo_column

I am working with Postgresql/postgis and geopandas. I have tables with more than one geometry. How can I move this kind of tables to geopandas recognizing all the geometries columns? I am using ....
0
votes
1answer
38 views

GeoPandas plot does not work

I am running this code import geopandas df = geopandas.read_file('test.geojson') ax = df.plot(figsize=(10, 10), alpha=0.5, edgecolor='k') and I get nothing besides this error /usr/local/lib/python3....
1
vote
2answers
52 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
0answers
33 views

How to create polygons from centroids in Python for an interactive map

I have a geopandas dataframe where each record is a point. I am making an application using Flask and Python and would like to display an interactive map in HTML where the points would be transformed ...
1
vote
1answer
41 views

How to not overwrite with NoData values when updating a raster file using a numpy array?

I have a numpy array (called out_window) with the following values: out_window: [[[499 498 481] [494 490 464] [483 480 -1] [482 -1 -1]]] This numpy array was obtained by clipping a raster ...
0
votes
0answers
22 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
52 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 ...
0
votes
1answer
62 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': ...
1
vote
1answer
49 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
48 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
1answer
41 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='...
2
votes
2answers
107 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 ...
1
vote
1answer
61 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/...
1
vote
1answer
93 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
84 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 ...
0
votes
0answers
46 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 ...
3
votes
1answer
94 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
1answer
58 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
60 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 ...
1
vote
1answer
31 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
1answer
63 views

Finding shortest distance from point(s) to number of polygons at varying angles using shapely?

My aim is to calculate the distance a point is from land in Python, trying to replicate the functionality of fetchR. Given an origin and distance, I create shapely LineStrings which radiate out from ...
1
vote
2answers
27 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
87 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
43 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
60 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'...
1
vote
1answer
77 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
157 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 ...
1
vote
0answers
106 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 ...
2
votes
1answer
136 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 ...
0
votes
1answer
66 views

Geopandas intersects/contains fails between GeoDataFrames

I am struggling to make the GeoDataFrame functions: intersects/contains work between GeoDataFrames instances. Let t be a GeoDataFrame with contents: id ...
2
votes
1answer
96 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
31 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
140 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
70 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
42 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.
0
votes
1answer
56 views

Reading in AW3D30 GeoTIFF files and processing them in Python?

I am new to GIS processing, and I am using Python 3.6 to do so. My current task is to read in several files of geographic data (specifically tiles of elevation data from JAXA), combine them for my ...