We’re rewarding the question askers & reputations are being recalculated! Read more.

Questions tagged [fiona]

Fiona is OGR's new, neat, Pythonic API

Filter by
Sorted by
Tagged with
5
votes
2answers
941 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
1k 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
22 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
32 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
205 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
2k 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
2k 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
109 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
421 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
573 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 ...
8
votes
1answer
1k 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 ...
3
votes
2answers
2k 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
65 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
598 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
109 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
662 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
1k 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
3k 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
212 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
312 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
3k 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
304 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
603 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
902 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
99 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
359 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
820 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
468 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
90 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
3k 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
1k 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 ...
3
votes
1answer
7k 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 ...
0
votes
1answer
414 views

geopandas read_file breaks in fiona open()

I am trying to read-in a shp file and can't seem to do it with the geopandas version 0.2.1. Here is the error: --------------------------------------------------------------------------- KeyError ...
3
votes
1answer
61 views

How to skip 0 radius which create cords error

I am new in Python and I have to do program that make buffers around cities in shp file. My problem is how to skip 0 radius? It makes coords error. I think I should use a continue function but I don't ...
8
votes
3answers
3k views

RTree spatial index does not result in faster intersection computation

I have some code that I am using to determine which Shapely Polygon/MultiPolygons intersect with a number of Shapely LineStrings. Through the answers to this question the code has gone from this: ...
5
votes
1answer
5k views

How to efficiently determine which of thousands of polygons intersect with a linestring [duplicate]

I have a shapefile that contains several thousand Polygons/MultiPolygons and another shapefile that has a variable number of LineStrings. In the example below the blue Polygons are those that ...
-2
votes
1answer
173 views

Spatial join in Python without QGIS, ArcGIS, PostGIS

I want to follow that post More Efficient Spatial join in Python without QGIS, ArcGIS, PostGIS, etc My target is to count points in polygons and export to new shapefiles the polygons that have a ...
-3
votes
1answer
87 views

python and shapely for to find wrong features in the shapefiles

I created a python script using Fiona and shapely where I can find same values between two shapefiles in the specific field (myfield) for any of two shapefiles. If I use next snippet code: for p2 ...
10
votes
4answers
8k views

Reading raw data into geopandas

Is it possible to read raw data into a geopandas GeoDataFrame, a la a pandas DataFrame? For example, the following works: import pandas as pd import requests data = requests.get("https://data....
10
votes
1answer
4k views

Convert shapefile from projected coordinates using Python

Newbie here struggling with GIS. I am trying to map out wards for the city of Milwuakee using shapefiles found on their county website county website. I am following the thread here with some success. ...
1
vote
2answers
2k views

Spatial join using python shapely and fiona

I want to create a python script when count how many points(from point shapefile) is in the polygons(polygon shapefile) and I want that count to create a new polygon shapefiles with the polygons where ...
0
votes
1answer
459 views

Export selected feature/s to shapefile with open source python library

I need to be able to select one feature/record at a time within a polygon shapefile, regardless of how many shapes it contains, using open source python libraries (e.g., OGR, pyshp, fiona). Then I ...
2
votes
2answers
2k views

Only read specific rows of a shapefile with GeoPandas / Fiona

I would like to read in only certain rows of a shapefile using GeoPandas. I've read approach for limiting columns of shapefile to read in, which I may use as well (Only read specific attribute columns ...
3
votes
1answer
666 views

PostGIS linestring to shapefile error with shapely/fiona

I have a PostGIS layer with linestring and I am trying to write the layer to shapefile using fiona and shapely. Here is what I have so far: from shapely.geometry import mapping,LineString from ...
6
votes
1answer
946 views

Buffer miles in decimal degrees with fiona and shapely

I have a script where I parse geojson earthquake data from around the world and create the point locations of the earthquake incidents. The script works fine. The CRS is 4326 or wgs84/lat long. I am ...
0
votes
1answer
195 views

Is there a Filesize Limit for Reading GDBs using Fiona?

I have python code that currently works fine with a GDB whose size is about ~ 82.7MB. However when I try to use the same code against a GDB whose size ~ 612.8MB the code seems to hang eventually ...
3
votes
1answer
2k views

Can I get the bounding box if I have just the shp file?

Is .shp file, without the dbf, .shx, .prj or others, enough to get the bounding box? I am trying to get user to upload their shapefiles in a web page. I want to obtain longitude and latitude from ...
2
votes
1answer
932 views

Calculating Total Line Length of a Network with Shapely: AssertionError

I would like to calculate the total length of a line network, similar to what is done in this QGIS tutorial. Here is what I have: import fiona from shapely.geometry import LineString length = 0.0 ...
2
votes
0answers
103 views

Dissolving polygon shapefile in Python without ArcPy? [duplicate]

I need to figure out a way to dissolve a polygon in Python using other modules besides ArcPy. I've been using the Python GDAL/OGR for merging shapefiles but I don't see anything to dissolve a polygon. ...
6
votes
1answer
523 views

Finding out and editing specific rows of attribute table in line shapefile using Python?

I got a line shapefile tc_line with 166 rows (line segments), and the figure below was its atttribute table: Originally, I had to manually select lines (these lines were lines upstream and around ...