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
142 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 ...
1
vote
0answers
27 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 ...
1
vote
1answer
38 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 ...
1
vote
1answer
35 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 ...
2
votes
1answer
76 views

Building Raster Attribute Table (RAT) from GeoPandas dataframe with rasterio or GDAL

I am trying to figure out how to generate a RAT for a 1-band raster with rasterio or GDAL given a GeoPandas dataframe. My GeoPandas dataframe has 4 columns (X, Y, PERC_VALUE, LANDUSE_LABEL) which I ...
0
votes
1answer
35 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-...
0
votes
0answers
15 views

Faster way to truncate the coordinates than pandas.apply?

If have a GeoDataFrame with loaded coordinates. I'm using apply to truncate the coordinates precision - is there a faster way than using apply? gdf.geometry = gdf.geometry.apply( lambda p: sg....
2
votes
0answers
67 views

Plotting GoeDataFrame on a raster

I have a bunch of polygons which I loaded from a shapefile into a fields GeoDataFrame: geometry raster_val 0 POLYGON ((8.56799 47.80800, 8.56799 47.77200,...
0
votes
0answers
22 views

Reading password protected shared file geodatabase using GeoPandas

I'm trying to read a geodatabase that is stored in a password protected shared geodatabase using GeoPandas. Is there a way to do so? I attempt to connect using this. import geopandas as gpd ...
1
vote
1answer
68 views

Writing osmnx queried footprints to shapefile

I'm attempting to pull a set of building footprints from open street map using a shapefile boundary. I have success getting the buildings into a geodataframe, but when I attempt to write them out to ...
1
vote
1answer
64 views

Matching GPS trackers POINT data between Nodes of OSM (Open Street Map) [closed]

I have GPS point data of vehicles from XYZ Tracking Company. The data has following columns: UnitID RecordDateTime LATITUDE LONGITUDE Speed Direction Reason Altitude Data Dictionary is given below:...
1
vote
1answer
98 views

Using vmin and vmax does not change anything for my plots

I have this code here for plotting 2 variables with different values Min:0 Max:33 Min:0 Max:13 import geopandas as gpd import pandas as pd import matplotlib.pyplot as plt pm10_base = gpd....
2
votes
1answer
243 views

Convert GeoJSON to GeoPandas GeoDataframe

I created the following GeoJSON object with this code: from rasterio.features import shapes polys = [] for shape, value in shapes(segments, transform=affine): polys.append(shape) [{'type': '...
3
votes
1answer
38 views

GeoPandas geometry is different on Windows and Linux

Building a same application both on Linux and Windows I noticed that the geometry is handled differently after transferring the dataframe from WGS84 projection to OSM. The results of the program ...
0
votes
1answer
78 views

Grid polygon generation by converting meter to degree using Python

When given a shapefile as below as an Input, I would like to generate a 100x100 meter polygon grid using python. I went through Creating a regular polygon grid over a spatial extent, rotated by a ...
2
votes
0answers
31 views

Create sequential ID column type when loading GeoDataFrame to PostGIS

Is there a way to define GID column as sequential (auto-incremental) when loading GeoDataFrame (created from Shapefile) to PostGIS? I use Geopandas and "to_sql" method: geodataframe.to_sql(tablename, ...
2
votes
1answer
203 views

Save GeoDataFrame to .jpg file

I have a GeoPandas DataFrame (loaded from a shapefile) containing a number of polygons which looks like this: geometry raster_val 0 POLYGON ((8.56799 47....
0
votes
1answer
48 views

ValueError geopandas.sjoin: why does it not read my GeoDataFrame?

I'm working on a spatial join between a polygon from a shapefile and points from a CSV file, using geopandas.sjoin. I want to assign each point with a name of the province it is located in. I do know ...
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) ...
2
votes
1answer
76 views

Modify bounding box of GeoDataFrame

I have a GeoDataFrame which is a multipolygon and represents boundaries of a country: 0 MULTIPOLYGON (((10.10112 46.23346, 10.10099 46... Its bounding box/extent is: minx miny maxx ...
1
vote
0answers
40 views

Intersecting 'n' shapefiles in Python and get the sum of a specific attribute in intersection areas [closed]

I have 'n' shapefiles and where they intersect i need to sum a specific attribute. In some points they all intersects, in other points only some of them intersects while in others i don't have any ...
0
votes
0answers
47 views

Is it possible to read temporary QgsVectorLayer with fiona or geopandas?

I want to change all features' attribute without for loop. I checked pyQgis, geopandas and fiona api. However, I can't find a method. Geopandas and fiona want to file path but I don't have any path ...
2
votes
2answers
110 views

Point in doughnut hole incorrectly identified as within KML polygon

I have read in a KML file of CA firezones and for a certain area (around LOMPOC, CA), it seems to include anything inside a non-fire zone doughnut hole. Most of the processing is fine, just there are ...
1
vote
1answer
228 views

GeoPandas - calculate distance a point from a polygon

t1 = Polygon([(4.338074,50.848677), (4.344961,50.833264), (4.366227,50.840809), (4.367945,50.852455), (4.346693,50.858306)]) t = geopandas.GeoSeries(t1) t.crs = {'init':'espg:4326'} t2 = geopandas....
0
votes
0answers
34 views

Error converting a DataFrame to a GeoDataFrame

I have a two DataFrames, one with a Point column and the other with a MultiPolygon column. I need to convert both of then into a GeoDataFrame. To do it with the first one I have used this: geometry =...
0
votes
1answer
45 views

Setting projection parameters in Geopandas

I have a shapefile which I want to reproject to lambert conformal conic and set the projection parameters such as the following: False_Easting, False_Northing, Central_Meridian, Standard_Parallel_1, ...
1
vote
0answers
54 views

Generating transects perpendicular to Shapely/Geopandas Line

I'm doing an analysis on transects going perpendicular to a 1000m topographical contour line and I'm struggling to find a good way to create evenly spaces transects perpendicular to that contour. As ...
1
vote
1answer
60 views

Geopandas unary_union keeping lowest value

I have a shapefile with 850,000 records. What I am trying to do is merge all adjacent polygons and keep the lowest value for the group. so for example my polygon is land_plots and has a crop_yield ...
1
vote
1answer
192 views

How to create a linestring from a geopandas data frame?

I am trying to create a linestring from a geopandas dataframe with points as geometries date_time latitude longitude year data01 hour minute data02 0 2019-11-08 08:21:38 36.830444 -...
0
votes
0answers
43 views

Issue creating a GPX file using GeoPandas

I am trying to write a GPX file using GeoPandas and Fiona. gdf = gpd.read_file('data.shp', headesr= None) gdf.to_file('data.gpx', 'GPX') The geodataframe created still having the column names. First ...
0
votes
0answers
83 views

Reading GeoPackage file bigger than RAM size with GeoPandas?

I have a gpkg file that's around 10GB, and 8GB of RAM. So, if I were to read my file: import geopandas as gpd fp = "/path/to/my/file.gpkg" data = gpd.read_file(fp) print(data.shape) My computer ...
1
vote
0answers
31 views

Calculate distance in meters using results in degrees

I receive some distance differences in degrees, like this: 0.0009698680322606666 using this function: def radius(gpd_df, cpt, radius): sindex = gpd_df.sindex bbox = (cpt.geometry.x-radius, ...
1
vote
1answer
39 views

Merge two GeometryArray into one one GeometryArray in geopandas?

How can I merge two GeometryArray (available in GeoPandas)? I have two Geometry arrays and I want to merge them to save them to a single file. Sadly I get TypeError: unsupported operand type(s) for +...
3
votes
0answers
115 views

Find a centerline of an intersection between two irregular shaped polygons

I have two irregular shaped polygons that overlap each other at least in at two points. I want to first find the intersection area between all of them, then for the polygon pair that intersects I want ...
3
votes
2answers
209 views

GeoPandas cut lines with polygon

I wanted to clip lines with polygon geometry: from shapely.geometry import Polygon, LineString import geopandas as gpd polygon = Polygon([(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]) line1 = LineString([...
0
votes
0answers
29 views

Is it possible to create a GeoJSON file with a defined geometry type but no features using Python?

I would like to initialize many empty GeoJSONs that have a defined geometry type (i.e. polygon or polyline) but contain no actual geometries. I would also need to set the CRS via an EPSG code. After ...
1
vote
1answer
35 views

Plotting shapes form Census Bureau with GeoPandas results in some erroneous white triangles

GeoPandas 0.6.1 Almost every shapefile from Census Bureau is giving the same error. In this case is the Block data shapes from Maine. The file is "tl_2019_23_tabblock10.shp" gdf.plot(figsize=(32, ...
1
vote
0answers
22 views

Pathfinding in mixed network

I have three geopandas GeoDataFrame representing a road network, telecommunication wires and a set of network devices to be connected to the network. They are respectively depicted as yellow lines, ...
1
vote
0answers
329 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, ...
1
vote
0answers
47 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
82 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
1k 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
55 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
29 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
48 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
119 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
95 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
159 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([...
5
votes
4answers
182 views

Find the maximum value for a point among several overlapping vector layers in QGIS3

Dataset 1: around 80 vectorlayers with polygons. Each polygon has a value for a noise measurement. Some of the layers (up to ten at at time) are intersecting at some locations. Dataset 2: a ...
1
vote
0answers
94 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 2 3 4 5 11