Questions tagged [fiona]

Fiona is OGR's new, neat, Pythonic API

Filter by
Sorted by
Tagged with
2
votes
1answer
81 views

Creating equally spaced coordinates on California state map created with basemap?

I have created a California state map with basemap Python library and this shapefile. Code is below from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt fig, ax = plt.subplots(...
1
vote
1answer
61 views

Geopandas read_file only reading first part of KML

I am trying to read the following file with GeoPandas: import geopandas as gp gp.io.file.fiona.drvsupport.supported_drivers['KML'] = 'rw' df = gp.read_file('http://watchthemed.net/index.php/json/...
0
votes
0answers
27 views

Fiona installation in Python 3.6 ERROR: Command “python setup.py egg_info” failed with error code 1 [duplicate]

I'm trying to install Fiona using pip in Python (v 3.6.8). I'm using the following command: python36 -m pip install Fiona I'm getting the following error:
1
vote
0answers
31 views

Select features of a shape which are not in another shape

I have a shape with some features (let's say 100) and a second shape with some of this features (50) buffered (5 meters inside buffer). I want to select and write in a new shape every feature of the ...
0
votes
2answers
73 views

Fiona and Geopandas not applying CRS to shapefile during creation

I'm trying to create a shapefile of points from a coordinate list. But, when I use fiona to create the shapefile Arc Catalog is showing that there is no CRS. I tried to add the CRS with Geopandas and ...
3
votes
1answer
88 views

Using libraries other than PyQGIS to develop plugin for QGIS?

I develop a plugin for QGIS. Before to integreted it in the QGIS I developped it with GIS library (Fiona, shapely, geopandas, ...) and it work well. Now I try to build it with plugin_builder of QGIS. ...
1
vote
1answer
155 views

Quickly find all polygons that overlap with two or more polygons in Shapely

I have a set of Polygons (in Shapely) that I wish to find all intersections that are comprised of overlaps of two or more polygons. I have been working based off the code found in this answer. I have ...
1
vote
0answers
40 views

Creating a shapefile within a zip file with Fiona

According to the Fiona documentation "Fiona lets you read and write zipped Shapefiles." But I can't find any examples of writing (with Windows file paths). Trying this... with fiona.open('output_shp....
1
vote
0answers
60 views

How to segment polygon in to line segment?

I want to segment a Polygon or PolyLine in segment of line and remove some segments. I have an polygon that i convert in polyline by the code below and it work well: from shapely.geometry import ...
0
votes
0answers
55 views

Writing only one of the input vector fields to output vector using Fiona/ Python?

I'm working on a function to perform operations on folders of vector files. These files might have differing attribute fields but there will be a common field between them. I'm using fiona in python ...
2
votes
1answer
67 views

Writing Non Spatial Table into Geopackage - Python

Just wondering how to write a non spatial (aspatial) table to geopackage using python. I have attempted using Fiona, geopackage = 'some_geo.gpkg' layer = 'test_layer' schema = {'geometry': {'type'...
0
votes
1answer
184 views

Dissolving polygons to single part features with Python (shapely and fiona)?

I used the code from Dissolving polygons based on multiple attributes with Python (shapely and fiona)? to dissolve a shapefile using shapely and fiona. However the output creates multi-part geometries....
1
vote
1answer
142 views

How can I avoid changes to field types in geopandas?

I am using geopandas in the following routine to create the union of 2 (polygon) shapefiles: import geopandas as gpd def union(fn_A, fn_B, output): shpA =gpd.read_file(fn_A) shpB =gpd....
0
votes
0answers
112 views

Geopandas to_file() gives an error regarding fiona.drivers(). Is it possible to work around this?

I'm using geopandas to get WKT and coordinates from a database: df = pandas.read_sql(con=conn2, sql=test_query) df['Coordinates'] = df['WKT'].apply(lambda x: wkt.loads(x.read())) gdf = geopandas....
2
votes
1answer
96 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
154 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
181 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.
2
votes
0answers
707 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
1k 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
77 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 ...
2
votes
1answer
946 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
45 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
87 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
410 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
132 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
230 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
469 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
251 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 ...
5
votes
2answers
5k 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
65 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
154 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
49 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
230 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
134 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
125 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
123 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
51 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
420 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). ...
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
146 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 ...
5
votes
2answers
762 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
891 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
183 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
1k 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
98 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
363 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
506 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 ...