Questions tagged [fiona]

Fiona is OGR's new, neat, Pythonic API

33 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
56 views

Setting DXF colors via Fiona

One might expect that the "Color" CAD field would control this, but the driver doesn't allow it to be set. schema = {'Layer': 'str', 'Color': 'int'} with fiona.open(path, 'w', 'DXF', schema=schema) ...
3
votes
1answer
51 views

Find the closest line to a polygon Python Rtree

I have a series of fields and roads I am trying to find the nearest road to each field. I want to add field to each of my polygons with the index/name/etc of the closest road. Would this be the ...
3
votes
1answer
118 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'...
3
votes
1answer
660 views

Creating shapefile 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
86 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....
2
votes
0answers
1k 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
0answers
341 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
188 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 ...
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 = "...
2
votes
0answers
111 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 ...
2
votes
0answers
605 views

Find Properties of Nearest Line Segments to Point in Python

I have been trying to find a workable Python approach to finding nearest line segments to one (or more) points, and came accross @gene's solution to @RustyMagoo's problem here: from shapely.geometry ...
2
votes
0answers
487 views

How do I create a raster file from a geopandas dataframe storing lats, longs, values, and geometries

From a text file with time, lat, long, and cf values, I create a pandas dataframe (cf_df). Then I use the lat, long values to create a geoseries and create a geopandas dataframe from the original ...
2
votes
0answers
2k views

GeoPandas save to shapefile issue: Unable to open EPSG support file

When I try to use to_file() to write a GeoPandas GeoDataFrame to a shapefile I get the following error. df3.to_file('~/Desktop/testout.shp', driver = 'ESRI Shapefile'); ERROR:Fiona:OGR Error 4: ...
2
votes
0answers
104 views

Where is my Polygon?

I created this script to merge all of the polygons in a shapefile into a single polygon. I am using Python 2.7.5, Shapely 1.3.0, and Fiona 1.1.5. def merge(path_in, path_out): #Import Libraries ...
1
vote
0answers
23 views

Obtaining least number of grids (polygons) covering a separate polygon while the grids are overlapping

I have grids as polygons where the grids are overlapping. I want list of grids covering a separate polygon. The image below demonstrate the problem. The red lines are the edges of the grids and the ...
1
vote
0answers
34 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 ...
1
vote
0answers
85 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 ...
1
vote
0answers
237 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 ...
1
vote
0answers
70 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
0answers
53 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 ...
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
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/' ...
1
vote
0answers
110 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 ...
1
vote
0answers
318 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,...
1
vote
0answers
463 views

Creating spatial layer from MS SQL Server table?

I have a table in MSSQL that I am trying to use to create a spatial layer from using the QgsVectorLayer function to load the table as a layer, and then using Fiona to create a shapefile but I am ...
1
vote
0answers
181 views

Fiona write crashes

I am trying to write a new shapefile with fiona but after creating the features, i keep getting this output after the program crashes: The program '[6668] python.exe' has exited with code -1073741819 ...
0
votes
0answers
41 views

Reading GeoPackage file bigger than RAM size with GeoPandas?

I have a gpkg file that's around 10GB, and 8GB of RAM. So, if I were to read my file: import geopandas as gpd fp = "/path/to/my/file.gpkg" data = gpd.read_file(fp) print(data.shape) My computer ...
0
votes
0answers
64 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 ...
0
votes
0answers
175 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....
0
votes
0answers
87 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 ...
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
34 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
0answers
439 views

Find pairs of near features with geopandas, fiona, GDAL etc

I have a feature class of points, a few thousands I have now, but I expect to deal with hundreds of thousands of points. I would like find pair of points that is within a specific distance. The ...