Questions tagged [fiona]

Fiona is OGR's new, neat, Pythonic API

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

Match a list of shapefile names to list of raster names then do something

I have a list of shapefiles and a list of rasters that I would like to match the names then do some data extraction for later analysis. The beginning of each raster and shapefile begins with "...
1
vote
0answers
16 views

Opening gkpg in geopandas throws: UnsupportedGeometryTypeError: 12

I wanted to open a gkpg file in geopandas 0.8.2, on windows, using conda mith channel conda-forge obj = r'path.gpkg' layer="layername" gdf = gpd.read_file(obj, layer=layer) Throws the ...
0
votes
1answer
36 views

Load a shapefile into geopandas from a request.files

I'm trying to receive a simple .shp file, without been zipped, via web request and convert it to a geopandas dataframe. I tried to use io.BytesIO to wrap the file but also didn't worked.. I tried to ...
0
votes
0answers
19 views

Reading text-anchor and text-angle from DXF using geopandas -> fiona -> gdal

I am working on a Pyhton desktop app that publishes CAD-files (dxf) to Postgresql/ GeoServer. It uses geopandas to import the dxf-file. The resulting geodataframe doesn't contain the anchorpoint and ...
0
votes
0answers
26 views

Clipping ENVI files loses information in header (.hdr) file

I have created a command-line operated python-script to cut AVIRIS imagery with polygons. I do this by using rasterio to load the imagery and fiona to load the polygon. The AVIRIS imagery comes in two ...
2
votes
1answer
39 views

Cannot write int value into a Geopandas GeoDataFrame

description of the problem I'm writting a function to simplify my use of rasterstat. def zonal_stat(src_rst, mask_vector, out_vector, measurments=available_stats[:4], verbose=False): ""&...
3
votes
0answers
28 views

Inconsistently getting “Input shapes do not overlap raster”, CRS appear to match

Masking topographic raster data by a shapefile (bedrock geology polygon). Following this guide I do this: with fiona.open("geology.shp", "r") as shapefile: geology_mask = [...
1
vote
1answer
75 views

Problem with using Fiona to write out GeoJSON objects to GeoPackage layers

I'm attempting to use fiona to write out a number of GeoJSON objects to different layers in a single GeoPackage. Here's an example json.dumps() representation of the GeoJSON object containing one ...
0
votes
0answers
186 views

Extract one geometry type from GML file in GeoPandas

I try to use GML data from Landesvermessung Brandenburg in GeoPandas. It generally works to load files like this: df = gpd.read_file(r'/vsizip//vsicurl/https://data.geobasis-bb.de/geobasis/daten/...
0
votes
0answers
76 views

Symmetrical Difference using fiona and shapely

I have a polygon that I want to merge into an existing polygon. To do this I first need to run symmetrical difference between the two overlapping polygons, and then merge them. Before symmetrical ...
1
vote
1answer
35 views

PermissionError when trying to load the layers in an ESRI File Geodatabase

I am trying to list the layers of a file geodatabase using fiona. I would like to then pick a layer and use geopandas to extract the layer as a geodataframe: import fiona layers = fiona.listlayers(r'...
1
vote
2answers
67 views

What coordinate system is this? How can I project it to WGS84 (lat-long) system in Python?

I had an AutoCAD drawing of a floor plan. I imported it to python using Fiona and checked the metadata. The CRS is empty. When I checked the coordinates for the geometry, it was in the following form, ...
1
vote
1answer
34 views

Determining driver, spatial reference and other props from an open GDAL layer

I have a very large network share full of data (raster, vector, sometimes mixed inside of geopackage and/or file geodatabase containers). I have a set of classes that crawl through it all and use ...
3
votes
2answers
48 views

Performance regression: fiona.transform much slower since GDAL 3

I have run into some severe performance degradation when upgrading an environment to GDAL3. I could track the issue down to fiona.transform, which is a lot slower (about 15 (!) times) now than it was ...
0
votes
1answer
77 views

valuerror : Null Layer

I am trying to open a geodatabase file and getting error message ValuError : Null Layer. I am using geopandas.read_file. import geopandas as gpd gdp.read_file("AL_ALFL_conf_final.gdb") I ...
1
vote
0answers
40 views

Open only part of a GeoPackage layer with a certain geometry type in GeoPandas

I have a GeoPackage (743 MB, zipped) that has one layer, but two geometry types inside that layer (Point and Polygon). When I open the file in QGIS 3.10, QGIS presents a dialogue to me that lets me ...
1
vote
1answer
74 views

Spatial join list lat,lon and multipolygon Python

I have a dataframe with lat, lon columns in WGS84. I also have a multipolygon layer (GeoJSON, I can also convert it to a SHP) with all countries' boundaries, where the name of the country is in the ...
0
votes
0answers
29 views

Saving a file consisting of two layers

I have a geopandas dataframes (A) and (B). I wanted to save them into disk using a same file but with two different layers. I knew to save one dataframe as follows: A.to_file('out.kml', layer='A', ...
2
votes
1answer
92 views

Difference in geometries of shapefiles

I have the geometry of the outline region as part of one shapefile (which is only one feature and there are other features in it apart from this). Other polygon regions' boundaries which are colored ...
1
vote
1answer
55 views

Unpack error occuring when sampling raster values to points with rasterio

I'm new to Python. I'm trying to sample raster values to points based on the geometries of a shapefile using the below code but I'm receiving the below error . import fiona import rasterio as rio ...
0
votes
1answer
117 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
102 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
27 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
31 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
0answers
72 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
58 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
18 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
2k 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
837 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 ...
3
votes
2answers
265 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
84 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
550 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
30 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
668 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
2answers
709 views

When installing Fiona on Windows 8.1 it does not fetch correct GDAL version

When I try to install Fiona binary C:\Python37\Scripts>pip install "D:/Fiona-1.8.13-cp37-cp37m-win_amd64.whl" using the 'Fiona-1.8.13-cp37-cp37m-win_amd64.whl' from the Unofficial ...
1
vote
1answer
562 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....
4
votes
1answer
276 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
111 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
54 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
532 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
117 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
188 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
175 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
319 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
1k 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
4k 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' ...
2
votes
0answers
475 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
1k 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
1k 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 work ...

1
2 3 4 5 6