Tag Info

Hot answers tagged

12

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


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


10

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


9

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


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"


7

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


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

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


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


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

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

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


6

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


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


5

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


5

The translation isn't that difficult. The rasters are quoted not square bracketed, unless of course that's the correct syntax for a GRID which they appear to be: CON([DamBasin] AND ([DamElev] <= 790), 790) becomes Con("DamBasin" & ("DamElev" <= 790), 790) assuming DamBasin is binary.. true is 790, false is nodata ...


5

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


4

There IS a way to do it in the standard raster calculator ... but it's a kludge ... (iraster@1 > 2) + (iraster@1 > 4) + (iraster@1 > 6) This does a comparison test inside each set of parentheses, returning the value '1' for each true comparison, '0' otherwise. Thus, if the raster value of a cell is 5, (iraster@1 >2) returns 1, (iraster@1 > ...


4

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


4

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. If you have installed QGIS with OSGeo4W package, you may have the terminal program called 'MSYS'. Open that and just use the gdal_translate command. If not, from within ...


4

You could use the GRASS module r.series with method=stddev. For example, if you have rasters named apr_precip_97, apr_precip_98, and so on then in a GRASS terminal you would run: r.series in=`g.mlist rast pat=apr_precip* sep=,` out=apr_precip_stddev method=stddev


4

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


4

I assume that your graphs came from a R-script and that you are capable of using R. Here is a solution in R, which finds local maxima and minima along a data sequence x <- rnorm(50,mean=1500,sd=800) # Example-Data r <- rle(x) # Generate run sequence object min <- which(rep(x = diff(sign(diff(c(-Inf, r$values, -Inf)))) == 2, times ...


4

If you try to output the iterate raster tool directly into raster calculator, you will only see the last iteration in the raster calculator layers and variables list. To get around this nuisance in model builder, use Collect Values to generate a list that you can pass off to Cell Statistics to do your calculations. Simply choose the "MEAN" overlay ...


4

You can incorporate Con into your raster algebra equation to make this calculation. Alternatively, use the Con (Spatial Analyst) tool. The following links will help you build the Con expression: Conditional evaluation with Con Building expressions in Raster Calculator


4

Region Group on your original classified raster will identify 'patches' and assign them each a unique number in the VALUE field. Note: an item called LINK is added to the attribute table of the output raster, which indicates the original value for each cell from the input raster. You can use the Zonal Geometry As Table tool again to get the area in map ...


4

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


4

I don't know of any cellular automaton tools integrated in QGIS yet, but if you just wanna generate a distributional based random raster based on a number of inputs (similar to this ArcGis function) then you could use the "Create random landscape" tool i implemented in the QGIS Plugin LecoS. Example output (of a random raster with Gaussian distribution): ...


4

If you want to do this in python, gdal_calc.py isn't import friendly so can only be used from the command line. An alternative is the gdal calculations package which can be imported and used in python scripts. from gdal_calculations import Dataset ds1=Dataset('../testdata/landsat7.tif') ds2=ds1 * 2 ds2.save('/tmp/test.tif')



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