I have a DEM raster with pixel values between about 3000 and -0.0003. I need to set all pixel with a value of 0 and smaler (&lt;=0) to "nodata" (for later raster calculations and to reduce the filesize).  It seems for me that this is a task for the raster calculator (set value of  pixels &lt;=0 to "nodata") or a reclassification (set value of  pixels &lt;=0 to "nodata" and keep all other values) but I dont know how.
17349
I have an image which I clipped with an AOI polygon. The contour area was set to pixel value = 0 and I have a nodata value of -32768. I want to redefine the nodata value into zero. I used to do this with ArcMap easily in the raster calculator, but in QGIS I don't see how I could do it. Any ideas?
110627
I have a large number of rasters with 3 bands (R,G,B). What I want to do is add all 3 bands of each raster together to end up with a single band image with the summed R,G,B values in each pixel but I'm not sure how to do this in ModelBuilder. Do I have to somehow split each raster first, then add each one?  How would I iterate through each band of every raster?  Edit:Basically this is what I have so far. Right now it will take 3 bands of 1 raster and add the bands then go on to create a polygon of a certain reclassed area. I want to do this on a large number of rasters but am unsure of how to make it work.
107176
To get a single pixel value at a point in a raster using rasterio, there is an example here:   However, is there a direct API within rasterio (and not the cli) which can be used to extract value at a single point in a raster?  -- EDIT  with rasterio.drivers():      # Read raster bands directly to Numpy arrays.     #     with rasterio.open('C:\\Users\\rit\\38ERP.tif') as src:         x = (src.bounds.left + src.bounds.right) / 2.0         y = (src.bounds.bottom + src.bounds.top) / 2.0          vals = src.sample((x, y))         for val in vals:             print list(val)
108437
I am new in R. How can I replace NA's with 0 for my raster data which have spatial information?
56614
I want to extract certain values of a raster image in order to create a new raster which then should only contain the extracted/chosen values.  How to do this in QGIS?
39948
How can I extract values from a raster by points?  I prefer not in Arcgis.   I prefer in Qgis or Mapwindow or other open source gis.
42916
I'm currently analyzing the change detection for urban expansion over a decade starting from 2006-2016. How can I use raster calculator in order to know the changes? For example, from agriculture to urban area and etc. I already classified the images into 4 classes, urban area,vegetation,water bodies and barren land.
41081
I am working on a computational model of the abundance of wild pollinators across a landscape.  The model itself is complete, and I am now struggling with a post-processing step.  I have my GDAL pollinator supply raster that looks something like this (lighter colors mean higher pollinator visitation to a pixel):    And I have an OGR shapefile of points representing sample locations on the landscape:    I'm trying to run some analysis on the pixels under these points, but to do so, I need to be able to extract the value of a pixel under a point.  Is it possible to extract the value of a pixel under a point using only OGR and GDAL through Python?  I would prefer to avoid reading the entire raster into memory through ReadAsArray(), as my output rasters are very, very large (too large to fit into memory).  I noticed , which is similar, but requires a command-line call.
63647
I have a series of continuous rasters representing the same phenomenon over time, so I need to use the same symbology across them all.  So I set the stretched symbology of the first raster, with a color ramp from the min/max values:    Now in the second raster, I import the symbology from the first raster. Unfortunately, although the labels match, the actual min/max values are not the same as the first layer:    So the red in the second raster corresponds to a value of 0.47, rather than 0.66.  How can I ensure that both rasters are using a consistent symbology?
93334
I'm trying to complete a Multi-Criteria Evaluation for an MSc assessment and am in the process of standardising my factor maps.  Unfortunately, my DEM layer (ASCII file) keeps changing from this:    To this:    The syntax used in Raster Calculator is: (“DEM” – 0) / (544 – 0) where DEM is the layer, 0 is the minimum values and 544 is the max value.  Has anyone come across this before? Does anyone know how to standardise it so the surface variation is still present?  I've done the same for Topographic Wetness Index but that's done ok (both layers are visualised the same)
66395
In ArcMap 10.2 I have a DEM and my aim is to change its color ramp using ArcMap, then export this colored raster as a geotiff (8 bit).  I checked "use renderer" and "force RGB" options but the results are not good (EDIT: when viewed in ArcMap). With some color ramps, the results are really off, and with others, they are slightly off.  For example:      Is this a bug, or is this an artifact stemming from the the original image being simplified into an 8 bit image? (Does ArcMap stores its color ramps with more than 8 bits?)     it seems that results only look strange in ArcGIS - if viewed in other applications, colors look right.   So why is ArcMap displaying the exported rasters inaccuractly?   Do I need to change some settings somewhere to have them display correctly?
64444
I am trying to use the tool  on a File Geodatabase raster, but I am getting some weird errors.  I've used this tool multiple times before with no issue, but not since I upgraded to 10.1, so I'm wondering if there is an issue with it.  The errors I got back so far have been:   This error happened when I specified a shapefile as the output: The specified geodataset is invalid for the conversion. The syntax help for the tool you are using should indicate the supported types of input data. For example, for the particular conversion, a rasterlayer may be an invalid type of geodataset.  Next I have an error about it needed at least one band in the raster, the raster does has one band. This occurred when I specified a File Geodatabase as the output. Finally I had the good ole Error: 999999 for no apparent reason.   The raster is a DEM derived from LiDAR that was not created by a different company. It's too large to be made available for testing, but here are its specs:  Raster_Information  ColumnsandRows  5119,8241 NumberofBands   1 CellSizeXY      1, 1 UncompressedSize    160.93 MB Format      FGDBR Source_Type     Generic Pixel_Type  floating point Pixel_Depth     32 Bit Colormap    absent
34147
I'm trying to identify null/0 values in each of my raster bands. How can I loop through all the values of each band? I've tried this code, straight from the gdal/python cookbook website but this just gives stats for each band as a whole and for some reason it actually doesn't print a minimum value of 0 even though my raster does have 0 values, it shows a minimum value of 1.   I want to print every single cell value. Is there a way to do this?   from osgeo import gdal import sys  src_ds = gdal.Open( "INPUT.tif" )  print "[ RASTER BAND COUNT ]: ", src_ds.RasterCount for band in range( src_ds.RasterCount ):     band += 1     print "[ GETTING BAND ]: ", band     srcband = src_ds.GetRasterBand(band)      stats = srcband.GetStatistics( True, True )      print "[ STATS ] =  Minimum=%.3f, Maximum=%.3f, Mean=%.3f, StdDev=%.3f" % ( \             stats[0], stats[1], stats[2], stats[3] )
110216
In R, it's relatively trivial to perform per pixel calculations based on a raster stack (e.g., get std.dev for each pixel on a 12 layer GeoTIFF). Unfortunately, the speed is less than desirable when working with large rasters.  Recently, I've been trying to use GDAL for this purpose, but I can't seem to get the expression down. I've tried the following, but it doesn't seem to work as advertised (or how I think it should work):  gdal_calc.py -A tmean_monthly_1980.tif --calc="std(A)" --outfile=tstdev_1980.tif --allBands=A --calc="std(A)" --NoDataValue=-9999   In the above example tmean_monthly_1980.tif is a raster composed of 12 layers (Jan-Dec) of mean monthly temperatures in 1980 (stacked using gdal_merge). Although the GDAL command produces an output, the results are definitely not the standard deviation per pixel.  Another option might be to use single band files, but gdal_calc.py appears limited to "only" 26 inputs (A-Z; i.e., "-A file -B file -C file etc."), and the resulting command line/script would be fairly cumbersome when working with large, multi-layered rasters (e.g., time series).  Is there a specific syntax for performing per-pixel raster calculations on a multi-band image using GDAL? If only individual files/bands can be specified using gdal_calc.py, please provide a scripted example using Bash, Python, etc.  Specifically, my goal is to calculate the standard deviation and cv for each pixel in a multi-layer raster stack, or using individual files that make up the same raster stack.  Note: I'm holding out for a GDAL specific answer, but other FOSS solutions are welcomed and will be upvoted, especially if they are relatively compact and adaptable to large number of inputs.
29558
I try to create an NDVI from Landsat and ASTER satellite images using Erdas Imagine. In Erdas, the satellite images have a nodata value of 0.   After creating an NDVI, the nodata value is still 0, but obviously there are also file pixels with the value 0 now (NDVI ranges from -1 to +1). So if I reset the NoData value to 0 (it is not done automatically), some pixels in my raster are missing since they are now classified as "nodata"   Any suggestions?
117666
I want to process a raster with values 0-16. I want to set all values between 1 and 15 as 1, a value of 16 as 0 and cells with a value of 0 as 0.   How do I maintain a cell value of 0?  I have tried the following:  ("raster_name@1" !=0 AND "raster_name@1" &lt;= 15*1)+("raster_name@1" = 16*0)   Results in: Values of 16 as 0, values 1-15 as 1, values 0 also = 1  I also tried:  ("raster_name@1" !=0 AND "raster_name@1" &lt;= 15*1)+("raster_name@1" 16*0)+("raster_name@1" = 0*0)   Results in: Values of 16 as 0, values 1-15 as 1, values 0 = 2  Please, can you explain how to retain cells with a 0 value as 0?
9278
I have a raster (USGS DEM actually) and I need to split it up into smaller chunks like the image below shows. That was accomplished in ArcGIS 10.0 using the Split Raster tool. I would like a FOSS method to do this. I've looked at GDAL, thinking surely it would do it (somehow with gdal_translate), but can't find anything. Ultimately, I'd like to be able to take the raster and say how large (4KM by 4KM chunks) I would like it split up into.