Questions tagged [fiona]

Fiona is OGR's new, neat, Pythonic API

Filter by
Sorted by
Tagged with
0 votes
1 answer
38 views

GeoPandas - can't write to file because field names are tuples (AttributeError)

I have created a new shapefile by dissolving and computing centroids from an existing shapefile. I have also aggregated values of the existing shapefile to use in the new shapefile. However, when I ...
0 votes
1 answer
40 views

Why do we need to specify a format driver with fiona?

What are format drivers for? For example why is this necessary: with fiona.open(save_file, "w", driver="ESRI Shapefile", schema=schema) as c: Shouldn't it just be able to ...
  • 325
0 votes
0 answers
59 views

Cannot read SHP polygon using Geopandas [duplicate]

I am trying to read ESRI SHP Polygon using geopandas: polygon=gpd.read_file(r'Path.shp', encoding='utf-8', driver='ESRI Shapefile') But I am getting this error: NotImplementedError: A polygon does ...
1 vote
0 answers
18 views

Creating branched linestring [closed]

I have a shapefile where a cable consists of multiple parts. In the example below the highlighted cable consists of three parts. I have exported the attribute table and am trying to write a Python ...
1 vote
1 answer
310 views

Trying to convert GeoPandas Dataframe with date to ESRI Shapefile

Created a GeoPandas dataframe from an excel sheet. The schema for the dataframe is: {'geometry': 'Point', 'properties': OrderedDict([ ... ('DISTID', 'int'), ('...
2 votes
1 answer
250 views

Finding distance between points using Python

I have a shapefile containing 10 test points like so: The spatial reference is 2157 - Irish Transverse Mercator I am wanting to find the distance between each point in Python. Ideally, something like ...
4 votes
1 answer
198 views

Read xml with CurvePolygon with Geopandas / Fiona

I am trying to use the Dutch BGT Api via https://api.pdok.nl/lv/bgt/download/v1_0/ui/ with the following code: # Native import requests from requests.structures import CaseInsensitiveDict import json ...
  • 135
1 vote
0 answers
34 views

Calculation of the greatest fall in the river [closed]

I have a task to write a Python program using the 'gdal', 'geopandas', 'reasterio' and 'fiona' libraries. This program is to calculate the greatest fall in the river (height difference between the ...
  • 11
2 votes
1 answer
627 views

DriverError when reading 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(...
1 vote
1 answer
165 views

How to get all records if 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 ...
  • 45
1 vote
1 answer
471 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
1k 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 ...
  • 11
2 votes
0 answers
153 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
1k 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 ...
  • 113
0 votes
1 answer
241 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-...
  • 71
0 votes
1 answer
1k 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. ...
  • 45
1 vote
1 answer
951 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: ...
  • 576
0 votes
0 answers
62 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
155 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
2 answers
1k 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! ...
  • 31
0 votes
0 answers
66 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 ...
  • 29
1 vote
1 answer
109 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 ...
  • 1,377
0 votes
1 answer
63 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
163 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
1k 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 ...
  • 33
4 votes
1 answer
451 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 ...
2 votes
2 answers
1k 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 ...
  • 55
3 votes
0 answers
553 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( '/...
  • 7,727
1 vote
0 answers
477 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
38 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 ...
  • 206
3 votes
2 answers
238 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 ...
  • 206
2 votes
0 answers
194 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,087
1 vote
1 answer
148 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
500 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,087
1 vote
1 answer
713 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 ...
  • 7,727
2 votes
1 answer
349 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 ...
  • 29
2 votes
0 answers
424 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 ...
  • 2,304
6 votes
2 answers
939 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 ...
  • 2,874
1 vote
0 answers
344 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 ...
  • 415
2 votes
0 answers
713 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
498 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....
  • 53
2 votes
1 answer
396 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, ...
  • 23
3 votes
0 answers
473 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 ...
  • 7,727
0 votes
1 answer
215 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
1k 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,087
1 vote
2 answers
1k 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
289 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 ...
  • 66
0 votes
2 answers
853 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 ...
  • 121
0 votes
1 answer
61 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
259 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 ...

1
2 3 4 5 6