geotiff

Read elevation using gdal python from geotiff

早过忘川 提交于 2019-12-02 22:54:18
I am loading a geotiff file using GDAL. I have managed to read the coordinates X,Y but not the elevation. Has anyone worked on a similar case before ? Regards, If you'd like the read all of the elevation values into a numpy array, you'd typically do something like this: from osgeo import gdal gdal.UseExceptions() ds = gdal.Open('test_data.tif') band = ds.GetRasterBand(1) elevation = band.ReadAsArray() print elevation.shape print elevation elevation will be a 2D numpy array. If you'd like a quick plot of the values you can use matplotlib : import matplotlib.pyplot as plt plt.imshow(elevation,

How to use GDAL to create geotiff from tiff and 4 corners latitude and longitude [closed]

血红的双手。 提交于 2019-12-02 21:12:57
Closed. This question is off-topic. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it's on-topic for Stack Overflow. I have an image (map) without geo data in TIFF format. I need to get GeoTIFF file from my image. I have latitude and longitude for each corner of my map. How can I add my geo data to my image in Google spatial refence to get geotiff? I know that GDAL can help me with that. Can anyone help me build a command You have the right idea in your answer but allow me to expand. You are correct, you'll need to use the gdal

Convert NetCDF (.nc) to GEOTIFF

戏子无情 提交于 2019-12-02 01:15:25
I have .nc file sizing around 300MB with a couple of datasets ( TEMP , DEWPOINT ) forecast data. I need to convert ( TEMP ) dataset to multiple GEOTIFF (one .tif for each time slice). Here is how the .nc file looks like. Looked into this answer but it seems to be for the whole dataset. I tried GDAL but not sure how to make it work for each time slice. Any thoughts? netcdf4 -python? gdal has a gdal_translate option that will allow you to do this to translate the file from .nc to .tiff . See below: gdal_translate -of GTiff file.nc test.tiff and using the -b option will allow you to specify which

R - original colours of georeferenced raster image using ggplot2- and raster-packages

邮差的信 提交于 2019-11-30 22:01:36
I would like to use the original colortable of a >>georeferenced raster image<< (tif-file) as coloured scale in a map plotted by ggplot/ggplot2 . Due to not finding an easier solution, I accessed the colortable -slot from the legend -attribute of the loaded raster image (object) raster1 like so: raster1 <- raster(paste(workingDir, "/HUEK200_Durchlaessigkeit001_proj001.tif", sep="", collapse="")) raster1.pts <- rasterToPoints(raster1) raster1.df <- data.frame(raster1.pts) colTab <- attr(raster1, "legend")@colortable Ok, so far so good. Now I simply need to apply colortable as a colored scale to

How do I write/create a GeoTIFF RGB image file in python?

和自甴很熟 提交于 2019-11-29 13:33:57
问题 I have 5 numpy arrays of shape nx, ny lons.shape = (nx,ny) lats.shape = (nx,ny) reds.shape = (nx,ny) greens.shape = (nx,ny) blues.shape = (nx,ny) The reds, greens and blues arrays contain values that range from 0–255 and the lat/lon arrays are latitude/longitude pixel coordinates. My question is how do I write this data to a geotiff? I ultimately want to plot the image using basemap. Here is the code I have so far, however I get a huge GeoTIFF file (~500MB) and it comes up blank (just a black

Reading hdf files into R and converting them to geoTIFF rasters

99封情书 提交于 2019-11-26 16:09:55
问题 I'm trying to read MODIS 17 data files into R, manipulate them (cropping etc.) and then save them as geoTIFF's. The data files come in .hdf format and there doesn't seem to be an easy way to read them into R. Compared to other topics there isn't a lot of advice out there and most of it is several years old. Some of it also advises using additional programmes but I want to stick with just using R. What package/s do people use for dealing with .hdf files in R? 回答1: Ok, so my MODIS hdf files