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

0
votes
1answer
20 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
28 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
34 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
0answers
64 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
44 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 ...
2
votes
1answer
237 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
36 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
58 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
33 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
73 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
53 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
25 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
54 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
170 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
74 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
80 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
247 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
278 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
19 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
29 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
102 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
506 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
636 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
84 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
164 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
240 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
388 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
656 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
53 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
388 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
80 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
385 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
668 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 ...
3
votes
1answer
777 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
120 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
185 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
178 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 ...
1
vote
1answer
292 views

How to polygonise a binary raster with python?

I already asked this in StackOverflow, but maybe it's better here. I have a ndvi raster that I binarized (I put my threshold at 0.35) with a script python and I wanted to polygonize this raster, in ...
3
votes
1answer
475 views

How best to use shapely to write a dict to a shapefile

I have created a shapely object (i.e. the_pt) for my Points & Multipoints to do a buffer analysis against another shapely object (i.e. city_pt) using: return_shapes = [] for pt in points: ...
2
votes
1answer
82 views

Global Human Settlement Layer-Rasterio and Fiona

I've downloaded the Global Human Settlement Layer data from here. They are huge files, too big for ArcMap or QGIS to handle comfortably so for that reason I decided to mask them. I was only interested ...
0
votes
1answer
184 views

Fiona import error when updated to version 1.7

I would like to update scipy to version 0.19 as it has the nice calculate area of a convex hull method. When updating with conda, this updates fiona to version 1.7. Now I get an error trying to import ...
2
votes
1answer
406 views

Converting Fiona Collection to Geopandas GeoDataFrame?

I have a feature class in a file geodatabase that I attempted to open with Geopandas, but I got the "list index out of range" error. To bypass this error, I'm reading the feature class directly with ...
1
vote
1answer
319 views

Blank crs attributes in fiona: Can't get proj4 parameters from OpenFileGeodatabase

I’m having trouble obtaining crs values for geodatabase feature classes in fiona (version 1.7.5). Specifically, the crs attribute returns empty for many of the geodatabases I try to read. This is not ...
1
vote
1answer
71 views

How can I programatically create a (tiff) raster file for a DEM to reference a constant altitude?

I'm trying to create a DEM to go with a simple shapefile (one polygon, four points) in python. I used fiona to create the shapefile and now need to create the DEM as a tiff file to denote the ...
5
votes
2answers
2k views

Geopandas: Write layer back into GeoDataBase

I use geopandas (which uses fiona) to read a GeoDataBase layer (using driver="OpenFileGDB") into a geodataframe for easy manipulation. read_shp = gpd.read_file(GDB_file, layer=layer_choice) That ...
1
vote
1answer
541 views

Excluding multi geometry types into a single Polygon type

After i did an intersection with two shape using geopandas through the following topic (Intersecting two shape problem using geopandas). But it output a multi geometry type shape,which in futher step ...
2
votes
1answer
3k views

Intersecting two shape problem using geopandas

I'm trying to intersect two polygons based on the following link, intersecting two shapefiles from Python or command line But problem occured that shows a "ValueError: Geometry column cannot contain ...