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
29 views

Turn detached coordinate values into linestring in GeoPandas

I have the following dataframe id x1 y1 x2 y2 0 431634.751688 4.581910e+06 431692.792776 4.581814e+06 1 431930.133825 4.581873e+06 431938....
2
votes
0answers
270 views

GeoPandas transform latitude/longitude coordinates to UTM coordinates

I have a shapefile which I read with GeoPandas, this shapefile has lat/long coordinates and I want to transform it to UTM coordinates. I tried this: shapefile = gpd.read_file('example.shp') #CRS = ...
2
votes
0answers
103 views

Add WMS to matplotlib Python

Currently I am adding a basemap from stamen.com to my plots as it is explained here: http://geopandas.org/gallery/plotting_basemap_background.html . Is it also possible to load a WMS from another ...
0
votes
1answer
82 views

How to apply the orient function on the geometry of a GeoPandas dataframe

Given a GeoDataFrame where the geometry column contains both Polygons and MultiPolygons. How can I force the orientation (left-hand-rule or right-hand-rule) on these geometries?
3
votes
3answers
549 views

Colorizing polygons based on color values in dataframe column?

I preparing some choropleth election result maps in Geopandas. The assigned color for each electoral district must correspond with the winning party (a color that I pre-determine), and the intensity ...
3
votes
1answer
120 views

Truncating points precision

I have geopandas with CRS in meters (ITM {'init' :'epsg:2039'}). I converted the geometry from espg:4326 so I have very high precision which I don't require: POINT (177559.4776412862 594546....
2
votes
1answer
215 views

Dataframe of points to PostGIS

I have a csv file with some info and coordinates and I want to create a table in PostGIS with that CSV file. This is what I have so far: import pandas as pd import geopandas from datetime import ...
0
votes
0answers
95 views

Memory usage (or absolute bytesize) of geometry objects(shapely) in a GeoDataFrame in Python?

I am currently working on analyzing data structure and size of a shapefile. To analyze it, I was wondering how much geometry column consumes the size of a shapefile. Unlike other features, geometry(in ...
0
votes
0answers
35 views

Using Single Polygon for entire dataframe in PySAL?

I'm trying to calculate the queen contiguity weights using pysal's queen_from_shapefile() helper method based on this page Not being a GIS specialist I wanted to check my intuition on this Q&A ...
0
votes
0answers
65 views

Getting more precision with GeoPandas?

Geopandas Reading a shapefile with GeoPandas and printing its total bounds: dataframe = gpd.read_file('example.shp') print(dataframe.total_bounds) Prints: [ 663590.5817 1541419.8307 724630.0589 ...
2
votes
1answer
230 views

How to dissolve overlapping polygons using GeoPandas

Assuming the following: from shapely.affinity import translate from shapely.geometry import Polygon import geopandas p0 = Polygon( [(0,0), (2,0), (2,2), (0,2)] ) p1 = translate(p0, xoff=1) p2 = ...
-1
votes
1answer
91 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 "...
3
votes
1answer
110 views

GeoPandas not projecting from 4326 to a UTM zone properly?

I am at my wit's end trying to figure out why my data is not being reprojected properly in a geodataframe. Given this input data, saved in a variable called power_lines: {'type': 'FeatureCollection',...
2
votes
1answer
170 views

GeoPandas: Get distance from geom in tableA to a geom in tableB that matches attribute from tableA

UPDATE WITH SOLUTION (at bottom) Using GeoPandas I am trying to identify the distance between an election candidate's home address (Point) and the electoral district they are running in (Polygon). ...
3
votes
1answer
280 views

Convert contours to polygons maintaining attributes using Python?

I have a series of polylines(contours) that i want to convert to polygons using Python (GeoPandas, Fiona, Shapely). Because these are contours, there will be donut polygons, can anyone point me to how ...
2
votes
1answer
163 views

Accessing a ShapeFile with GoogleEarthEngine-API : Invalid GeoJSON geometry

I'm trying to download Sentinel-2 data of my area of interests on Google Earth Engine API for Python. I'm trying to access my shape file (contains 2 different polygons) on the API. I added the shape ...
1
vote
1answer
150 views

Get UTM zone with GeoPandas from a shapefile

I want to know to which UTM zone belong a shapefile. With GeoPandas I can read a shapefile and know its EPSG code: import geopandas as gpd dataframe = gpd.read_file('shapefile.shp') print(dataframe....
0
votes
0answers
101 views

Cannot open gdb folder from external drive using geopandas

I am trying to open a .gdb folder from an external drive with geopandas: import geopandas as gpd data = gpd.read_file('/Volumes/SSD/data.gdb') and I am getting the following error: DriverError: '/...
1
vote
1answer
510 views

Plotting a heat map onto background in python using kde?

I have a geodataframe with points within the united states. Each point has a geometry attribute as well as a value. I would like to plot a heat map based on these values on top the map of the united ...
2
votes
0answers
67 views

GeoPandas spatial join generates error in QGIS 3.8 Python console

I want to execute a spatial join using GeoPandas in the Python console QGIS 3.8 like this: dfsjoin = gpd.sjoin(point, polygon) but it doesn't work. It always shows the following error: Exception ...
0
votes
0answers
31 views

GeoPandas Dissolve splits polygons into parallel strips?

I have polygons that is converted from raster dataset with Raster Pixels to Polygons in QGIS. I would like select some polygons based on the attribute value and merge them using Dissolve function in ...
1
vote
0answers
49 views

Merging adjacent polygons using Geopandas by avoiding filling gaps

I have raster dataset that I would like to convert into vector polygons. Raster to polygon conversion works pretty good. But, having problem when I try to merge adjacent polygons using Dissolve ...
0
votes
1answer
70 views

Getting z coordinates from polygon list of Geodataframe?

I am using Python to solve a problem with many polygons that could be really stressful with other software related to my field (mining), however i havent found a way to extract the Z coordinates from ...
0
votes
2answers
81 views

GeoPandas sjoin with extensive quantities

I have one geodataframe that contains polygons and corresponding land use category (e.g. agricultural, commercial, retail, residential, ...) and another that contains census tract polygons and ...
0
votes
2answers
714 views

GeoPandas: plot two layers but only to the extent of the smaller one

I am using GeoPandas and I want to plot two layers. I want the map to have the extent of the smaller layer. With this code below, the map's size automatically fits the bigger layer. import geopandas ...
1
vote
2answers
331 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
255 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
268 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
71 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
55 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
46 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 ...
5
votes
0answers
101 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
48 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
1answer
3k 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
56 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
28 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
587 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
135 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
134 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
263 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
835 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
141 views

Creating 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
113 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 ...
1
vote
1answer
49 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
438 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
364 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
151 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
237 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
60 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
163 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 2 3 4 5 11