Comments (5)
Very cool! So just for the record, here's how it can work with rasterio:
import rasterio
from matplotlib import pyplot
from matplotlib import colors, cm
from rasterio.plot import show
src = rasterio.open("some.tif")
fig, ax = plt.subplots()
cmap = pyplot.get_cmap('rainbow')
data = src.read()
show(data , transform=src.transform, ax=ax, cmap=cmap)
fig.colorbar( cm.ScalarMappable(norm=colors.Normalize(vmin=np.nanmin(data), vmax=np.nanmax(data)), cmap=cmap), ax=ax)
from geoutils.
same code than Johannes but with cartopy (>0.17) will get imshow() to handle the georeferences:
import cartopy
import matplotlib.pyplot as plt
import rasterio as rio
src = rio.open('/home/atom/ongoing/work_worldwide/N65W019_final_err.tif')
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection=cartopy.crs.Robinson())
ax.gridlines(draw_labels=True, dms=True, x_inline=False, y_inline=False)
plt.imshow(src.read(1),cmap=plt.cm.Reds)
plt.colorbar()
plt.show()
from geoutils.
You can use imshow() in rasterio directly:
import rasterio
from matplotlib import pyplot
src = rasterio.open("some.tif")
pyplot.imshow(src.read(1), cmap='pink')
pyplot.colorbar()
pyplot.show()
Is that what you thought of?
from geoutils.
You can use imshow() in rasterio directly:
Well but then you lose the georeferences... I can of course do it in matplotlib but I was wondering if there was a more direct way.
from geoutils.
Solved by #95
from geoutils.
Related Issues (20)
- Add `footprint` as an attribute of both `Raster` and `Vector`
- Add `to_area_or_point()` method to clarify the weird transformation behaviour of `set_area_or_point`?
- Add option to add background basemap to plots HOT 1
- Add `set_crs` and `set_transform` to force re-set geospatial attributes? HOT 3
- Detail other implicit features of GeoUtils in documentation: minimal loss of information, ensuring projected CRS for distance-dependant operations
- Add `Vector.shift()` function mirroring `Raster.shift()`
- Add option to `Vector.crop()` for removing all features not contained (instead of intersecting)
- Make "New_ID" an argument in `Raster.polygonize`
- Rename `value_at_coords` and make expected input same as `interp_points` HOT 1
- `value_at_coords` returns nodata values instead of NaNs
- Force colorbar of `Vector.plot()` to fit the axis
- Add `Mask.buffer()` to apply dilation/erode in CRS units consistently (without also eroding raster edges)?
- Add `Raster.merge()` relying on `merge_rasters()`? HOT 3
- Raster clipping HOT 2
- Fix notebook downloading in documentation
- Padding of colorbar in `Vector.plot()` varies despite fixed `pad` in `cax.append_axes`
- Fix documentation example for `merge_rasters` to work with different CRS
- Reprojection of a multiband Raster on a single band Raster doesn't work HOT 1
- Export an elevation profile from a Raster along a Vector line. HOT 2
- Documentation API not always showing up properly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from geoutils.