Questions tagged [fiona]
Fiona is OGR's new, neat, Pythonic API
285
questions
0
votes
0
answers
31
views
Read GeoPackage with geopandas
I develop an import system that supports popular geoformats.
Sometimes I get a DriverError reading GeoPackage files with geopandas, but at times it works well.
My code is simple:
gdf = gpd.read_file(...
0
votes
1
answer
24
views
WFS output limited to 1000
I use WFS quite a lot to collect my data with the script below. It works most of the time, but I notice that some of the WFS-services I come across have a limited output, as only 1000 records are ...
1
vote
1
answer
66
views
Measure distance between points in python
I am trying to determine a rough distance between points in my shapefile.
The shapefile I am working with has 28 million points in the structure x y z.
I am hoping to find the most common distance ...
1
vote
0
answers
72
views
Import Errors: fiona and gdal
I can neither import fiona nor gdal.
I installed the following Python version:
Python 3.9.4 (tags/v3.9.4:1f2e308, Apr 6 2021, 13:40:21) [MSC v.1928 64 bit (AMD64)]
Furthermore I installed the ...
2
votes
0
answers
30
views
Can GDAL read/write Geopackage on RAM instead of disk?
I am working on a Python project that makes extensive use of GDAL's Geopackage vector and raster drivers. Since geopackage is essentially SQLite, I also use the Python SQLite library to do lots of ...
1
vote
2
answers
105
views
Python error handling opening a shapefile with fiona
I've written a python script where I read a bunch of files trying to catch various errors (FileNotFound, Import), for example
try:
df = pd.read_excel(os.path.join(path_to_data, fname_data))
except ...
0
votes
0
answers
70
views
Clip data while reading file into Python with GeoPandas
Geopandas is able to read in only part of a file using:
roi= geopandas.GeoDataFrame(geometry)
indexed_data = geopandas.read_file("path-to-file", mask=roi)
or
geopandas.read_file("path-...
0
votes
1
answer
217
views
Specific WFS error - Fiona: fiona.errors.DriverError: '/vsimem/4ec3f86c094340cc8704fe5b9aa0f517
I am trying to receive some data through several WFS servers. While two work with my code, one gives an error. I don't have enough experience with WFS to see how this one is different from the others.
...
1
vote
0
answers
242
views
Problem exporting geodataframe to Esri shapefile having datetime field using Geopandas
I had a geodataframe having 4 columns (viz. name, time, description, geometry fiels). I am trying to export the geodataframe to ESRI Shapefile but it is throwing following error:
DriverSupportError: ...
0
votes
0
answers
43
views
Error installing GeoPandas, Fiona [duplicate]
I have been trying to install GeoPandas on my Mac and every time I run pip3 install geopandas I am met with this block of errors:
Collecting geopandas
Using cached geopandas-0.10.2-py2.py3-none-any....
0
votes
0
answers
50
views
Storing Metadata in GeoPackage using GeoPandas or Fiona
I would like to store some metadata in a GeoPackage file. The metadata would be relevant to the entire file, not just to each individual geometry. An example might be assigning license text or ...
1
vote
1
answer
625
views
Error when viewing GeoDataFrame in GeoPandas: "OSError: exception: access violation reading 0x0000000000000000"
When running the following script
import fiona
import geopandas as gpd
data = gpd.read_file(r"C:\data.shp")
data.head()
I receive the following error
Access violation - no RTTI data!
...
0
votes
1
answer
86
views
Raster into PolyLine with Python
I have got a binary raster and I want to create a shapefile with PolyLines based on this raster. The only success I achieved is a shapefile with Polygone geometry (below). I did it with rasterio and ...
0
votes
0
answers
35
views
Can't install Fiona in OSGeo4W Shell on Windows 10
When trying to install "Fiona‑1.8.20‑cp39‑cp39‑win_amd64.whl" in the OSGeo4W Shell I get the following errors:
extensions/gdal_wrap.cpp(3198): fatal error C1083: Datei (Include) kann nicht ...
1
vote
1
answer
42
views
Why is fiona not writing these records?
I'm running through a UTM grid in geojson format with fiona, attempting to add/populate a field based on other field values and then write out to a new file. It appears to successfully build the ...
0
votes
1
answer
37
views
When using Fiona, DBF missing headers when no records provided
I'm creating a Esri Shapefile using Fiona. If I don't add any records, the dbf created by Fiona does not include the headers defined by the schema. My customers claim that results in an invalid ...
0
votes
0
answers
68
views
Fiona schema property name length
Is it possible to increase property name length in schema?
If I define schema like this:
my_schema = { 'geometry': 'Point',
'properties': {'Here is very long property name': 'float:12.3'}
And in ...
3
votes
1
answer
555
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
1
answer
207
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 ...
1
vote
2
answers
545
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 ...
1
vote
0
answers
244
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
0
answers
324
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
1
answer
32
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
2
answers
149
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
0
answers
72
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
1
answer
39
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
0
answers
223
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
1
answer
220
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 ...
2
votes
1
answer
219
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
0
answers
214
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
2
answers
554
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
0
answers
214
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
0
answers
331
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
1
answer
307
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
1
answer
293
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
0
answers
263
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
1
answer
139
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 ...
0
votes
2
answers
583
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
2
answers
755
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
0
answers
179
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
2
answers
501
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
1
answer
37
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 "...
2
votes
0
answers
148
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
1
answer
535
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 ...
3
votes
2
answers
418
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):
""&...
4
votes
0
answers
143
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
1
answer
650
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
0
answers
627
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
1
answer
321
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
2
answers
116
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,
...