Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options questions only not deleted user 8104

open source Python library for reading and writing geospatial raster data

3 votes
1 answer
1k views

Specify spatial resolution using Rasterio rasterize

I am converting vector features to raster using Rasterio rasterize(). I am trying to find a way to specify the output spatial resolution. … geometry']], out_shape=shape, transform=transform, fill=0, all_touched=True, dtype=rasterio.uint8) The following GDAL approach does what I am after, although I need to stay within the Rasterio
Aaron's user avatar
  • 51.8k
16 votes
1 answer
26k views

Convert GeoJSON to GeoPandas GeoDataframe

I created the following GeoJSON object with this code: from rasterio.features import shapes polys = [] for shape, value in shapes(segments, transform=affine): polys.append(shape) [{'type': ' …
Aaron's user avatar
  • 51.8k
3 votes
2 answers
9k 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, … , "compress": "LZW", "nodata": 255}) Is there a list or documentation of all the available options available to the .update() method when writing raster data using rasterio
Aaron's user avatar
  • 51.8k
5 votes
1 answer
2k views

Which affine format to use in Rasterstats zonal_stats?

The documentation calls for the following: import rasterio from rasterstats import zonal_stats with rasterio.open('tests/data/slope.tif') as src: affine = src.affine array = src.read(1) zs = … zonal_stats('tests/data/polygons.shp', array, affine=affine) However, src.affine is no longer supported in Rasterio. …
Aaron's user avatar
  • 51.8k
8 votes
3 answers
10k views

How to split multiband image into image tiles using Rasterio?

", " + str(tile_size_y) + " " + str(in_path) + str(input_filename) + " " + str(out_path) + str(output_filename) + str(i) + "_" + str(j) + ".tif" os.system(com_string) Is there a comparable Rasterio
Aaron's user avatar
  • 51.8k