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 answers only not deleted user 48232

open source Python library for reading and writing geospatial raster data

14 votes

Rasterio: tool for creating mosaic?

import rasterio import numpy as np from rasterio.merge import merge from rasterio.plot import show src1 = rasterio.open('/path/to/your/raster1') src2 = rasterio.open('/path/to/your/raster2') # Taking … I was just looking for a similar technique and found this method based on the rasterio/merge.py function given here. You can check out my example with two orthomosaic images here. …
Charlie Parr's user avatar
  • 1,986
-1 votes

Rasterio reading outshape resample does not give correct array

Try: int(dataset.height / factor), int(dataset.width / factor)))
Charlie Parr's user avatar
  • 1,986
1 vote
Accepted

Control histogram axis and legend with show_hist of rasterio

Try creating the figure and axis explicitly: fig, axhist = plt.subplots(1, 1) show_hist(hist_data, bins=200, histtype='stepfilled', lw=0.0, stacked=False, alpha=0.8, ax=axhist) axhist.set_xl …
Charlie Parr's user avatar
  • 1,986
1 vote

How to convert from HDF5 to GeoTIFF with Python

You are correct, this information implies the transform and you will also want to fill out the profile so you can write the data to a GeoTIFF via rasterio. …
Charlie Parr's user avatar
  • 1,986
1 vote

Rasterio & rioxarray no longer compatible with fairly standard modules

that combo of packages does not seem like too much to ask! Two things you might try here: 1.) Use miniconda rather than conda - this version ships with no pre-installed packages, but otherwise functio …
Charlie Parr's user avatar
  • 1,986
0 votes

Rasterio Write Masked Array to TIFF - Shape write and read indices are wrong

You may be prescribing the new height and width incorrectly. What happens when you call out_image.shape before writing the raster? It may be the shape is actually 1 x 6094 x 4000 (or whatever the widt …
Charlie Parr's user avatar
  • 1,986
2 votes
Accepted

How to extract max elevation values for each road links in a shapefile using Python libraries?

import rasterio import geopandas as gpd import rasterstats as rs src = rasterio.open('example_dem.tif') gdf = gpd.read_file('example_road.shp') gdf.crs {'init': 'epsg:4326'} src.meta['crs'] CRS.from_wkt …
Charlie Parr's user avatar
  • 1,986