New answers tagged

0

There's a good solution in one of the answers on this page: https://geonet.esri.com/thread/25945 arcpy.env.overwriteOutput = 1 arcpy.CheckOutExtension('Spatial') arcpy.env.scratchWorkspace = outPath arcpy.env.workspace = dataPath #create a list of rasters in the workspace rasters = arcpy.ListRasters('','') i = 0 #loop through rasters in list ...


0

The asc file does not contain any statistic metadata. So QGIS uses gadlinfo -approx_stats to get a quick result for the statistics. Further down the metadata, you will read No stats collected yet. You can force the computation of statistics with gdalinfo -stats. The result will be written to a file named 30_12_2009.asc.aux.xml. You can open it with any text ...


2

Potentials that I'd suggest that you look at are: NDVI percentiles - to indicate the highest & lowest NDVI values, without having the issues associated with anomalous min & max values. Range of NDVI values in a year - to indicate variability over the year. Potentially based on the percentiles, instead of min & max values. Bi-modality, to ...


1

You need to use the -dstalpha option to gdalwarp e.g.: gdalwarp -cutline INPUT.shp -crop_to_cutline -dstalpha INPUT.tif OUTPUT.tif This will add an alpha band to the output tiff which masks out the area falling outside the cutline. P.S. duplicate question


2

In the imagemosaic setting (in the layer page), try setting "output transparent color" to black


2

Does the data get reprojected? Typically when I reproject raster to a different coordinate system I get black edges like that, because the raster file itself is rectangular, but the area covered by the reprojected data isn't. The black parts are areas of 'nodata'. If it's an issue of the look of the thing, perhaps you can make nodata transparent or white?


3

Rather than looking for a specific package for raster time series you could look for functions for smoothing, and then use these with the calc function in the raster package. Here is an example for Savitzky-Golay: http://stackoverflow.com/questions/37843942/smoothen-rasterstack-using-the-savitzky-golay-sgolayfilt-signal-in-r/37846229#37846229


0

Might not be fully automatic but you could run a function in your Python Console which loads a style file from a specified folder with the same name as your raster. Insert the following code into the console: def run(name): # Change path accordingly style_path = 'C:/Users/You/Desktop/Style_Folder/' + name + '.qml' for layer in ...


1

Here is an approach. Some example data: library(dismo) # points n <- 10 set.seed(123) xy <- cbind(runif(n, -150, 150), runif(n, -50, 50)) # polygons p1 <- rbind(c(-180,-20), c(-140,55), c(10, 0), c(-140,-60), c(-180,-20)) p2 <- rbind(c(-10,0), c(140,60), c(160,0), c(140,-55), c(-10,0)) p3 <- rbind(c(-125,0), c(0,60), c(40,5), c(15,-45), c(-...


0

This was implemented in RFC59.1 in GDAL release 2.1.0. def BuildVRTOptions(options = [], resolution = None, outputBounds = None, xRes = None, yRes = None, targetAlignedPixels = None, separate = None, bandList = None, addAlpha = None, ...


0

You can try the following: First add a column with that has "double" format to your combined raster and name it "UID", you can use the following code in field calculator to generate unique id's for the new "UID" field you added. # Code to put in the code block rec=0 def autoIncrement(): global rec pStart = 1 pInterval = 1 if (rec == 0): rec ...


0

Not tested but try something like: ( ("raster1" != 0/0) * "raster1" + ("raster2" != 0/0) * "raster2" + ("raster3" != 0/0) * "raster3" + ("raster4" != 0/0) * "raster4" + ("raster5" != 0/0) * "raster5" ) / 5 where if a pixel does not equal a nodata value (0/0) then it will return the original value (otherwise return a zero) and continue on with summing ...


0

EMVTP (http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/extract-multi-values-to-points.htm ExtractMultiValuesToPoints) can extract several attributes, from several rasters at a time. This is how it works: in_point_feature = "ResearchPlots" in_raster_and_fields = [["SoilData", "Texture"], \ ["SoilData", "...


0

There is a qgis plugin to do this in the main repository: Colour Scale Bar for One-Band Rasters and works well for me http://www.bc-consult.com/free/bccscbar.html


2

I've experienced the same problems you area having in your second method. I exported a Raster to a Vector and try to and use v.generalise and I get mostly smooth polygons with the occasional 'stepped' boundary which appears to have been unaffected by the algorithm. I found a process that worked for my task, not sure if its the best way but thought i'd share ...


0

Process your MODIS snow cover product using Calculate Statistics tool under data management toolbox before attempting to open the product as the classified map. Then go to the ArcMap layer>>right click on the layer>>properties>>symbology>>classified.


0

on your screenshot, there is a problem with the cell size. The unit in mercator cylindrical is meter, therefore your should "convert the cell size from degree to meters. If your input cell size is 0.04166 degree, I suggest that you use 4000 m (at the equator, 1 degree ~= 110 km and it decreases towards the poles, here I take a rounded value with something ...


0

I think the solution to what you call "buffer" is to create a MASK raster in GRASS. Then the r.neighbors analysis (and all other raster analyses) will be limited to the area covered by the mask. You would do that in GRASS by converting the polygon to a raster, and naming it MASK: v.to.rast input=<your polygon> output=MASK use=value


5

It is possible if you convert your raster to a vector layer. Quick example, starting from this classification raster: Use Raster > Conversion > Polygonize to convert it to a vector layer: If you want to create points over a whole class (and not over each separate "patch"), use the Vector > Geometry Tools > Singleparts to Multiparts tool. ...


0

The buffer tool from the raster package lets you work with both rasters and Spatial* objects. To to create a buffer for a single point: library(raster) pt <- SpatialPointsDataFrame(data.frame(525000,9250000), data = data.frame('Pt1'), proj4string = CRS("+init=epsg:32736")) pt.buf <- buffer(pt, width = 500, ) It returns a spatial polygon: > ...


1

If you want to preserve the names of your rasters, consider saving your shapefile as a feature class in a geodatabase . See here for feature class field name limits.


1

This process worked for me: http://ssrebelious.blogspot.co.uk/2012/09/raster-extent-modification-using-qgis.html "In QGIS you can change extent of the rasters. Lets examine one of the worst case scenarios. There are two overlapping (one band) rasters A and B. Say, we need to add A values to B values and get the final image to have extent that will contain ...


0

If I understand your issue, this can be done with gdal (stand alone gdal or use from QGIS). Using gdalbuilvrt you can create virtual raster templates (aka the vrt) with the extent and resolution that you want (-tr xres yres for the resolution, -te xmin ymin xmax ymax for the extent.) This will not create new rasters but xml files that you can handle like ...


0

Doing an ncdump on the data from one of the soest files gives this chunk of metadata for the precipitation flux variable: double pratesfc(time, latitude, longitude) ; pratesfc:_FillValue = -999000000. ; pratesfc:colorBarMaximum = 0.005f ; pratesfc:colorBarMinimum = 0.f ; pratesfc:coordinates = "time_run ...


1

GRASS's r.statistics may be what you want. If you rasterize your shapefile (with unique id's for each polygon) you can include it as the 'base' layer, with your land use raster as the 'cover' layer. GRASS zonal statistics will not work for what you want.


1

The Spatial Analyst tool Map Algebra can be used to apply a "conditional" on whether a land-cover cell is within the road buffer area, or not. I recommend first using Polygon to Raster to create a raster from the road buffer. Be sure to give a consistent cell-size and raster type (integer, preferred for performance.) This will give a black-and-white raster ...


2

If you know how to access gdal from the OSGeo4W command line shell which comes with QGIS, you could try gdal_translate to export the first 3 bands: gdal_translate -b 1 -b 2 -b 3 input.tif output.tif


1

Double-click your raster to access its properties then go to the Style tab as you have shown in your question. Make sure the render type is set to Singleband pseudocolor: Click Apply and OK. Make sure the raster layer is still selected and run the following code to change the min and max values: rLayer = iface.activeLayer() provider = rLayer....


2

Point sampling tool works perfectly if the spatial reference (projection) of the raster data and the point shapefile are same. Working with different projections for the raster(s) and shapefile data will create a shapefile with empty column of raster (Null) values. You need to change the projection of point shapefile to be similar to the raster data to get ...


1

You can use the reclassify tool. http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-analyst-toolbox/reclassify.htm


0

Based on the raster calculator you can use the following formula: RASTER/(RASTER>0) This way you will get all values less than 0 as No Data


0

@phloem's answer only works in cases where your raster has positive values only. For a raster myrast with both negative and positive values, try the following: Float(Int("myrast"*100 + ((myrast > 0)*2 - 1)*0.5))/100.0


1

I don't know if that can be done interactively in Arc. You can use a python script to find the value of each of the 8 neighbor cells (for each cell in your population raster). If a cell has a value>0 and 1 or more cells with values greater than 0 but not all of them is a coastline cell. This code helped me, or at least show me how to do: https://gist.github....


1

No worries - I have done it via converting polygon to a raster and multiplying by the original raster. Then removing the black in the transparency tab of properties. If anyone else has a similar problem this works!


1

I don't know if there is a similar tool in QGIS, but in ArcGIS there is a function called Extract to Points (under Spatial Analyst Tools - Extraction). I have been using this with big datasets, and it works. However, you would have to define the points initially that you want to extract the data too. If you wish to lower the resolution, you could use a tool ...


-1

I have seen the same problem. In my case the raster and the clip vector are both in the same space so there is no need for a transformation. It worked with earlier versions of GDAL so I suggest regressing to 2.02 and it will work.


0

The best tool I tried is "Thematic raster summery" implemented in Hawth tool . The result is a dbf file which is opened in excel. In this file, rows are your polygons and values inside columns represent the number of each pixels for a unique raster gridcode. Good luck.


0

If you want to change the CRS of the raster, use Raster -> Projections -> Warp(Reproject), choosing a different filename and WGS84 EPSG:4326 as target SRS. DO NOT use Set Layer CRS for this task, it will corrupt your data. To avoid future mistakes, remove the original layer from the canvas, and set the project CRS to WGS84 as well. With the raster ...


1

You are missing pixel dimensions: SELECT ST_AsRaster(ST_Buffer(ST_GeomFromText('POLYGON((-30 40, -20 30, -25 20, -23 10, -30 40))', 4326), 50),100,100,ARRAY['8BUI'],ARRAY[118]);


0

Can you try just (works fine for me when I just want the math): tcorr_arr = arcpy.RasterToNumPyArray(tcorr,nodata_to_value=0) Also, not sure if this is causing the errors, but doesn't seems rigth to me: says: cfactor = mean - double_std Shoud say: cfactor = arr_mean - double_std


0

Start by reading the reference for L.ImageOverlay, and browse plugins such as L.ImageOverlay.Rotated and L.DistortableImage.


0

Raster format is not the best format to display points: you should display your data with points. That being said, you have two solutions : 1) change the rasterization settings by selecting a larger pixel size as an output. With v.to.rast you must first define the resolution of the region ( g.region vector=your_vector res=5000 -p -a), with gdal_rasterize ...


2

Your model appears to be correct and you are using the %value% correctly, that is the ID of what your are calling your station number. The error message says you have no spatial reference, i.e. either your DEM or Polygon dataset are missing a defined coordinate system. So you need to make sure they have that set. Look into the Define Projection tool. It ...


0

From this thread (How to modify single Pixel values in QGIS?) this is suggested and appears to do what I want: Create a new point shapefile with a point in each pixel - give it the 'new' elevation as an attribute Run Raster -> Conversion -> Rasterize Select your point shapefile with appropriate elevation attribute as the vector input Select the ...


0

Turn your lines into polygons with a width larger than the resolution of your DTM raster. Rasterize the polygons to the same resolution as your DTM. Finally using the raster calculator, add the two rasters together.


1

Its easier to solve this issue by using the 'identify' method of QgsRasterDataProvider and a little bit of GDAL Python. I used a very simple rasters (20 x 20) to test my approach. The first one was an aleatory raster with values between 1 and 100. The another one was the 'minimum' raster; whose values were all 50. It looks like this: The code is: from ...


2

There is no standard color palette for spectral indices. The most important is to represent the indices in a way that can understandable to someone looking at the map. Choosing a color palette is a matter of personal preference, some people prefer a range of strong tone with various (different) colors, others may prefer a range of same color (light to dark ...


2

Solution assumes your classes are topologically correct polygons, i.e. there are no gaps and overlaps between them. Class defined by value stored in field GRIDCODE #define boundary between polygons and delete outer ones arcpy.PolygonToLine_management(in_features="polygons", out_feature_class="D:/Scratch/lines2D.shp", neighbor_option="IDENTIFY_NEIGHBORS") ...


3

It looks like your issue here is with your function x. Since nothing is being returned from the function, you cannot iterate over it. I would suggest making use of the yield keyword. This will return a generator which you can iterate over. Essentially it returns each result in the function in turn. For example: def a_function(x): for i in range(x): ...


5

You can extract raster values of population density and land elevation to village point shapefile using Plugin: Point sampling tool which can be downloaded from plugin manager in QGIS. The tool works perfectly if the projection of the raster(s) data and the point shapefile are same. Working with different projections for the raster(s) and shapefile data ...



Top 50 recent answers are included