Stack Exchange Network

Stack Exchange network consists of 174 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 [fiona]

Fiona is OGR's new, neat, Pythonic API

-1
votes
0answers
14 views

issues import fiona [on hold]

import fiona Traceback (most recent call last): File "", line 1, in import fiona File "C:\Python27\lib\site-packages\fiona__init__.py", line 87, in from fiona.collection import ...
2
votes
1answer
60 views

Sorting (ORDER BY) rows from Shapefile using Python?

I'm writing a Python script where I have to read a Shapefile, sort its rows/records by a specific field, and then write a new shapefile with that new order. Does anyone how can I do it? I'm using ...
0
votes
0answers
53 views

Write feature collection to S3

Is there a way to write a feature collection from Python memory to an S3 bucket (as Esri Shapefile, zipped Shapefile or something else) without writing it first to disk? I tried writing to a ...
2
votes
1answer
37 views

Calculating Length of Line features using GDAL, Shapely libraries of Python [closed]

I have a line shapefile named "river" which has 385 features. I would like to calculate the length of each feature using Python. I am currently using GDAL, Shapely, and Fiona libraries.
1
vote
0answers
31 views

How to prevent “Type error: unhashable type” while writing properties with Fiona?

Using shapely's dissolve method I created new geometries from two existing shapefiles. Now I would like to save those new geometries and their properties with Fiona. I have tried to write the ...
2
votes
1answer
196 views

Open GPKG embedded layers in python

I have a gpkg with multiple tables, and I am trying to load it with geopandas: import geopandas as gpd filename = '~/example.gpkg' gdf = gpd.read_file(filename)' This returns the first table/layer ...
0
votes
0answers
50 views

Splitting aerial photography into images with GPS coordinates

Splitting aerial photography into images with GPS coordinates Given this folder structure of (four) Oblique and (one) Vertical aerial photography of 10 cm resolution: dir/Orientations/footprints.cpg ...
1
vote
1answer
150 views

Snap points shapefile to line shapefile using shapely

I have 2 datasets: 1) a road network shapefile which has many polylines and 2) a bus stop shapefile which has many points representing bus stops. My points shapefile has CRS of EPSG 4326 and my line ...
2
votes
1answer
36 views

Python Fiona affecting external GDAL binaries?

Curious if anyone else has encountered this before and may have an explanation: In my Python workflow, I'm importing fiona (1.8.4) to manipulate shapefiles, and then later downstream I'm shelling out ...
1
vote
1answer
36 views

Why does shapely intersection of two lines change behaviour when fiona module is imported?

I am having issues with calculating an intersection of two LineStrings using Shapely. Such an intersection should return a point, yet my code returns a LineString. I found a simple example of an ...
0
votes
1answer
111 views

Create Shapely linestring from string of coordinates in text format

I have a DataFrame where one column consists of lines stored like so: '[[-7.61, 42.15],[-6.62, 43.16],[-8.9, 41.0],[-9.2, 40.5]]' Is there an easy way to read these lines directly into shapely ...
1
vote
0answers
57 views

Basic Python plotting [closed]

Sorry if I sound like I don't understand, but I've been reading around trying to figure out how to do geospatial plotting in Python. I keep running into errors despite the examples I've seen appearing ...
0
votes
1answer
80 views

Using GeoPandas, Shapely and Fiona to “select” state from shapefile, save it and display it? [closed]

I have the usual US census states shapefile for the 48 contiguous states. I am trying to select a state of interest from that shapefile then save that shapefile and display. I want to use GeoPandas, ...
3
votes
1answer
154 views

How to create the prj file with fiona and geopandas?

I am trying to create a shapefile and a geojson using geopandas and fiona. import fiona import fiona.crs ... geometry = [Point(xy) for xy in zip(df['longitude'],df['latitude'])] crs = {'init': '...
2
votes
0answers
89 views

How to get fast writing with Geopandas & Fiona?

I have a GeoDataFrame with 1,2M records, and want to write it into a GeoPackage file. Currently, it takes >20 minutes, and, as I calculated, average write speed is 100 recs/sec. As I read in the ...
3
votes
1answer
1k views

How do I write a GeoPandas dataframe into a single file (preferably JSON or GeoPackage)?

I'm new to GIS and having a basic beginner problem. I've got data in the form of a geopackage .gpkg from GADM.org. I can read in and use the data without problem using Geopandas (via built-in Fiona)....
1
vote
0answers
45 views

Spatial join of building footprints with Shapely and Fiona

I would like to do a spatial merge of the address nodes of Baton Rouge into their surrounding building footprints. Every building (polygon) should get the properties of the address (point). Here is ...
1
vote
1answer
71 views

Take pixel locations from rasterio raster and write out shapefile

I'm pulling a satellite image into python with rasterio, running some analysis to find a specific bounding box within that image, and then want to write those points out as a shapefile. I'm struggling ...
1
vote
0answers
36 views

Why does my Fiona output look different from my image

I'm trying to export my houghlines as a shapefile, which works. But the output the lines in my shapefile are very different then the generated hough lines that are shown on the image. Example: The ...
0
votes
1answer
112 views

Dissolving polygons based on multiple attributes with Python (shapely and fiona)?

I would like to dissolve a polygon shapefile based on two different fields, using Python and open source libraries. I'm just able to dissolve the shapefile using one single field, with Gene's answer ...
1
vote
1answer
85 views

Error creating buffers in shapefile

I have a function to create buffers from everything in a shapefile, but I'm getting an error on some files: Record's geometry type does not match collection schema's geometry type: 'Polygon' != '...
0
votes
1answer
35 views

Print just coordinates

I am relatively new to coding, but I am using fiona within python and would like to print the coordinates that make up the points of the polygon to later add to a separate list. However I am having a ...
2
votes
1answer
75 views

Clipping a raster by polygon and getting the sum of pixel values in webapplication

I am loading a layer with points and a raster one in an OL2 map. The layers come from a geoserver. What I want to do is to apply some buffers to the points and based on the buffer to get the sum of ...
1
vote
0answers
49 views

How to read coordinates in this specific format

I'm trying to create a shapefile consisting of lines from my python output. The output of the function is : [[[400 421 427 114]] [[227 475 237 356]] [[408 383 427 124]] [[456 322 500 327]] [[436 ...
1
vote
1answer
216 views

Reprojecting coordinate system with Python and lat/lon is only slightly off [duplicate]

I am using Python to reproject a shapefile (called "SCL" in my project) into a new coordinate system that will allow me to plot it on the same map as another shapefile (called "PUMA" in my project). ...
0
votes
0answers
92 views

Invalid Shapefile of Shapely polygons written with Fiona

The following code defines a regular grid, creates polygons within the grid intersections, applies a translation, rotation and inner buffer on the polygons using Shapely. It then writes the polygons ...
1
vote
0answers
1k views

NameError: name data_all1 is not defined in Python 3.x

I have a standalone script using data opened from a Geopackage with Fiona. When I run this portion of my script: import os import fiona import numpy as np datapath= '/media/sf_SharesShapefiles/' ...
2
votes
1answer
101 views

Unicode problems while writing selected features to a new shapefile with Fiona

I have a shapefile with a large number of geographic features (marine protected areas). I'm trying to read through all of the areas in the shapefile, select those that fit a certain criterion, and ...
4
votes
2answers
363 views

Changing shapefile's field type using fiona?

I need to have a layer time-enabled for Esri application-making. Coming from the source, it has an int type column called year. I need to find a way to automate its conversion to date. I first tried ...
2
votes
1answer
466 views

Fiona fails to write CRS to shapefile

I wanna save some geometry to a shapefile with the python27 module fiona and manually specify the coordinate reference system (CRS). Here's what I tried: import fiona import fiona.crs outpath = "...
0
votes
0answers
20 views

Out schema for dissolving shapes

I have a code which goes like this with fiona.open(some_file, 'r') as to_dissolve: out = to_dissolve.schema with fiona.open(another_file, 'w', 'ESRI Shapefile', out) as dissolved: # ...
0
votes
0answers
30 views

Shapely not detecting Manhattan point in Pluto dataset

I have a shapefile for Manhattan taken from the Pluto dataset: https://www1.nyc.gov/site/planning/data-maps/open-data/dwn-pluto-mappluto.page Removing it from the zip, I load it with Fiona. import ...
0
votes
1answer
120 views

Read OGR VRT file using Fiona

Using Fiona for reading my VRT file I'm receiving an error that OGR_VRT driver is not supported: fiona.errors.DriverError: unsupported driver: 'OGR_VRT' My test.vrt file looks like: <?xml ...
4
votes
1answer
675 views

GeoPandas ValueError: A LinearRing must have at least 3 coordinate tuples

I am trying to read a multi-polygon GeoJSON file in GeoPandas, but I am getting the following error: 'ValueError: A LinearRing must have at least 3 coordinate tuples' command used is gpd.read_file(...
1
vote
2answers
818 views

What options are available for the rasterio .update() method?

I have a script which clips raster data by a shapefile using rasterio and fiona: import fiona import rasterio import rasterio.mask def clip_raster(shp, imagery, out_imagery): with fiona.open(shp,...
2
votes
0answers
88 views

ArcGIS 10.4 strange phenomenon with special Unicode Characters Column

I worked on this problem for a while and I have localized it pretty well now to ArcGIS 10.4 at its core (haven't tested 10.5): A column that contains special Unicode Characters (emojis) is not read ...
4
votes
1answer
218 views

Fiona Geometry Error 12L when opening geodatabase

I am trying to read a geodatabase using Fiona, but I keep coming across the error: fiona.errors.UnsupportedGeometryTypeError: 12L Which I am very unsure why it is happening. I've done the ...
1
vote
1answer
307 views

Intersection with Shapely and Fiona gives Key Error

I have written a script for standalone python based on this example for doing intersections of linestrings (representing streets) and polygons (representing gridcells) using shapely/fiona. The ...
7
votes
0answers
517 views

Rasterio does not execute the rasterize function

Rasterio's features.rasterize() function is not working as expected. I have two files: OpenStreetMap shapefile with land usages Raster (.tif) with satellite imagery Goal: Create a raster file from ...
2
votes
2answers
799 views

How can I extract contours from a raster with Python?

I currently run gdal_contour as a Python subprocess to extract contours from a raster file, but would like to achieve the same function with a combination of Rasterio, Shapely and Fiona. However, ...
0
votes
1answer
55 views

Creating file to analyze geometrically? [closed]

I have sets of lat/lon points for vortices in the ocean, and what I want to do is draw curves around them (they are roughly elliptical), and determine their eccentricity and orientation as they move ...
6
votes
1answer
429 views

Custom transverse Mercator projection with fiona and shapely

AS a build off from this question I posted over a year ago Buffer miles in decimal degrees with fiona and shapely I am attempting to create 50-mile buffers around each earthquake. I have taken the ...
1
vote
0answers
87 views

Geometry/Geography type issue for US Census TIGER ShapeFiles

I'm loading the ShapeFiles from TIGER into SQL Server (via Python Geopandas/Fiona). It seems the boundaries are all of the Geometry data type (flat-earth). Do these file exist in the Geography ...
2
votes
1answer
439 views

How to convert PostGIS WKB to Shapefile - Fiona 'Polygon' object not iterable error

I am relatively new to Python and programming and trying to create a shapefile using multiple WKBs queried from a PostGIS database. I am using psycopg2 to query the database and using shapely and ...
3
votes
3answers
778 views

Fiona throws no dataset found when attempting to read a KMZ file

I downloaded a NOAA-provided KMZ file (link). When I point geopandas at the file: gpd.read_file("/Users/abilogur/Downloads/NSIDC_SepSeaIceExtent.kmz", driver="KMZ") I get: FionaValueError: No ...
4
votes
1answer
1k views

Reading the names of geodatabase file layers in Python

I'm looking at New York City's Projected Sea Level Rise dataset. This dataset states that it is: Geodatabase of projected sea level rise based on models released by New York City Panel on Climate ...
3
votes
1answer
132 views

Creating point shapefile from Excel with Fiona

I am attempting to use fiona and xlrd to convert a complicated excel spreadsheet to a shapefile (point). I am trying to figure out how, during the .write call, to send the list of coordinates I've ...
1
vote
0answers
208 views

select by attribute and calculate field: fiona, geopandas

This may be more of a python question than gis, but I have 3 bands in a polygon layer, and I would like to select earthquakes within each band and calculate a new field to note these locations (band 1,...
5
votes
2answers
2k views

Splitting a line shapefile into segments of equal length in python

I want to split a line shapefile into segments of equal length, let say into length of x meters each. There is tool v.split.length as mentioned in this answer: how to split a line into a specific no. ...
2
votes
1answer
202 views

Create points every 20m with GDAL?

I have code written in ArcMap which uses the package ArcPy which I cannot use in a stand-alone Python script, but I want to do it with GDAL without ArcMap. Basically it goes through the lines in the ...