A message from our CEO about the future of Stack Overflow and Stack Exchange. Read now.
31

The Raster|Extraction|Clipper tool will help you to do this. You can open the tool and then click and drag in the raster image to select the area you want to export as a new raster (Clipping mode: Extent), and then refine the exact coordinates in the Extent fields (if necessary). Probably no way to do contours on only a selection of a raster; clip it this ...


17

The language of data transformation can be confusing. Standardization refers to transforming your data so it has a mean of 0 and a standard deviation of 1 and is only appropriate for normally (Gaussian) distributed data. Whereas, normalization transforms your data so that the minimum value is 0 and the maximum is 1 while keeping the shape of the original ...


16

You can use a conditional (Con) statement in the raster calculator or the con tool in ArcToolbox. The below statement is evaluated as [IF myrasters > 2000 THEN 1800 ELSE myraster] Con("myraster" > 2000, 1800, "myraster")


16

Two possible easy ways: 1.) Install the QGIS raster calculator if it isn't already available (you did not specify which QGIS version you are using) Use the QGIS raster calculator with a formula like this "Corine@1" = 23. This will extract all cells with value 23 into a new raster Then use the "Raster Layer statistics" tool within the SEXTANTE toolbox for ...


15

The following will stretch your data to 8-bit (0-255). smin=0; smax=255 ( x - min(x) ) * (smax - smin) / ( max(x) - min(x) ) + smin It should be fairly easy to translate this to the raster algebra syntax in your software of choice. You will just need to know what the min and max values are in your raster. If the raster is the result of a band ratio then ...


15

Starting from QGIS 2.0 (and current development version), the class QgsRasterCalculator is available in python. Unfortunately it is not very well documented. The basic usage is, that you have to define an alias for each band used in the calculator expression in form of a QgsRasterCalculatorEntry Your example can then be written as follows, given you have ...


15

in qgis raster calculator, the comparison return 0 (if false) or 1 (if true). So you can write a conditional using a sum of products. ((raster1@1 >0.3) * raster1@1 * raster2@1 ) + ((raster1@1 <=0.3) * raster1@1 * raster3@1 )


13

This questions has been asked a number of times. 30k points, straight up, will not work on an OL map. Or even on a Flash/Silverlight map. Rough (rough!) order of magnitude numbers to remember - 100 points on a JS map (openlayers), 1,000 points in a Flash Map (e.g ArcGIS Flash or Silverlight), 10,000 points on a desktop app (ArcGIS Desktop) are your fine ...


13

You can create a condition by using a little 'trick': Suppose you have a raster file (layer1) with values below 0 but you want only positive values. ("layer1@1" > 0 ) Is resulting in 1 when it is above 0 and is resulting in 0 when it is below 0. ("layer1@1" > 0 ) * "layer1@1" When you multiply this with the raster value it will either be 0 or it ...


12

First, you should make sure your roads and hydrology feature classes are being rasterized appropriately. You should make sure that the cell size and snap raster (i.e. pixel registration) matches your suitability layer. If you don't, the rasterized roads and hydrology could have much larger cells than intended or be misaligned, leading to undesirable results. ...


12

The easiest solution is to replace the raster calculator with the "Plus" operator in the iterator. EDIT: note that I wasn't able to reproduce the problem in ArcGIS 10.6: ("%Raster%") + 1 worked fine in my iterator ( with output =, for example, %Raster%_out ) Anyway, the best solution is to use a Python script import arcpy from arcpy.sa import * ...


12

Create a raster object using the full path to your raster. Raster objects have the properties minimum and maximum. >>> rastFullPath = r"C:\Rasters\rasters.gdb\Slope" >>> rast = arcpy.Raster (rastFullPath) >>> rast.minimum 0.0 >>> rast.maximum 64.9616928100586 Or you can use your method and convert the output from unicode ...


11

You can use gdal_translate utility. Use the option -scale [src_min src_max [dst_min dst_max]] with src_min and src_max as current min/max values from your data and 0,255 as dst_min,dst_max. Without the square brackets. If you have installed QGIS with OSGeo4W package, you may have the terminal program called 'MSYS'. Open that and just use the gdal_translate ...


11

Without reinventing the wheel, I suggest you to use gdal_calc.py. Example: gdal_calc.py -A input.tif --outfile=result.tif --calc="A*2"


11

Exp( 3.394 + ( 4.717 * "elev" ) + ( -2.602 * ("elev" ^ 2) ) ) In Raster Calculator syntax, the '^' operator is for 'Boolean XOr', not 'raise to power of' (see Raster Calculator operators here). Instead, you could use: Exp( 3.394 + ( 4.717 * "elev" ) + ( -2.602 * ("elev" ** 2) ) ) or Exp( 3.394 + ( 4.717 * "elev" ) + ( -2.602 * ("elev" * "elev") ) ) or ...


11

Pixel depth begets pixel depth. If you are using digital numbers as your input to the NDVI expression then the result will be integer. You will need to explicitly coerce to float in the raster algebra expression. Float("nir" - "red") / Float("nir" + "red")


10

You should not be seeing negative values in the CTI. Since you did not provide a reproducible example I cannot speculate as to why you are getting incorrect results. The expected range is not limited 1-10. The range will be defined by flow accumulation which is influenced by the size of the basins that are accumulating flow. The index does not rely on washed ...


10

I don't believe there's a single command to do this, but we can still accomplish it expediently. The idea is that the distance to the nearest different cell equals the distance to the nearest location whose immediate neighborhood contains more than one cell type. Well, this is not quite true, but it's close: you might want to add approximately one cell ...


10

Oh will you feel silly! ;-) The result is actually correct. The two rasters are identical where they overlap. Where they do not, the result is NaN because you cannot do math with a non-existent value.


10

What you are looking for is COUNT, which is the frequency of the cells that you processed through Zonal Statistics. Sum, on the other hand, is the sum of cell values covered by your polygon. Overly simplistically, say, your cell values are 2,1,3,4,4 in this case COUNT is 5 and SUM is 14.


10

What you are actually trying to do is a kind of Location Allocation analysis. The need for a pharmacy is determined by two things: The amount of people living in an area (amount of buildings is proxy) The distance (either Euclidean or drive time) You could use the freeware of Utrecht University; flowmap for this purpose. It is a bit 'clunky' though. Their ...


9

in ArcMap 9.2 using the Raster calculator (Spatial Analyst). for five raster files: ( [raster1]+[raster2]+[raster3]+[raster4]+[raster5] )/5


9

EDIT 3: I converted the code below into quite usable SEXTANTE script that give following output: Detailed instruction and the download link can be found here. You can use python console for this task. Copy code provided below, paste it into a text file and save it as "some_script.py" for example. Next time you will need to count cell values open python ...


9

You can use tool Raster Calculator. Then type this expression: SetNull("raster_name"<0, "raster_name") Choose output and you should create new raster with elevation 0-n.


9

Raster objects have minimum and maximum (as well as mean and standardDeviation) properties that can be accessed in the raster calculator. ("raster" - "raster".minimum) / ("raster".maximum - "raster".minimum) * 100 This will work as long as you have already calculated statistics for the raster, otherwise it will fail as "raster".minimum will return None. ...


9

The cube root is to the power of 1/3 so you could use something like: (ras1 * ras2 * ras3) **(1/3) Credit to @JeffreyEvans for correcting the operator for ArcGIS.


9

Try this syntax: (A@1 = 3 + A@1 = 11)* A@1 + B@1 @1 means the first band of the raster A@1 = 3 returns 1 (TRUE) if A is 3 When A is 3 or 11, (A@1 = 3 + A@1 = 11) part returns 1. Otherwise it returns 0.


8

From the ArcGIS Help: Note: The Raster Calculator tool is intended for use in the ArcGIS for Desktop application only as a GP tool dialog box or in ModelBuilder. It is not intended for use in scripting and is not available in the ArcPy Spatial Analyst module. That said, you can use it with arcpy.gp.RasterCalculator_sa, but you need to pass it a ...


8

While researching another question I found this forum post that states dot notation doesn't work in Raster Calculator beginning with 10.0. The forum post suggests using Lookup to create a separate raster from the second field. It also suggests this can be accomplished in the Raster Calculator by using: Lookup("rastername","fieldname").


8

In your case, the complete syntax for raster calculator is: (("slope_1@1" >= 0) AND ("slope_1@1" <= 4))*4 + (("slope_1@1" >= 5) AND ("slope_1@1" <= 8))*3 + (("slope_1@1" >= 9) AND ("slope_1@1" <= 11))*2+(("slope_1@1" >= 12) AND ("slope_1@1" <= 15))*1 Editing Note: The sintax in the raster calculator: It works nicely. I tested it ...


Only top voted, non community-wiki answers of a minimum length are eligible