Questions tagged [fiona]

Fiona is OGR's new, neat, Pythonic API

Filter by
Sorted by
Tagged with
3
votes
1answer
176 views

Opening DGN using Python

I'm trying to open a DGN file with Python. I've tried with OGR: driver = ogr.GetDriverByName("DGN") file = driver.Open("C:\path_to_dgn\example.dgn") which returns a NoneType ...
4
votes
1answer
58 views

Including metadata in GeoPackage file written using GeoPandas/Fiona

I have a Geopandas GeoDataFrame with a couple of categorical columns that I want to write to a GeoPackage file. GeoPandas/Fiona/GeoPackage does not support categorical columns directly, so I'm ...
0
votes
2answers
110 views

Listing every layer in Geopackage using Fiona [duplicate]

I loaded a GeoPackage into Python and I can't figure out how to list all the layers in the file. How do I do that? Input: GeoPackage loaded into Python. Desired output: A list of the layers in the ...
0
votes
0answers
49 views

Writing properties corresponding to a given schema within the GeoDataFrame.to_file() method?

I currently have the following code to write a multipolygon Shapely feature to a GeoPackage: import fiona myschema = {'geometry': 'MultiPolygon', 'properties': {'id': 'int'}} with fiona.open( '/...
1
vote
0answers
123 views

Pyinstaller .EXE AttributeError: partially initialized module 'fiona' has no attribute '_loading' (most likely due to a circular import)

I am trying to create a geospatial Python GUI app using PyQT5, Geopandas, OSMnX, and Folium. I am converting the app into an .EXE file using pyinstaller. Previously, I was successfully able to create ...
2
votes
1answer
30 views

A raster clipping script does not produce output

I am using the following code to first divide a vector layer to many polygons and after that use them for clipping parts of a raster layer. It successfully split the vector layer to many polygons, but ...
3
votes
2answers
80 views

Raster clipping from many polygons: 'error: NoneType' object is not subscriptable

I am using the following code to first divide a vector layer to many polygons and after that use them to clipping parts of a raster layer. The Name attribute in the vector data has a text data type. I ...
1
vote
0answers
32 views

Split Raster into Tiles - Set Extent

I am using this questions solution to split a raster I have into 1500x1500 tiles. The code works. I have recently been trying to figure out how to set the starting and ending points of the raster ...
1
vote
1answer
28 views

GDAL extracted EPSG not compatible with Fiona

I am creating Shapefiles from features extracted from JP2 images in python. My current method of creating Shapefiles by extracting the EPSG from the source image with GDAL and using Fiona is as below ...
0
votes
0answers
47 views

Fiona Saving Gives DriverIOError

I have a script that I used before to clip polygons. I modified it a touch to use in another place, but am running into a fiona.errors.DriverIOError. As far as I can tell, all the code is working ...
1
vote
1answer
44 views

Setting CRS with EPSG code when writting shapefile with Fiona

How to set the CRS when writing an ESRI Shapefile using Fiona on a modern Python version (>3.x)? Why "modern"? Because Python 2 is now deprecated and this user asked a similar question ...
1
vote
1answer
57 views

Efficient way to get the geocoordinates of all the intersections in a city (using GeoPandas / Shapely / Fiona)?

Given a dataset of roads for a city, represented as LineStrings and loaded into GeoPandas, what is an efficient, built-in-way to get the geocoordinates of all the intersections, using GeoPandas or ...
2
votes
1answer
120 views

Dissolving polygons based on polygon attribute values in Python

I have a shapefile, with multiple features inside. I am trying to dissolve the nearby/adjacent features based on the shapefile particular attribute value (gridcode), but the difference shouldn't be ...
2
votes
0answers
88 views

Filtering records in GeoPackage file by numeric/text fields using GeoPandas/Fiona

I have a GPKG file of 46M records and 6.5GB filesize, and need to open about 300 records, where fieldX = Y (Y may change). Opening the entire file would cause memory overflow, while processing the ...
5
votes
2answers
253 views

How to write attribute-only tables in Geopackages with GeoPandas

I searched around and found similar questions (Writing Non Spatial Table into Geopackage - Python), but that discussion is on a slightly different topic. Is there a way to write attribute-only tables ...
1
vote
0answers
101 views

Extend the contours of the polygon into a polygon

I would like to be able to extend the vertices of one polygon to the edge of another polygon, how does the snapping between poligons using python. The photo shows a representation of my problem. I ...
2
votes
0answers
53 views

Converting GeoJSON to shapefile in Python with Fiona: problem with Geometry Collection

I have a function, using the Fiona package, to convert a GeoJSON to their respective shapefiles (going to figure out later to get merge them back together later on) However the problem is the GeoJSON, ...
1
vote
1answer
67 views

How to find geometries of all intersections in a polygon and calculate their areas and perimeters using shapely and fiona?

I am able to open the shapefile and convert it into a shapely polygon but I am struggling with the logic required to isolate intersecting polygons and calculate their areas and perimeter. from shapely....
2
votes
1answer
193 views

FionaDeprecationWarning: Collection.__next__() is buggy and will be removed in Fiona 2.0. Switch to `next(iter(collection))`. record = next(c)

I have some Python3 code used to import shapefiles using fiona. This is the main set of lines: I created some code (Python3) with these lines: c = fiona.open(dataDir + "/" + sourceFile, ...
3
votes
0answers
139 views

Flatten API JSON response containing nested structures including a GeoJSON to a GeoDataFrame while keeping the GeoJSON geometry as is

TL;DR: I have a JSON response from an API that I'd like to convert to a GeoDataFrame. But some of the attributes in the response structure are nested dictionaries, including a GeoJSON object and if I ...
0
votes
1answer
70 views

How to open a GMLAS layer in Fiona or GeoPandas

I want to open a GMLAS layer. When I open the file with: ogrinfo -ro GMLAS:D:\path\to\file.gml Output: INFO: Open of 'GMLAS:D:\path\to\file.gml' using driver 'GMLAS' successful. ... 15: roofsurface ...
1
vote
2answers
262 views

Obtain Polygon Extent with Multiple Polygons within Shapefile

I have a shapefile that contains multiple polygons. I would like to extract the extent of each of those polygons within that shapefile. The majority of answers that I have been able to find use arcpy ...
1
vote
2answers
321 views

Reading GDB file with GeoPandas throws MemoryError

I have a gdb file that's 32GB and I'm tasked with extracting the attribute values from each of the layers and converting them to CSV for analysis. Here's my code: import geopandas as gpd import fiona ...
2
votes
0answers
98 views

Clipping multiple raster with multiple shapefiles in Python

I am trying to adopt existing code for clipping multiple rasters with multiple polygons based on this link: Subsetting multiple rasters with multiple shapefiles using Python I added the following ...
0
votes
2answers
204 views

Polygon geometry verify using Python

I wonder if it is possible to check the geometry of multiple polygons using Fiona or shapely library In Python. Whichever polygon does have proper geometry will be kept and the rest will be deleted ...
0
votes
1answer
31 views

Match a list of shapefile names to list of raster names then do something

I have a list of shapefiles and a list of rasters that I would like to match the names then do some data extraction for later analysis. The beginning of each raster and shapefile begins with "...
1
vote
0answers
75 views

Opening gkpg in geopandas throws: UnsupportedGeometryTypeError: 12

I wanted to open a gkpg file in geopandas 0.8.2, on windows, using conda mith channel conda-forge obj = r'path.gpkg' layer="layername" gdf = gpd.read_file(obj, layer=layer) Throws the ...
0
votes
1answer
219 views

Load a shapefile into geopandas from a request.files

I'm trying to receive a simple .shp file, without been zipped, via web request and convert it to a geopandas dataframe. I tried to use io.BytesIO to wrap the file but also didn't worked.. I tried to ...
0
votes
0answers
66 views

Reading text-anchor and text-angle from DXF using geopandas -> fiona -> gdal

I am working on a Pyhton desktop app that publishes CAD-files (dxf) to Postgresql/ GeoServer. It uses geopandas to import the dxf-file. The resulting geodataframe doesn't contain the anchorpoint and ...
0
votes
0answers
113 views

Clipping ENVI files loses information in header (.hdr) file

I have created a command-line operated python-script to cut AVIRIS imagery with polygons. I do this by using rasterio to load the imagery and fiona to load the polygon. The AVIRIS imagery comes in two ...
3
votes
2answers
226 views

Cannot write int value into a Geopandas GeoDataFrame

description of the problem I'm writting a function to simplify my use of rasterstat. def zonal_stat(src_rst, mask_vector, out_vector, measurments=available_stats[:4], verbose=False): ""&...
3
votes
0answers
102 views

Inconsistently getting "Input shapes do not overlap raster", CRS appear to match

Masking topographic raster data by a shapefile (bedrock geology polygon). Following this guide I do this: with fiona.open("geology.shp", "r") as shapefile: geology_mask = [...
2
votes
1answer
342 views

Problem with using Fiona to write out GeoJSON objects to GeoPackage layers

I'm attempting to use fiona to write out a number of GeoJSON objects to different layers in a single GeoPackage. Here's an example json.dumps() representation of the GeoJSON object containing one ...
1
vote
0answers
435 views

Extract one geometry type from GML file in GeoPandas

I try to use GML data from Landesvermessung Brandenburg in GeoPandas. It generally works to load files like this: df = gpd.read_file(r'/vsizip//vsicurl/https://data.geobasis-bb.de/geobasis/daten/...
1
vote
1answer
183 views

PermissionError when trying to load the layers in an ESRI File Geodatabase

I am trying to list the layers of a file geodatabase using fiona. I would like to then pick a layer and use geopandas to extract the layer as a geodataframe: import fiona layers = fiona.listlayers(r'...
1
vote
2answers
85 views

What coordinate system is this? How can I project it to WGS84 (lat-long) system in Python?

I had an AutoCAD drawing of a floor plan. I imported it to python using Fiona and checked the metadata. The CRS is empty. When I checked the coordinates for the geometry, it was in the following form, ...
1
vote
1answer
40 views

Determining driver, spatial reference and other props from an open GDAL layer

I have a very large network share full of data (raster, vector, sometimes mixed inside of geopackage and/or file geodatabase containers). I have a set of classes that crawl through it all and use ...
3
votes
2answers
94 views

Performance regression: fiona.transform much slower since GDAL 3

I have run into some severe performance degradation when upgrading an environment to GDAL3. I could track the issue down to fiona.transform, which is a lot slower (about 15 (!) times) now than it was ...
0
votes
1answer
336 views

valuerror : Null Layer

I am trying to open a geodatabase file and getting error message ValuError : Null Layer. I am using geopandas.read_file. import geopandas as gpd gdp.read_file("AL_ALFL_conf_final.gdb") I ...
1
vote
0answers
88 views

Open only part of a GeoPackage layer with a certain geometry type in GeoPandas

I have a GeoPackage (743 MB, zipped) that has one layer, but two geometry types inside that layer (Point and Polygon). When I open the file in QGIS 3.10, QGIS presents a dialogue to me that lets me ...
1
vote
1answer
445 views

Spatial join list lat,lon and multipolygon Python

I have a dataframe with lat, lon columns in WGS84. I also have a multipolygon layer (GeoJSON, I can also convert it to a SHP) with all countries' boundaries, where the name of the country is in the ...
0
votes
0answers
79 views

Saving a file consisting of two layers

I have a geopandas dataframes (A) and (B). I wanted to save them into disk using a same file but with two different layers. I knew to save one dataframe as follows: A.to_file('out.kml', layer='A', ...
2
votes
1answer
193 views

Difference in geometries of shapefiles

I have the geometry of the outline region as part of one shapefile (which is only one feature and there are other features in it apart from this). Other polygon regions' boundaries which are colored ...
1
vote
1answer
89 views

Unpack error occuring when sampling raster values to points with rasterio

I'm new to Python. I'm trying to sample raster values to points based on the geometries of a shapefile using the below code but I'm receiving the below error . import fiona import rasterio as rio ...
0
votes
1answer
314 views

Select only raster overlapping shape files using Rasterio

I'm cutting out several polygons from different rasters using the IDs of a shapefile and I would like the images to be just those polygons that overlap the raster without saving the empty images. ...
2
votes
0answers
219 views

How to write to geopandas dataframe directly to (Google) Cloud Storage?

I would like to write a geopandas.Dataframe directly to (Google) cloud storage, from the documentation fiona enables this, however I am not sure how to supply the correct **kwargs for the geopandas....
0
votes
1answer
40 views

Computing linestring between two different point shapefiles

I have two point shapefile representing towns within a state and I want find the distance between them. Since the points are in different shapefiles, should I merge them so they would be in the same ...
0
votes
1answer
51 views

Errors relating to merging point shapefiles

I have created two different point shapefiles which represent towns within a state. However I want to know the distance between both towns, but first I want to draw a line between them. Is this ...
-1
votes
1answer
84 views

How to add a geocode in long,lat instead of lat,long [closed]

I am a bit confused. I am trying to geocode coordinates of a point shapefile, but in long lat instead of lat long and add the address to a new shapefile. Any ideas? import fiona from geopy.geocoders ...
0
votes
0answers
20 views

how to output convex_hull polygon of points shapefile [duplicate]

i have a shapefile of more than 8 points and i have written a code get the convex_hull geometry of of the points and output it as a shapefile using fiona. however the code returns an error saying: ...

1
2 3 4 5 6