Questions tagged [fiona]

Fiona is OGR's new, neat, Pythonic API

Filter by
Sorted by
Tagged with
0
votes
0answers
20 views

Select only raster overlapping shape files using Rasterio

I'm cutting out several polygons from different rasters using the IDs of a shapefile and I would like the images to be just those polygons that overlap the raster without saving the empty images. ...
1
vote
0answers
25 views

How to write to geopandas dataframe directly to (Google) Cloud Storage?

I would like to write a geopandas.Dataframe directly to (Google) cloud storage, from the documentation fiona enables this, however I am not sure how to supply the correct **kwargs for the geopandas....
0
votes
1answer
24 views

Computing linestring between two different point shapefiles

I have two point shapefile representing towns within a state and I want find the distance between them. Since the points are in different shapefiles, should I merge them so they would be in the same ...
0
votes
1answer
29 views

Errors relating to merging point shapefiles

I have created two different point shapefiles which represent towns within a state. However I want to know the distance between both towns, but first I want to draw a line between them. Is this ...
0
votes
1answer
32 views

Merging two point shapefiles as one in using shapely and fiona

I am a little bit confused. I have two point shapefile in the same Co-ordinate reference system, and I am trying to merge them using shapely to merge them together as one and output the geom with ...
-1
votes
1answer
36 views

How to add a geocode in long,lat instead of lat,long [closed]

I am a bit confused. I am trying to geocode coordinates of a point shapefile, but in long lat instead of lat long and add the address to a new shapefile. Any ideas? import fiona from geopy.geocoders ...
0
votes
0answers
16 views

how to output convex_hull polygon of points shapefile [duplicate]

i have a shapefile of more than 8 points and i have written a code get the convex_hull geometry of of the points and output it as a shapefile using fiona. however the code returns an error saying: ...
3
votes
1answer
337 views

Computing convex hull of points using shapely

I have a points shapefile and I want to compute the convex hull of the points using shapely, and output the result as a shapefile using Fiona. Does anyone know how I can do that? This is what I have ...
0
votes
0answers
188 views

Geopandas geodataframe copy with where clause causes geometry issues

Question up front: What is likely happening here, where when I take copy of the dataframe with a where clause present that there is an apparent break in the geometry, as implied by the linestring ...
0
votes
1answer
103 views

Installing Fiona into cloned conda environment in ArcGIS Pro gives ImportError

I am trying to install Fiona into a cloned conda environment in ArcGIS Pro. I have cloned the default environment and tried to install it both through ArcGIS and through the conda prompt (through ...
0
votes
0answers
12 views

Max text length Fiona\GeoPandas enables

I have a GeoDataFrame that i am trying to save as a JSON however when the length of a value is longer than 253 chars it is being cropped. Does anyone know how to change it?
0
votes
0answers
29 views

How to use fiona to directly write to a zip file

Is there a way to directly create a new .zip file that contains shapefile data using fiona? The minimal working example below works as is to produce the shapefile contents in the test/ directory. I ...
1
vote
1answer
101 views

Finding the centroid of a merged polygon using shapely function

I have a polygon shapefile and I want to find the centroid of the polygon, and output the centroid as a new shapefile before I geocode. How I should do this with Python functions shapely and Fiona and ...
1
vote
0answers
29 views

Trying to fuse 4 local authorities (polygons) as one [closed]

I am trying to extract 4 polygons (LA) from a country shapefile, combine them together as one. However, I ended up extracting those specific 4 polygons I was looking as a shapefile, but was unable to ...
1
vote
2answers
182 views

Selecting specific rows and column from a shapefile using Fiona and Shapely

I am new to using PyCharm, but I am trying to cut out 4 rows from a county shapefile from that 4 rows specify the columns or attributes to also be extracted and output the result as a new shapefile....
2
votes
0answers
164 views

Installing Fiona using GDAL 2 on Windows?

When I try to install Fiona using 'Fiona-1.8.13-cp37-cp37m-win_amd64.whl' from Unofficial Windows Binaries for Python Extension Packages I am getting the following error D:\>pip install "Fiona-1.8....
1
vote
1answer
124 views

Cannot open zip, compressed, file on external drive with GeoPandas or Fiona, it opens on C drive [closed]

I am working with Windows 10 and GeoPandas version '0.4.1' which utilizes Fiona version '1.8.11' I am trying to open a shapefile from a compressed folder (as described here https://geopandas.org/io....
3
votes
1answer
113 views

Missing columns opening GDB with GeoPandas/Fiona

I am trying to import a GDB file database table and convert it to a (Pandas) dataframe. I have been trying to do so using GeoPandas and Fiona. The problem is however that not all columns are being ...
0
votes
1answer
54 views

Clip vector by extent in fiona [closed]

I'm relatively new to fiona and I'm wondering how I can crop/clip a vector file with a bounding box. It is important to mention I want to clip, not only to get the features withing the bounding box. ...
2
votes
0answers
47 views

Polygonize every single pixel of a raster

How can I get every pixel separated? When I calc unique values, if two pixels have the same value, it converts in one row in the final shape. I need every single pixel converted into one unique ...
1
vote
2answers
300 views

CRS error working with Solaris [closed]

result_polys = sol.vector.polygon.georegister_px_df(mask2poly, affine_obj=tile_tfm, crs= 'epsg:4326') ...
4
votes
1answer
80 views

GeoPandas Intersect function gives different result to Shapely

Using this example dataset of country geometries, I seem to get a different result on whether or not the USA and Mexico intersect when I do the calculation with GeoPandas as opposed to directly with ...
2
votes
0answers
86 views

Offset after clipping an image using rasterio.mask (illustrated with figures) [closed]

I want to clip an image named img_A of dimensions 14000x10000 using a polygon shape in order to get the same dimensions than another image named img_B of dimensions 1925x1372 (see figure 1 below). The ...
3
votes
1answer
111 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
185 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 ...
1
vote
1answer
341 views

How to write a multi geometries .geojson file with Shapely/Fiona?

I am very new to fiona and shapely, and trying to do something that doesn't seems to be designed : I have a list of points and a shapely.MultiPolygon (Voronoi polygons from the previous list of points)...
1
vote
1answer
1k views

Convert lines to polygons with shapely polygonize

I have a line shapefile that I am trying to convert to polygons with python using fiona and shapely. inFile = '/content/drive/My Drive/polyline.shp' outFile = '/content/drive/My Drive/polygon.shp' ...
0
votes
0answers
199 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
2answers
575 views

Python convert lines string to polygon if closed

I have a series of contour linestrings some are closed and some are not. The linestring values are between -1 and 1. I am trying to create polygons from the linestrings if they close and keep the ...
1
vote
1answer
653 views

Getting CRS to export shapely polygon to shapefile

I am trying to export a shapely polygon to a shapefile. I have tried this, but the CRS is missing, when I try to import it in to QGIS. The shapely polygon is from this OSMNX example but edited to ...
1
vote
2answers
74 views

Getting MemoryError from Fiona when merging large amounts of buffered data (Python)

I am using fiona and shapely together to buffer points and then merge them and write them to a shapefile. For almost all of my datasets, this is working fine. However, I am currently getting a ...
1
vote
0answers
35 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 ...
0
votes
1answer
251 views

Installing rasterio and Fiona together?

I work on Windows; I use Christoph Gohlke wheels; Python 3.7 After installing GDAL-3.0.1 and Fiona-1.8.6 an error occurs on import of fiona from fiona.ogrext import Iterator, ItemsIterator, ...
3
votes
1answer
420 views

Convert contours to polygons maintaining attributes using Python?

I have a series of polylines(contours) that i want to convert to polygons using Python (GeoPandas, Fiona, Shapely). Because these are contours, there will be donut polygons, can anyone point me to how ...
2
votes
1answer
356 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(...
3
votes
1answer
1k 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/...
1
vote
0answers
38 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
277 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 ...
5
votes
1answer
161 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. ...
2
votes
1answer
1k 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 ...
2
votes
0answers
171 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
270 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
106 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 ...
4
votes
1answer
183 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
661 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....
2
votes
1answer
735 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....
2
votes
1answer
364 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 ...
1
vote
0answers
358 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
398 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
2k 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 ...

1
2 3 4 5