Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [geopandas]

GeoPandas is an open source project to make working with geospatial data in python easier.

1
vote
1answer
21 views

Error: Input [<shapely.geometry.point.Point>, <shapely.geometry.point.Point>] is the wrong shape for a LineString

I'm trying to create a linestring out of a dataframe of latitudes and longitudes. geometry = [Point(xy) for xy in zip(linkdf.lon, linkdf.lat)] linkgdf = GeoDataFrame(linkdf, geometry=geometry) ...
0
votes
0answers
34 views

Can't open shapefile with GeoPandas

I downloaded a shapefile from the Brazilian Institute of Geography and Statistics (IBGE). I can open it on QGIS and work with it perfectly there, but I need to work with it using Python. I'm trying ...
1
vote
0answers
29 views

Geopandas simplify results in gaps between polygons

The goal is to simplify the geometries of a shapefile containing multipolygons. However, when I use Shapely's simplify in geopandas, the result contains gaps between the polygons. I was hoping that ...
2
votes
1answer
47 views

How to merge geoseries to geodataframe based on geometry attribute

I have 5868 points in a geodataframe with some columns/attributes. Between points which have distance less than 10 m, I just want to select only one point as representation in that area. I have done ...
0
votes
0answers
18 views

re-projecting shapefile, RuntimeError: b'no arguments in initialization list' [closed]

Every time I try to re-project my shapefile, I got the RuntimeError: b'no arguments in initialization list'. I tried a lot of solutions but none of them worked. Can somebody walk me through a ...
0
votes
1answer
34 views

Geopandas intersects/contains fails between GeoDataFrames

I am struggling to make the GeoDataFrame functions: intersects/contains work between GeoDataFrames instances. Let t be a GeoDataFrame with contents: id ...
0
votes
0answers
25 views

Re-Projecting lat and long in python Geopandas [closed]

I have a Polygon something like below. I'd to re-project using geopandas. But I got Polygon(inf, inf....). I think that I have something wrong in setting crs. What is correct crs.?
2
votes
1answer
36 views

Writing GeoPandas data frame to PostGIS?

Similar question has to this has been asked before Adding GeoPandas Dataframe to PostGIS table? I have followed the example but I am running into an issue I cannot solve. There is some geometry ...
0
votes
0answers
23 views

Join two lines based on closest distance in geoPandas [closed]

I have two shapefiles with both of them having a geometry of LineStrings. I would like to join them based on closest distance using geopandas, or any suitable tool in python3. I am trying to get the ...
0
votes
0answers
20 views

Loading spatialite tables into GeoPandas GeoDataFrame

Using information from here, I am trying to load a result of a SQL Python selection into a Geopandas geodataframe. I know pyspatialite is not longer maintained, so have tried using the dbapi2 module ...
4
votes
2answers
106 views

Geopandas and QGIS Calulating Different Polygon Area Values?

I am just trying to understand why Geopandas and QGIS might calculate areas differently despite using exactly the same shapefiles and exactly the same projections. Both shapefiles are using EPSG:...
0
votes
1answer
41 views

geopandas: “LineStrings must have at least 2 coordinate tuples” when reading gpx files

I am trying to use geopandas to read in some gpx files (generated from a Garmin vista HCX). For many gpx files, given this code: >>> import geopandas as gpd >>> data = gpd....
3
votes
1answer
35 views

Read N number of rows from shapefile using GeoPandas

Pandas has a parameter nrows for selecting how many rows will be read into the dataframe. Does GeoPandas have a similar parameter? Couldn't find in the documentation.
0
votes
1answer
34 views

Reading in AW3D30 GeoTIFF files and processing them in Python?

I am new to GIS processing, and I am using Python 3.6 to do so. My current task is to read in several files of geographic data (specifically tiles of elevation data from JAXA), combine them for my ...
1
vote
1answer
47 views

Performing sjoin on polygons and lines without intersection using GeoPandas?

I want to join a GeoDataFrame with Polygons (circular, were created from Points with buffer) with a GeoDataFrame that has Linestrings. These polygons and lines do not necessarily intersect nor ...
0
votes
1answer
34 views

Testing intersection between shapely object and geopandas GeoSeries?

This is a Python question, involving geopandas and the libraries it calls, primarily pandas and shapely. tl;dr: I am trying to run a test using if foo.intersects(bar): and am repeatedly getting one ...
3
votes
1answer
52 views

Re-project GeoJSON from pixel-space to lat-long in Python

I have created a GeoJSON of linestrings in pixel space using Python. However, I now need to re-project the file to match the same projections and extent of the .tiff file I wish to layer the GeoJSON ...
1
vote
1answer
35 views

GeoPandas does not identify points inside polygon

I am trying to intersect some points with a polygon in GeoPandas. First I create a Point GeoDataFrame from a text file. import geopandas as gp import numpy as np import pandas as pd from shapely....
0
votes
0answers
41 views

Opening geodata in GeoPandas?

I've downloaded some geodata but I'm unable to import it into GeoPandas. This is a sample of the geodata (I've trimmed the JSON object): {'displayFieldName': 'NAME', 'fieldAliases': {}, '...
2
votes
0answers
88 views

Rasterizing polygon grid in Python (geopandas & rasterio)

I am trying to rasterize a custom polygon grid with one or more columns. Preferably I'd like to create multiband rasters from multiple GeoDataFrame columns (in polygon grid), but I have got stuck even ...
0
votes
0answers
26 views

TypeError: object of type 'Polygon' has no len() - When trying to plot from a Dataframe

I need to create a LISA map for my work, and I am having problem when I'm trying to plot using geopandas. My data sources are: map_df # A Dataframe A geopandas series : hh = map_df.loc[(map_df['...
1
vote
0answers
55 views

Changing CRS of geometry in geopandas dataframe efficiently?

I have a shapefile which I am converting into a geopandas dataframe. The CRS of this shapefile is epsg:4326 and I want to convert this to epsg:3857. import geopandas as gp file_path = 'zip_poly.shp' ...
2
votes
1answer
42 views

Changing CRS in GeoPandas?

I'm trying to plot a bunch of points on a map of Britain and Ireland, and I've been using GeoPandas for that. I've basically just been following the tutorials to do that, and slicing a world map with ...
0
votes
0answers
44 views

Geopandas ImportError: DLL load failed (in pyviz tutorial geographic data examples) win7

I'm trying to run the geographic data examples from pyviz tutorial. I'm getting the error list in modules below. My Geopandas module work fine (and the others dependent modules) with 3.5 python ...
0
votes
2answers
50 views

Fiona and Geopandas not applying CRS to shapefile during creation

I'm trying to create a shapefile of points from a coordinate list. But, when I use fiona to create the shapefile Arc Catalog is showing that there is no CRS. I tried to add the CRS with Geopandas and ...
1
vote
2answers
69 views

Rounding coordinates to 5 decimals in GeoPandas?

I have a shapefile, which I converted into geopandas dataframe. I would like to round the coordinates to 5 decimals. Is there a method/function in geopandas that can do this? My shapefile contains ...
2
votes
0answers
51 views

Python Geopandas reading shapefile taking too long [closed]

I'm relatively new to Python and GIS. I am attempting to read in a 1.1 GB shapefile using geopandas. I let the code run for an hour and it is still not complete. Is this normal? How can I optimize ...
6
votes
1answer
172 views

Remove empty geometries from geodataframe

Since geopandas can't perform overlay/intersection with lines, I found a workaround: import geopandas as gpd import fiona from shapely.geometry import shape, MultiPolygon, LineString, MultiLineString ...
5
votes
1answer
93 views

Iterating features and buffering using GeoPandas?

I have a shapefile with many large polygons and would like to process each polygon individually because spatial operations on the entire dataset are too big for memory. For instance, iterate shapefile,...
1
vote
2answers
88 views

Plotting lon/lat point (without manual conversion) on XY map using GeoPandas?

I am data scientist not experienced in GIS and need to do some simple map plotting of the Netherlands. Using Geopandas everything works out nice and dandy for my purposes however I am stuck on 1 ...
2
votes
0answers
69 views

Intersecting shapefile/GeoDataFrame using Geopandas, shapely etc?

I'm currently transferring from ESRI to open source GIS by recreating basic ArcGIS tasks in Python, mainly using Geopandas since I have some experience with Pandas. Now I'm trying to intersect a ...
4
votes
1answer
72 views

Making Shapely box larger using GeoPandas?

I'm creating a box that covers the the area of a GeoPandas GeoDataFrame, so that I can use it as an inverted map to later cover up unwanted spill-over data. import geopandas as gpd import geoplot as ...
1
vote
1answer
64 views

Multiple shapefiles to one GeoPandas GeoDataFrame

I'm trying to vertically concatenate multiple shapefiles that reside in one directory, into one geodataframe. They all have the same table schema and same CRS. I am trying to use the code from this ...
3
votes
1answer
49 views

geopandas.intersects() over each row

In trying to answer Writing selected features to shapefile using OGR and Python? I ran into problems with geopandas.GeoSeries intersects methods. I have the following line and polygon: import pandas ...
1
vote
2answers
124 views

How to extract biggest Polygon from MultiPolygon in GeoPandas?

Given a Shapely MultiPolygon, how can I extract the biggest Polygon? For example, given a MultiPolygon as follows: from shapely.geometry import Polygon, MultiPolygon multipolygon = MultiPolygon([...
0
votes
2answers
86 views

How to inverse the orientation of the holes coordinates of a polygon in geopandas

I have a polygon shapefile which I am reading with geopandas. The polygon contains holes. My purpose is to add a random point inside each hole. In order to create the points inside the holes (...
0
votes
1answer
39 views

Equivalent method for .withcolumn() for geodataframe

I am trying to use a user-defined function in pyspark in order to check whether the points in CANmep_GDF lie within the polygons in gda_GDF. from geopandas import GeoDataFrame def check_exist(geom):...
0
votes
0answers
156 views

Smoothing shapefiles using Python

The purple is the original polygon to be smoothed and I would like to smooth the polygons as the red line using Python. I tried simplify but looks like I need a buffer and simplify the buffer. But I ...
0
votes
0answers
38 views

Locating observations that lies within a collection of Polygons (Python)

I'm trying to locate the observations that lie within a collection of Polygons but my current implementation takes forever, and I suspect that it is because the 'within' method needs to check all ...
0
votes
0answers
49 views

How to preserve the Multiploygons using Python?

I converted my input file with geometry Polygon 25D to an output file with geometry Polygon using the below code. As you can see the below image. Problem is that the holes in the polygon is vanished ...
0
votes
1answer
263 views

Python geopandas dataframe of polygons — determine nearest neighbor polygon?

I am trying to figure out how to dynamically create expanded regions of interest based on polygon geometries in geopandas until some threshold is satisfied (essentially custom regions across the ...
1
vote
1answer
213 views

Renaming columns using geopandas - issues with data table in Arc

What I'm trying to achieve: Read in an existing ESRI polygon shapefile Drop an attribute Dissolve by another attribute Rename columns Reorder columns Write out as new shapefile What works: Drop ...
0
votes
0answers
22 views

How can I group the geodataframe on the basis of the column

I have a geodataframe that has a ununique column(text) and polygon geometry for each row. How can I group the gdf on the basis of the column? gathering and converting polygons to multipolygon I think ...
0
votes
0answers
73 views

Geopandas Mollweide projection

I´ve a .gpkg file in Mollweide projection. When I open it in geopandas, it shows me the correct crs information: df1.crs {'init': 'epsg:54009'} I´d like to re-project it to EPSG 4326, in a way to ...
0
votes
1answer
105 views

Convert CRS for spatial join for GeoDataFrame

I have the following 2 GeoDataFrame variables in GeoPandas. # shp.csr {'init': 'epsg:2953'} # line.csr {'proj': 'sterea', 'lat_0': 46.5, 'lon_0': -66.5, 'k': 0.999912, 'x_0': 2500000, 'y_0': ...
0
votes
0answers
64 views

Geodataframe not plotting properly in geopandas

I am playing around with the gdf.plot method which is supposed to facilitate plotting geodataframes using geopandas. The reason is that I would like to avoid jumping from QGIS to python while ...
0
votes
0answers
53 views

Different values between original raster and cropped raster with rasterio.mask

I have a large sentinel-2 image and I want to clip it according polygons which are stored in a geojson file. My code is: df = gpd.read_file(os.path.join(geojson_folder,geojson_file)) df.head() ...
1
vote
0answers
176 views

Error in reproject vector file using GeoPandas

I have a vector file (in this case shp file) and I read it with GeoPandas (gpd). vector_folder = r'C:\poly' vector_file = 'poly.shp' df = gpd.read_file(os.path.join(vector_folder,vector_file)) df ...
0
votes
1answer
115 views

Spatial overlays : Union between multiline and multipolygon with geopandas

I try to overlays (apply union) my multipolygon on the multiline with GeoPandas, but it seem like the GeoPandas overlay function work only with (Multi)polygon. Is there any way to make that with ...
1
vote
0answers
305 views

Calculating distance between point and MultiPolygon Geoseries object in Python [closed]

I want to calculate the distance of a point from the Multiploygon geoseries object created using cascaded_union function of GeoPandas. Following is my code: import numpy as np import pandas as pd ...