Hot answers tagged

14

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 ...


13

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")


12

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 ...


12

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 ...


11

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 ...


9

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 ...


9

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 ...


9

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 ...


9

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.


8

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"


8

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") ) ) ...


7

The following will stretch your data to 8-bit (0-255). smin=0; smax=255 ( x - min(x) ) * smax / ( 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 it is ...


7

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


7

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 ...


7

It is very complicated and that's why there are specialized applications as gOcad, for example. I use GRASS GIS because I can build volumes (3D voxels) from surfaces/grids (Help with 3D), even if the surfaces are not "perfect": Application with two layers from El modelado geólogico para un geológo sin recursos o entusiasta: GRASS GIS (y Paraview) (in ...


7

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")


7

Subtract the trend surface from the DEM. Linear trend (1st order polynomial) 2nd order polynomial trend Per @radouxju's comment - the trend line can be shifted down to avoid negative values by adding the minimum value. In the Raster Calculator: "DEM" - Trend("DEM") + N Where: N = Minimum raster value In python import arcpy from arcpy.sa import ...


7

I am posting my answer in case this could prove useful to anyone jumping here in the future. In Raster Calculator I used: SetNull("DEM", "DEM", "Value <= 5") and it did the trick.


7

The easiest solution is to replace the raster calculator with the "Plus" operator in the iterator. The best solution is to use a Python script import arcpy from arcpy.sa import * arcpy.env.workspace = r'your_path_to_directory' for r in arcpy.ListRasters("*"): # list all rasters in workspace outRaster = Raster(r)+1 #perfoms addition outRaster....


6

I wouldn't clamp the values, as suggested by the pseudocode, because the curvature artifacts do not necessarily correspond to high-curvature areas. Better cures for the problem include: Consider smoothing the DEM before computing the curvature. This would slightly reduce most curvatures but might give reasonable curvature values at all locations. ...


6

You simply need to use following expression raster A insularis_1@1 > 0 The expression means , set all values greater than 0 as 1 and others as 0.


6

You can use the set null tool in the spatial analyst toolbox to assign any cell values outside your desired range to null values. The result will be a new raster layer with only the cell values you wish to preserve. The expression you should use will be along the lines of: Value > -117 AND Value < -69 and the false raster should be the same as your ...


6

Because the Raster Calculator is a spatial analyst tool, you can utilize the Mask environment. From there, you can use a variety of commands to perform the reclassification: common ones include Con, Pick, Is Null and Set Null, based on your needs. To check if a specific spatial analyst tool honors the Mask environment, simply scroll down to the ...


6

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.


6

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").


6

That is simply indicating that the value is a Unicode string. You can use this unicode string in most situations. However, if you need to fully control the type, convert it to float format. test = unicode('261.22') >>> test u'261.22' >>> type(test) <type 'unicode'> test2 = float(test) >>> test2 261.22 >>> type(...


6

Just use the field calculator, goto attribute table and right click on the table header, and choose field calculator [ONEWAY] = "B" obviously our fields are a little different, just make sure you select the field you want to calcuate to


5

I think the problem is with this expression OutRaster = Con((inRaster <= var[0])&(inRaster <= var[1]),1) Con expects the following format Con (in_conditional_raster, in_true_raster_or_constant, {in_false_raster_or_constant}, {where_clause}) Which in your case Con((inRaster <= var[0])&(inRaster <= var[1]),1) can be broken ...


5

From a UI and UX point of view, 30,000 individual points on a map is not exactly the best representation of your data. You may also choose to use UTF8 grids on top of your rasterized point data. However, the resolutions of your grid and the amount of points will definetely make selecting data very unpredictable and not the best UX. http://mapbox.com/...


5

No data values in a raster in ArcMap will nullify any summation resulting in nodata for any cells beyond the extents of the total area. Your workaround would be to produce rasters with the maximal extent, set the nodata values to zero and then sum. Not a pretty prospect and not necessarily what you want.



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