The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [geopandas]

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

Filter by
Sorted by
Tagged with
1
vote
0answers
39 views

Python: distance of point to polygon border

I want to measure the distance of a point(lat,long) to a the border of a Polygon. So I have created the polygon with the coordinates. from shapely.geometry import Polygon, Point Polygon(zip(lon_list, ...
0
votes
0answers
20 views

Legend of GeoDataFrame does not sort categorical data values

I try to plot a map of temperature with geopandas in Google Colaboratory. This is my dataset: id = '1LOywA8JPP6vOFDP-CBOBgkSmX7zv2pDc' downloaded = drive.CreateFile({'id':id}) downloaded....
0
votes
0answers
69 views

Coordinates format [closed]

How to read this Point(601872.0567818936 5789972.687450857)? This point is consist of latitude and longitude. So I need to know how can I convert that to Degrees and Minutes? Another example of the ...
0
votes
0answers
35 views

Cannot create geodataframe from feature class due to IndexError: list index out of range

I have a function that helps me read in large feature classes and them create a geodataframe: line_feat = "S_Studies_Ln" cnms_cols = ['REACH_ID', 'STUDY_ID', 'CO_FIPS', 'CID', 'FLD_ZONE', '...
0
votes
1answer
86 views

Why do I get error “Runtime: b'no arguments in initialization list'” when running to_crs?

I have a geopandas dataframe that has POINT geometry in NAD83. I want to use to_crs to change them to espg: 4326. When I first bring in the feature class as a gpd dataframe, it shows no crs, so I use ...
1
vote
0answers
39 views

Distance between centriod of the polygon and each and every point of the polygon [closed]

I'm trying to calculate the distance between centriod of the polygon and each and every point of the polygon using GeoPandas Python I need to find the distance between centroid(18.9568383649 72....
1
vote
0answers
23 views

Get all road intersecting a polygon

I am trying to read from a local instance of the OpenStreetMap database all roads intersecting a boundary coming from another database. I actually get a result with the following piece of code: #...
1
vote
0answers
24 views

How remove a duplicated coordinate in multipoints using GeoPandas?

I have shapefile river data in line format, import this data with GeoPandas and apply it to a .boundary to get as initial and final coordinates of each line. But as lines intersect a coordinate may ...
2
votes
2answers
57 views

Get field names in attribute table with Python

I have a geopackage file, with a layer called "MyLayer". Within this I have an attribute table with approx 20 attributes. I can read in each attribute individually like: import geopandas as gpd ...
2
votes
1answer
41 views

Calculating area of geometry using Geopandas? [duplicate]

Is there an easy way in geopandas to calcuate polygon areas after an intersection analysis? I am switching from ArcGIS to open source and try to translate my code. In ArcGIS I used: arcpy....
0
votes
1answer
29 views

Mask rasterio raster with geopandas shapefile

I am loading a shapefile using geopandas as follows: import geopandas as gpd StudyA = gpd.read_file('.../Study_Area_Polygon.shp') Next, I am using folium to plot it interactively: m = folium.Map([...
1
vote
0answers
35 views

Making polygon for every point in set using voronois?

I'm trying to make polygons from points, were each point will be represented by one polygon. I tried using voronois, but the results are incomplete. While I more or less understand where this ...
1
vote
1answer
26 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....
1
vote
0answers
53 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
34 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
24 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
91 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 ...
2
votes
1answer
42 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....
1
vote
1answer
76 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
27 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
28 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
48 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
63 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 = ...
0
votes
1answer
38 views

geopandas overlapping check

How we can check if feature has intersections or not with other features in one shapefile data, I wanna make sure if in that file there is no overlaps between polygon, I have read this approach "An ...
3
votes
1answer
48 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
76 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
107 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
52 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
66 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
42 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
76 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
52 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
22 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
36 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
28 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
48 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
129 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 ...
0
votes
1answer
177 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
53 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
90 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
59 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
36 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
42 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
45 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
33 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
737 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
29 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
27 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
154 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
55 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 ...