Questions tagged [geopandas]
an open source project to make working with geospatial data in Python easier.
878
questions
9
votes
3answers
3k 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 ...
54
votes
2answers
63k views
Converting Pandas DataFrame to GeoDataFrame
This seems like a simple enough question, but I can't figure out how to convert a Pandas DataFrame to a GeoDataFrame for a spatial join?
Here is an example of what my data looks like using df.head():
...
3
votes
1answer
2k views
Calculating distances with lat/long in decimals and WGS 84
I need to calculate the distance between points of two different datasets, once with locations of towns, the other with locations of dams. Both are located in different countries in Africa.
The more ...
3
votes
1answer
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....
14
votes
6answers
33k views
GeoPandas: return lat and long of a centroid point
I would like to return the lat and lon or x and y from the point object in the following series as I plan to link them with an API I built that links OSM and NetworkX. The centroids will be added as ...
18
votes
3answers
14k views
What units are used by GeoPandas/Shapely area and distance functions?
it looks like a silly question, yet I can't find clear answer on that:
what units geopandas/shapely use calculating distance/area between objects?
13
votes
1answer
1k views
Counting features into intersections of Shapely Polygons
I have a geopandas GeoDataFrame containing hundreds of shapely Polygon and MultiPolygon geometries. The polygons overlap in lots of places. I'd like to make a new geometry that contains a count of how ...
21
votes
2answers
18k views
Joining (concat) list of similar dataframes in geopandas?
I have a list of dataframes, all of the same structure and all are polygons.
How can I add them all together using geopandas?
7
votes
1answer
8k 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 ...
0
votes
0answers
472 views
Find pairs of near features with geopandas, fiona, GDAL etc
I have a feature class of points, a few thousands I have now, but I expect to deal with hundreds of thousands of points. I would like find pair of points that is within a specific distance. The ...
2
votes
0answers
3k views
GeoPandas save to shapefile issue: Unable to open EPSG support file
When I try to use to_file() to write a GeoPandas GeoDataFrame to a shapefile I get the following error.
df3.to_file('~/Desktop/testout.shp', driver = 'ESRI Shapefile');
ERROR:Fiona:OGR Error 4: ...
0
votes
1answer
980 views
ImportError with GeoDataFrame.from_file(..) shapefile load - Fiona issue
I've installed Geopandas and its dependencies. An ImportError results in Fiona's ogrext.so lookup of "_CPLSetThreadLocalConfigOption":
Code executed:
boros = GeoDataFrame.from_file("./data/...
6
votes
1answer
11k views
Changing colours in GeoPandas?
I have a very simple map (http://www.nyc.gov/html/dcp/download/bytes/nybb_15b.zip) and I have never before worked with shapefiles in any way. Can someone tell me what I need to do in order to change ...
13
votes
2answers
15k views
Rasterize a shapefile with Geopandas or fiona - python
I need to rasterize a really simple shapefile a bit like this http://tinyurl.com/odfbanu. Which is just a shapefile coutaining counties in the US.I have seen this previous answer : GDAL RasterizeLayer ...
16
votes
3answers
13k views
Dissolving polygons based on attributes with Python (shapely, fiona)?
I have been trying to create a function that does basically the same thing that the QGIS "dissolve" function. I thought it would be super easy but well apparently not. So from what I have gathered ...
6
votes
2answers
4k 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, ...
5
votes
1answer
4k views
Insert Geopandas GeoDataFrame into Spatialite database
Is it possible to insert a Geopandas GeoDataFrame directly into a Spatialite database with Python so that the geometry column of the GeoDataFrame becomes a proper geometry table in the database which ...
5
votes
1answer
2k views
Speed up row-wise point in polygon with Geopandas
I have a geopandas GeoDataframe which contains some attributes and a geometry column which is filled with shapely Point(lon, lat) objects. Moreover, there is a GeoSeries which is equally indexed as ...
5
votes
2answers
5k views
How to merge polygons using GeoDataFrame?
I would like to merge polygons (parcels) which are inside the white road (which is a hole) -- see the picture.
The way I'm doing this is certainly a bad way because later, in my script, I have this ...
1
vote
1answer
599 views
Extract area of polygons inside larger polygon and sum their values to a new column
I have two landcover classifications (as shapefiles) created using eCognition. "Level0 (FID)" consist of larger polygons and "Level1 (FID, ClassName, Area_Pxl)" of smaller polygons within these. I ...
2
votes
3answers
11k views
Only read specific attribute columns of a shapefile with Geopandas / Fiona
Having geopandas installed in my Python environment, I can read a shapefile into a geodataframe with
In:
import geopandas as gpd
myShapefile = gpd.read_file(path_to_my_shapefile)
print(myShapefile)
...
2
votes
1answer
4k views
Geopandas/folium map not displaying?
I'm trying to use a combination of geopandas, pandas and folium to create a polygon map that I can embed incorporate into a web page.
For some reason, it's not displaying and wonder if anyone can ...
8
votes
4answers
14k views
Handling KML/CSV with geopandas - DriverError: unsupported driver: u'CSV'
I'm trying to import a dataset of UK postcode districts UK postcode districts from Google Fusion tables into geopandas with the aim of splicing it to a dataset of house prices.
The problem is that ...
5
votes
1answer
5k views
How do I convert Eastings and Northings projection to WSG84 in geopandas?
I'm very new to projections and struggling to convert a map dataset from OSGB36 (Eastings and Northings) to WGS84 (lat/longs).
I've used geopandas to import a shapefile. Now I want to export it as ...
0
votes
1answer
2k views
geopandas error when writing to_file() “ValueError: 'long' is not in list”
I'm having a problem getting the "to_file()" function to work with geopandas
import geopandas as gpd
f = gpd.read_file('fin.shp')
f.to_file('fout.shp')
Error Output:
---------------------------...
2
votes
2answers
3k views
How do I load mapinfo mid/mif into geopandas?
I suspect this is a trivial question to answer but how do I load mapinfo mid/mif files into geopandas?
While it's trivial to load and manipulate .shp files, I can't work out what code to use:
Here's ...
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 ...
8
votes
1answer
4k views
Sharing a Folium Interactive Map w/ Embedded Markers
I have been experimenting with a few Python packages that have great potential for my dissertation research. Since I use pandas for pretty much everything, geopandas was a natural choice for working ...