Questions tagged [geopandas]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
8 views

zonal_stats results misaligned

I am trying to clip a raster file with a shapefile using zonal_stats. The obtained clipped raster however does not follow the polygon in the shapefile and the clipped raster covers more area than the ...
1
vote
1answer
23 views

GeoPandas gdf.geometry.buffer for spatial join

In that part of the code I'm creating geodataframes (only point features) out of two CSV files. I want to merge all points from the two dataframes within a range of 150m. Therefore I create a buffer ...
0
votes
0answers
24 views

Extract images and audio from GDB? [closed]

Is there a way using any library different to ArcPy for extract information in GDB? I have found the way to extract data information but not yet image and audio. I have used this code: import fiona ...
2
votes
0answers
18 views

Insert Dataframe data into a map using Geopandas

I posted my question in stackoverflow previously, howeverI think this site is a better place to find some clues (this is my first project with spacial data). I need to insert some coordinates from a ...
0
votes
0answers
17 views

Loop the shapefiles by getting the count of field except null values and to write csv file to it in Python [closed]

To loop the shapefiles from a folder To get the count of a field except null values(of the shapefiles from a folder) To write a csv including 2 columns i.e, i) Shapefile Name(of Step 1) ii) Field ...
0
votes
0answers
28 views

Plot GIS polar data on BlueMarble in Python

This is my first time working with GIS data and I would like to plot ice sheet extent on a world map with backround centered on the pole. The shapefile I'm using can be downloaded here: ftp://sidads....
1
vote
0answers
45 views

GeoPandas and Fiona fail to run on Windows

I am using Python 3.7.1 on Windows 8.1. It seems like I have installed geopandas and fiona using .whl-files. Fiona-1.8.13-cp37-cp37m-win_amd64.whl geopandas-0.7.0-py3-none-any.whl import ...
3
votes
1answer
34 views

Remove polygon overlap based on id in Python

I have a Shapefile consists of multiple polygons, where I want to erase the overlap based on the id. An example to visualize the problem: import geopandas as gpd from shapely.geometry import ...
1
vote
1answer
30 views

Cannot open zip, compressed, file on external drive with GeoPandas or Fiona, it opens on C drive [closed]

I am working with Windows 10 and GeoPandas version '0.4.1' which utilizes Fiona version '1.8.11' I am trying to open a shapefile from a compressed folder (as described here https://geopandas.org/io....
1
vote
0answers
27 views

GeoPandas and CRS: different units [closed]

I am trying to write a function that takes as input two files: A Shapefile of a region of interest, A CSV file containing columns with latitudes and longitudes for the stations of interest. The ...
1
vote
0answers
37 views

Changing CRS of GeoJSON

I'm trying to change the CRS of a dataset loaded from GeoJSON. input: { "type": "FeatureCollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:OGC:1.3:CRS84" } }, "features":...
0
votes
1answer
16 views

Showing only the external boundary of a GeoPandas DataFrame

I have a GeoPandas DataFrame I collected from a shapefile. The shapefile is the Mexico City boundary from here import geopandas as gpd gdf = gpd.read_file(fname) gdf.plot() I would like to create a ...
1
vote
0answers
44 views

Error importing GeoPandas

I have a problem trying to import GeoPandas. Since it was impossible to install the package in the normal channels within Anaconda, because of possible incompatibility with other spatial packages, I ...
1
vote
3answers
43 views

Convert list of coordinates to LineString within a dataframe

I have a dataframe where one of the columns contains a list of x and y points and I would like to convert it to a spatial data frame but I am having trouble and not sure what to try next. My data ...
1
vote
1answer
36 views

Pandas to GeoPandas : Polygon Geometry, WKTReadingError

I read a PostGIS table with pandas : df = pd.read_sql_table(con=engine, table_name) The column geom contains the geometry of my entity, it is a polygon geometry. I want to convert the DataFrame to a ...
2
votes
1answer
80 views

Error when converting a pandas DataFrame to a GeoDataFrame

I can't figure out how to convert a pandas DataFrame to a GeoDataFrame. Here is an example of what my data looks like using df.head(): crash_date. crash_time latitude longitude ...
2
votes
1answer
52 views

Geopandas (points) to Numpy Array

I have a geopackage with a point feature. Which contains points along 19 lines. So, the number of points per line is exactly the same. Therefore, I could see it as a matrix in numpy. Moreover, each ...
4
votes
1answer
73 views

Read pixel values of a raster image for given coordinates stored in a CSV file

I was trying to find the pixel values of several pixels whose coordinates are known. I did that in this way: import rasterio lons = [66.979, 69.2979, 67.2979 ] lats = [36.5854, 40.9854, 37.9854] ...
1
vote
1answer
50 views

Saving a shapefile to an output file path in my function(which the user will provide)?

I have a function which takes the coordinate argument from the user and converts it to a shapefile, and finally saves that shapefile to the filepath that the user gives. This is the code... epsg_code ...
1
vote
1answer
51 views

Projecting from Lambert azimuthal equal area (LAEA) projection to WGS84 without distortion

I need to convert a shapefile from Lambert Azimuthal Equal Area projection system (North Pole) to WGS84. When I use QGIS to do this, the lines that cross the anti-meridian cross over (horizontal black ...
1
vote
0answers
28 views

Write GeoPandas df to PostGIS - Linestring Z geometry

I am trying to write a geodataframe with Linestring Z geometry to a PostGIS table. This rise the error: ProgrammingError: (psycopg2.ProgrammingError) can't adapt type 'LineString' [SQL: INSERT INTO ...
1
vote
0answers
30 views

Failure to write LineString record to shapefile

I have some coordinates from which I am creating a shapefile. tafo_boundary_coords = [(652316, 742792), (652161, 742920), (651897, 743166), (652210, 743477), (652298, 743448),(652375, 743458), (...
2
votes
1answer
66 views

Finding zipcodes within line using GeoPandas [closed]

I have a shapefile of Houston zip codes and gdb folder of lines (within Houston). The lines are in a gdb folder containing over 125 files. The types of files included in this folder are GDBINDEXES, ...
3
votes
1answer
60 views

Missing columns opening GDB with GeoPandas/Fiona

I am trying to import a GDB file database table and convert it to a (Pandas) dataframe. I have been trying to do so using GeoPandas and Fiona. The problem is however that not all columns are being ...
4
votes
1answer
82 views

What is the area of my shapes?

I created overlapping geometries and I would like to know the area of the intersection. import geopandas as gpd from shapely.geometry import Polygon polys1 = gpd.GeoSeries([Polygon([(0,0), (0,1), (1,...
1
vote
1answer
48 views

Using GeoPandas to convert Linestring UTM data to LatLong

I have a few shapely.linestring objects that are read into geopandas with the call: piped = gpd.read_file("Pipes.dbf") In the geometry column the values are in UTM. I have identified the sector as ...
2
votes
1answer
48 views

Python clipping large shapefile by radius [closed]

I cannot find any real answer so I'd like to ask how to crop shapefile with roads in Python. The goal is to leave roads (nodes) in black circle only, then output that to dataframe in geopandas (...
1
vote
1answer
35 views

Drawing a directed line based on dataframe indexes?

I trying to draw a directed graph based on a geopandas dataframe with the Cartoframe library. The Geopandas dataframe has the following structure: deviceId routeLoad longitude latitude ...
3
votes
1answer
87 views

In to_crs of GeoPandas, init proj4 string works, but new style doesn't

I wanted to unify crs into WGS 84, so based on "Manually specifying the CRS" I tried gdf.to_crs('epsg:4326'), but error occurs. I want to know why the old proj4 style gdf.to_crs({'init':'epsg:4326'}) ...
3
votes
1answer
51 views

Extract polygon names from external points: Extremely slow

I have a text file including geolocation points. I have a shapefile containing polygons and name of polygons. For each point, I have to extract the name of polygon if the polygon contains the point. ...
0
votes
1answer
51 views

Create polygons from points with rectangular buffer in Python [closed]

I want to create rectangular polygons from points. Actually I have a GeoPandas point DataFrame and the distance in X & Y direction to form the polygon. The distances are equal for every point. I ...
2
votes
1answer
61 views

How do I correctly reproject a geodataframe with multiple geometry columns?

In the geopandas documentation it says that A GeoDataFrame may also contain other columns with geometrical (shapely) objects, but only one column can be the active geometry at a time. To change ...
1
vote
0answers
29 views

Viewing GeoPandas Dataframe in VScode or PyCharm like Pandas Dataframes

I'm not sure if this is a missing feature or something that I couldn't figure out so I wanted to get some help; I started learning geopandas library, now I'm following some tutorials I realized that ...
1
vote
1answer
59 views

Creating a shapefile from a numpy array

I was following this tutorial: http://www.acgeospatial.co.uk/k-means-sentinel-2-python/ on how to generate an unsupervised classification for sentinel-2 images. img_ds = gdal.Open('data/products/...
2
votes
0answers
43 views

Geopandas shows points outside of buffer geometry, even though they are in

I have some ship trajectories and I want to know which point of the trajectory is inside the port(=buffer) and which points are outside. The following picture shows my Geopandas Dataframe with the ...
0
votes
1answer
36 views

Difference in length of lines computed with GeoPandas or in QGIS [duplicate]

So, first of all, here is a test file: https://we.tl/t-xqo5KyRlqD The column length was added using QGIS (v 3.10 A Coruña), field calculator and adding parameter $length. If the file is opened with ...
1
vote
1answer
61 views

Getting geometry column integer SRID from a GeoPandas geodataframe?

The primary answer to Adding GeoPandas Dataframe to PostGIS table? requires entering the geodataframe geometry column's integer SRID. Getting the CRS attribute using the crs attribute like so import ...
1
vote
1answer
23 views

Aggregate data from source value to mask layer by overlapping area

Let's assume I have a georeferenced data set seed_layer.geojson and a mask layer leech_layer.geojson. test_leech.geojson: { "type": "FeatureCollection", "features": [ { "type": "Feature", "...
3
votes
0answers
55 views

OSError - cannot import geopandas

While trying to import geopandas error occurs: Exception has occurred: OSError Could not find lib geos_c.dll or load any of its variants []. I downloaded GDAL and fiona for Python 3.7 from this ...
1
vote
1answer
50 views

Combine multiple polygons into a single one (with holes)

I have the following GeoDataFrame with multiple polygons which represents a single area (raster_val = 1.0) with holes in the middle (raster_val = NaN): geometry ...
3
votes
1answer
68 views

What is the correct way to assign GeoPandas a CRS from Rasterio?

I'd like to be able to create a new GeoPandas object and inherit the CRS from Rasterio, and save a shapefile. The current projection format is seen as invalid when writing an ESRI driver. From here, ...
2
votes
0answers
133 views

Find spatial and temporal variability from a GeoPandas dataframe of polygons

I have a geopandas dataframe of polygons (all rectangles ~100mx120m) and each of these polygons has an attribute for time and % ice coverage. This is all derived from imagery I collected in the ...
1
vote
1answer
19 views

Specify a fields datatype while creating a new field in geodataframe with expression?

I would like to know how to set the field type of ['denominator'] in a geodataframe manually in this expression to "String": geo_df['denominator'] = df[["basalareap","basalareas","basalaread"]].sum(...
0
votes
2answers
128 views

Given list of points (lat, long), how to find all points within radius of a given point [closed]

It's my first time working with GIS. I really wish I could share some code, but I don't even know how and where to begin. I have a Pandas dataframe with around 10,000 records. Each of them have a ...
2
votes
0answers
36 views

Calling geopackage in a loop, “database is locked” error

I try to loop through a folder containing multiple geodatabases (12). After performing some calculation I try to save the results in a new shapefile located in another folder, but the code generates ...
0
votes
1answer
81 views

Convert GeoDataframe to Raster [closed]

I want to convert a GeoPandas GeoDataframe to raster (.tif). I have multiple attributes in my GeoDataframe and want to create a raster using a single field from the attribute table. The underlying ...
3
votes
1answer
71 views

Merge overlapping/neighboring polygons - GeoPandas

I am reading a shapefile and I have extracted a specific row from it that is a Multipolygon. I can extract all the polygons in it with .explode() which works great and I get 130+ polygons. How can I ...
2
votes
1answer
84 views

Merging a geodataframe and pandas dataframe based on a column

I have a simple geopandas dataframe that includes geometry and a column called 'MUKEY': merged_spatial_df.head() I want to merge it to a tabular (.csv) pandas dataframe (which also has a column ...
2
votes
1answer
104 views

Converting xy point to lat/long

I have data with columns x,y, address. And no any information about the projection of x,y points. How can I convert these points to correct lat/long pairs? 1091969,199515,27 HEDGEWAY CT 1092046,...
2
votes
1answer
253 views

Constant future warnings with new pyproj

When I work with different CRS in GeoPandas, pyproj module always fires many FutureWarnings. /home/culebron/.local/lib/python3.7/site-packages/pyproj/crs.py:77: FutureWarning: '+init=<authority>...

1
2 3 4 5
12