We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [geopandas]

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

Filter by
Sorted by
Tagged with
2
votes
2answers
2k views

geopandas error “minimums more than maximums”

I posted this question on stackoverflow here, but it seems that gis.stackexchange is the more appropriate platform. I am trying to merge two geodataframes in geopandas (want to see which polygon each ...
3
votes
1answer
1k views

Inserting LiDAR points (from laspy) in GeoDataFrame without using a numpy array?

Working with Python 3.6 (Anaconda) under Windows using a laspy fork that works with Python 3 (https://github.com/sethrh/laspy). I am loading a LAS file to a GeoPandas GeoDataFrame to eventually ...
2
votes
2answers
2k views

Only read specific rows of a shapefile with GeoPandas / Fiona

I would like to read in only certain rows of a shapefile using GeoPandas. I've read approach for limiting columns of shapefile to read in, which I may use as well (Only read specific attribute columns ...
8
votes
1answer
3k views

Crop a raster using rasterio and geopandas

I am cropping a set of historic aerial photographs. These photographs have large black areas in the edges (0 value). However there is also valid data with a 0 value. The workflow I am using is: Load ...
5
votes
1answer
843 views

Difference between lines and polygons using geopandas

I wanted to geopandas.overlay() on lines and polygons : get the geometries from the lines that are not in the polygons. I tried using geopandas for this : result = gpd.overlay(my_lines, my_polygons, ...
2
votes
1answer
2k views

Python Shapely - filling small gaps between multi polygons

I have a set of rectangular polygons, which currently form a directional path. The library I am using is Python Shapely / GeoPandas. The issue I am having is as the path changes direction, there are ...
1
vote
0answers
147 views

Efficient way to identify the many points at which a large set of shapely LineStrings intersect?

I have 10,000 shapely LineStrings in a geopandas GeoDataFrame. What is an efficient Python plus shapely (and/or optionally geopandas) way to produce a list of all the points at which these lines ...
0
votes
1answer
242 views

Finding if point exists in shapefile using shapely performance?

I have a data frame that consists of 2 million rows (lat, lon) and I am trying to figure out if each of these points are in a boundary defined by a shapefile or not (intact I am looking at multiple ...
5
votes
1answer
10k views

How to extract long and lat from geometry column in GeoPandas?

I read a shapefile with GeoPandas and I get a nice table with a column "geometry". This column contains shapely.geometry.polygon.Polygon or shapely.geometry.multipolygon.MultiPolygon object. import ...
0
votes
1answer
2k views

Projecting Geoseries Geopandas doesn't work

I have on geoseries that I would like to project to equal area conic of lambret. However my code doesn't work. What is wrong with it? #piece of g_source {GeoSeries}: 156 POINT (-40....
6
votes
1answer
18k views

Geopanda write GeoDataFrame into shapefile or spatialite

I trying to save file from GeoDataFrame to shapefile or spatialite. But for some reason i got error: My GeoDataFrame appear correctly without any issuesi look's like there is something wrong with my ...
2
votes
1answer
816 views

Converting Fiona Collection to Geopandas GeoDataFrame?

I have a feature class in a file geodatabase that I attempted to open with Geopandas, but I got the "list index out of range" error. To bypass this error, I'm reading the feature class directly with ...
1
vote
1answer
90 views

How can I programatically create a (tiff) raster file for a DEM to reference a constant altitude?

I'm trying to create a DEM to go with a simple shapefile (one polygon, four points) in python. I used fiona to create the shapefile and now need to create the DEM as a tiff file to denote the ...
3
votes
1answer
1k views

Converting a KMZ file containing an api link for use in python's geopandas

I've got a KMZ file which contains an API link for a map overlay, this is the link to that file. (The corresponding json file (link here), posted only gives me a link to a low resolution image and ...
7
votes
1answer
7k views

Cannot get plot() in geopandas to produce a map of the GeoDataFrame

I have installed all the necessary and optional modules for geopandas (with the exception of rtree) as listed at http://geopandas.org/install.html I am following the tutorials from this site and also ...
5
votes
2answers
3k views

Geopandas: Write layer back into GeoDataBase

I use geopandas (which uses fiona) to read a GeoDataBase layer (using driver="OpenFileGDB") into a geodataframe for easy manipulation. read_shp = gpd.read_file(GDB_file, layer=layer_choice) That ...
0
votes
1answer
413 views

geopandas read_file breaks in fiona open()

I am trying to read-in a shp file and can't seem to do it with the geopandas version 0.2.1. Here is the error: --------------------------------------------------------------------------- KeyError ...
1
vote
1answer
1k views

Excluding multi geometry types into a single Polygon type

After i did an intersection with two shape using geopandas through the following topic (Intersecting two shape problem using geopandas). But it output a multi geometry type shape,which in futher step ...
3
votes
1answer
7k views

Intersecting two shape problem using geopandas

I'm trying to intersect two polygons based on the following link, intersecting two shapefiles from Python or command line But problem occured that shows a "ValueError: Geometry column cannot contain ...
2
votes
2answers
391 views

CRS from a planar projection around a point (pref. in Geopandas)

Is there a canonical way of projecting a set of points (for example, originally given in WGS84 latitudes/longitudes) into a planar approximation centered on a particular (latitude, longitude) pair and ...
6
votes
1answer
2k views

Trouble when Dissolving Geopandas Polygons

I have dissolved polygons with geopandas. However, the head of attribute table became values of this table. How can I fix this trouble? See:
3
votes
1answer
950 views

Geopandas performance appears quite slow

I'd like to confirm the performance I am observing when utilizing distance from a Geopandas Series. Problem Time to complete operations appears to be far greater than comparable operation in ...
3
votes
1answer
445 views

How to find coordinates from large CSV within multiple shapefile polygons

I have a CSV file of around 230 million rows, which contains a latitude column, a longitude column, a Date stamp, and an ID column. It look like this (I added the header in this example to help ...
1
vote
0answers
167 views

From the thousands of the overlaid polygons, get clusters of density

I have a few thousands of the polygons, over the given region. Many of them overlay. What I want is to detect areas, where density (number of overlaying polygons at the point) is substantially higher ...
4
votes
0answers
340 views

What's the fastest way to convert large csvs to point shapefile

I'm working in QGIS, and my current method to change csvs to shapefiles is to import them to QGIS, right click and save as shapefile. For large CSVs (over 100 million rows) it can take quite some time ...
1
vote
1answer
853 views

Create GPS (gpx) routes from GeoPandas geodataframe

I have a GeoPandas geodataframe with LineString geometries and I'd like to export them into .gpx files as GPS routes. I've searched for hints in the web but found anything useful. Are there ...
1
vote
1answer
2k views

Geopandas [Shapely] spatial difference: TopologyException: no outgoing dirEdge found

I am working on the "solver" that sequentially selects best location from the list, basing on poi and overlapping polygons within the certain buffer, then removes those points and location from the ...
3
votes
1answer
1k views

Parsing WKB with python geos: ParseException: Unknown WKB type 16

I am pulling a WKB strings from the MYSQL table in pandas / geopandas, Python 2.7. As it is MySQL, the only way to read geometry is to parse it on the client. However, when parsing, geos raises an ...
1
vote
0answers
412 views

How to create a custom transverse mercator projection?

I'm working on a script that performs some simple geometric manipulations such as buffering vector data using shapely or geopandas. The input (i.e. original) shapefile could be geographically located ...
12
votes
1answer
8k views

GeoPandas to_file() saves GeoDataFrame without coordinate system

I have GeoPandas 0.2.1 py27_0 fiona 1.7.0 np110py27_1 Python 2.7.10 installed in Anaconda 2-4.1.1-Windows-x86 environment. I am able to construct GeoDataFrame by reading input datasets and ...
4
votes
1answer
1k views

How to buffer a line with a flat cap style using geopandas?

I'm interested in buffering a linestring geometry using a flat cap style rather than the default round cap style using geopandas. I see shapely, which geopandas is based off, has the option to do that:...
0
votes
0answers
543 views

GeoPandas: interpolate for time X in timeseries

I've got some position data as a dataframe per target. Dataframe for target A: index TimeOfFix Lat Lon geometry 0 1478133083 -27.1124 34.3203 POINT(34.3203 -27.1124) 1 1478133085 ...
12
votes
3answers
6k views

geopandas spatial join extremely slow

I am using the code below to find a country (and sometimes state) for millions of GPS points. The code currently takes about one second per point, which is incredibly slow. The shapefile is 6 MB. I ...
1
vote
2answers
845 views

Fiona throws KeyError when attempting to read a shapefile

I'm attempting to read the AADT_2014.shp file from the New York State Department of Transportation average traffic data (TDV_Shapefile_AADT_2014.zip specifically through fiona (by way of geopandas). ...
4
votes
2answers
478 views

Weird output when projecting/interpolating points on lines

I am trying to project a points' shapefile on a multilinestrings' shapefile. (Project each point to the closest line) Here's my code : import geopandas as gpd import time start_time = time.time() ...
0
votes
1answer
3k views

Make a shapefile with geopandas from polygons

I am new in dealing with shapefiles. I have a dataset with points that represent centroids of polygons. I want to do a Voronoi tessellation and create a new shapefile with the obtained polygons ...
1
vote
0answers
270 views

GeoPandas cumulative value sum for intersecting polygons

I have a geojson file for all of the tax areas in the state of Utah. I read it into a GeoPandas dataframe. Now each row represents a tax area polygon. Many of the tax area polygons overlap each ...
2
votes
1answer
5k views

How to select features where column matches a regex and save them in a new shapefile?

I want to select features from a shapefile where the value of column matches a regex then save only the selected features in a new shapefile.(I used regex101.com to write the regex and check if it's ...
2
votes
1answer
1k views

Calculating and setting length value for each row in a shapefile returns empty column

I have a Linestrings' shapefile to which I added a column named "length". I want to set the length of each row (geometry) in that column. Here's my code : import geopandas as gpd from shapely....
1
vote
0answers
47 views

shapely polygon leaves traces of other poly geometries after unary_union [duplicate]

I am trying to dissolve poly from a shapefile with unary_union and at times I am left with a poly that looks like this: You can see the lingering line geometries left inside of the poly. I have been ...
2
votes
1answer
1k views

Return closest element in GeoSeries

Is there any built-in function or quick hack to efficiently return the closest element (index) to a point for a given geopandas GeoSeries? Something like >> geopandas.GeoSeries( >> { ...
5
votes
1answer
7k views

Split lines at points using Shapely

I'm trying to split a shapefile of geometry type 'line' at a shapefile of geometry type 'point. These points are snapped to the lines and are the start points/end points of other line shapefiles. ...
2
votes
1answer
2k views

Selecting features from shapefile where field=“value” using Geopandas?

I don't understand the difference between OGR and Geopandas librairies. I have checked the documentation of GDAL as well as http://geopandas.org/ but I still don't get it. I just started learning ...
6
votes
1answer
6k views

geopandas: can't save geojson

My task is to upload geojson, add data from corresponding csv, drop some columns, then save it back to geojson. However, after I did everything, added csv data (gj.join(df) ), etc, I can't save it ...
4
votes
1answer
609 views

Read only geometry from shapefile with python/geopandas

I would like to open a shapefile(shp) without loading the attributes(dbf), as I do not care about attributes and it takes about 25 minutes to load them. I am using Python Geopandas, so any Fiona or ...
2
votes
1answer
107 views

Count Lat Lon Data Points Lying Between 2 Azimuths

I need to count the number of points (LAT, LON) from a cvs file that exist inside an arc defined by 2 azimuths. Ultimately it will need to be iterative where the arc defined by the 2 azimuths rotates ...
6
votes
1answer
1k views

GeoPandas GeoDataFrame plot statistics - how?

The plot method of a GeoPandas GeoDataFrame overrides the DataFrame parent method to plot the geometries of the associated GeoSeries. This is very convenient, but I'd also like to use the easy ways ...
3
votes
2answers
2k views

Folium GeoJSON Overlay Not Appearing

I am in the midst of a task which involves the clustering of assessment neighborhoods into larger neighborhoods (data link). The goal is build these neighborhoods in a manner consistent with major ...
3
votes
0answers
2k views

Folium heatmap not displaying

I have an output file data.json [{"5403": 2, "9734": 1, "2565": 5, "5087": 2, "9061": 1, "1761": 4, "4811": 7 "1111": 5, "3891": 3, "1962": 3}] and a shapefile converted to geojson https://www....
5
votes
2answers
3k views

Geopandas: counting the number of raster pixels within a shapefile polygon

I have a shapefile that I have loaded as a geopandas dataframe, and it has a geometry column containing polygons and multipolygons. My end goal is to do some zonal computations on a GeoTiff raster, ...