Tag Info

New answers tagged

0

The topology extension has to be CREATEd separately: CREATE EXTENSION postgis_topology; As to why also your raster functions fail: could you verify you are trying to use a version of PostGIS with raster support compiled in? (see http://www.postgis.net/docs/RT_FAQ.html#idp61635392)


0

I would suggest you to try gdal2tiles.py gdal2tiles.py --force-kml --webviewer=none [input file] [output_dir]/ Would create a directory with all tiles and the KML file. Simply compressing it into a ZIP file and changing the file extension to .kmz gets you a KMZ file ready to put onto your GPS device. You could also script the whole process in bash: for ...


0

I figured out that I need a mask layer to cover the values that I do not want to be changed. So, I created a polygon of my "inverse" PA layer, and put it in r.mask as mask layer. Then, in r.mapcalculator, input the source layer and in equation just wrote -1*A. I did the same for my PA layer (as mask). Finally, I have two layers, one with positive and the ...


1

This might do it: r.mapcalc "distances_with_negatives = if(isnull(B), -1.0*A, A)"


0

You can run your cell statistics with all the rasters (GRIDs) as they are. Provided you haven't put them into folders that are too deep in the folder structure (more than 128 characters), but there are ways to get around even that: In a command window type SUBST /?, this will show you the help for the subst command. You can set a 'fake' drive to a path deep ...


0

You can try reprojecting the raster data but to EPSG:102113 instead, don't use 3857. This post may help: Reprojecting WGS 1984 Web Mercator (EPSG:3857) in Python with GDAL


1

here is the solution : you can use this code QString myFileName = QFileDialog::getOpenFileName(this, tr("Open File"), QCoreApplication::applicationDirPath () + "/data", tr("GeoTiff (*.tif)")); QFileInfo myRasterFileInfo(myFileName); qDebug() << "myFileName =" << myFileName; QgsRasterLayer ...


0

Since a raster is always a matrix of individual pixels, there's no way to get rid of the zig-zag along the edges, when you clip on an angle. However, if you can increase the resolution of the raster (interpolation to a higher resolution) then the gaps will be small enough that it should not be a problem.


1

In your case I would recommend to set up a WMS service using mapserver or something equivalent, and then requesting tiles from the WMS endpoint. http://mapserver.org/ogc/wms_server.html This is a very flexible approach, as on the backend you do not need to worry about the exact TMS tiles definitions (indices and bboxes etc). Instead, let the frontend ...


1

It depends what you mean with georeferencing. There actually is the ST_Georeference function which doesn't change the raster itself, it simply defines where the raster is located in space by setting 6 offset/scale/skew coefficients. As mentioned by @JohnBarça, your raster should have the proper georeferencing metadata, but sometimes it doesnt, and that is ...


3

In 4th line: QString MyRaster = myRasterFileName + myRasterFileName; Should be: QString MyRaster = MyRasterPath + myRasterFileName;


0

You might try an OS Crawl while listing your rasters and running the CellStatistics and saving the result into the same location as the parent. I got the following to work on folders of .tiff rasters. import arcpy import os import math arcpy.CheckOutExtension("Spatial") from arcpy.sa import* import sys arcpy.env.overwriteOutput ...


4

Here are some ideas. With base plot you can do plot(x, interpolate=TRUE) You can also resample your data y <- disaggregate(x, 5, method='bilinear') Or indeed smooth it using a focal operation y <- focal(x, w=matrix(1, 5, 5), mean) Or a combination y <- disaggregate(x, 5) y <- focal(y, w=matrix(1, 5, 5), mean) The question ...


1

Compute the focal (neighborhood) maximum of the flow accumulation grid, using the smallest circular neighborhood you can get away with. Extract the values of that grid along the river features. Given that flow accumulation grids are usually computed as sums of unit values, and therefore have integral values, you might also consider selecting the locally ...


2

It sounds like you have a DEM and you want to augment the accuracy of that DEM with some elevation data you collected as points. That's totally possible but the process probably isn't as linear as you would like it to be. That is - you can't (to my knowledge) update the values of raster cells from vector points directly. You have to go through the process ...


0

Use Extract Values to Points in Spatial Analyst Extension. Also you can use Extract Multi Values to Points. You need a shapefile with the points of interest. This tool add the values of the raster to the attribute table of the shapefile.


-2

We developped an algortim and you have a type of solution in http://wikhydro.developpement-durable.gouv.fr/index.php/D%C3%A9tection_de_remblai_avec_le_LIDAR. R-Grass sources working in the processing tools of qgis are available if you want Best regards Frédéric Pons Cerema


2

You cannot have R objects called "2000", so presumably these are fake names? Your example actually should work, so you may want to double check why you think that the results are incorrect. @aaryno's approach should work. I would do this: library(raster) s <- stack(r2000, r2001, r2002, r2003, r2004, r2005) x <- reclassify(s, cbind(0, NA)) r <- ...


3

I wanted to point out that you can rewrite the mean function, mean, which you can write yourself to do anything you want, including ditch the 0 values and calculate the mean. For example, if you want to ignore 0s: meanIgnoringZeroes <- function(x) { mean(x[x!=0],na.rm=T) } Then you can pass the function, meanIgnoringZeroes to overlay: mean <- ...


-2

Perhaps you should try this : new_file=na.omit(file). I think with this you can ignore NAs.


1

Rather than playing with conditional statements (which are fine, but not necessary here), I would just do the following in raster calculator: ("raster.tif" * 0) + 1 Simple and effective.


1

You can use a conditional statement in the raster calculator as follows: Con("your_raster.tif" >= 12, 1, "your_raster.tif") This command assigns any value greater than or equal to 12 a value of 1.


2

Have a look at the Reclassify tool (Spatial Analyst).


4

Compute focal means of the indicators of each vegetation type. At each cell, these give the proportions of the types. Multiply each by its negative logarithm and sum: that's the diversity index. You will find that even for large numbers of categories (even into the hundreds), this is fantastically faster than the brute-force method of tabulating each ...


5

Here's a simple implementation for you. Edit: fixed focal weights matrix to exclude 0s as per whuber's comments in his answer. library(raster) # Example Data set.seed(1) r <- raster(matrix(sample(1:10, 100, replace=T), 10, 10)) # Calculate a weights matrix, and reset elements to 0s and 1s # rather than true weights fw <- focalWeight(r, 0.2, ...


0

You might try turning on anti-aliasing in your graphics drivers. ArcScene should benefit from this since it uses OpenGL to render in 3D using your graphics hardware. Be aware though that this tends to require a lot more graphics card resources. Also note that ArcMap will not benefit from this, since it renders in software. If you have ArcGIS Pro, it should ...


3

You want the Clip tool in the Data Management/Raster/Raster Processing toolset, and because you have multiple rasters it would be a good opportunity to use the Batch option with the tool. Here's the way I like to deal with that interface: right-click on the tool in the toolbox and choose Batch... You see each tool instance as a row, with the columns being ...


0

The Clip tool in the Data Management toolbox in ArgGIS 10.3 allows you to clip rasters with a shapefile without having to use Extract by Mask.


2

If you go to this site (I did nothing more than a simple Google search) there is an online calculator. Right at the top is a link to an Excel file this appears to contain all the logic you require to compute your soil texture type. I would suggest you look there first as all you need to do is transfer that logic to a python/model environment. As for ...


0

Thank you all for your answers, it was actually "Tabulate area" the option that I needed, because it let me set up specific zones for both the raster and the polygon layer. You were right Chris, I had not exhausted all the zonal options :)


2

There is no function, but you can use the modulus operator, which is "%" in GRASS (as in many other languages), e.g. 8%5=3 for a pixel-by-pixel computation, simply use the layer names layerOne%layerTwo


1

Gery, I am in a similar situation. I don´t need to hide or show the different rasters separately. If that's OK for you, this is what I did: As far as I know, in the mapfile - Layer - Data you can only specify one file, but you can create several identical layers with the very same name, each one of them pointing to a different raster. Loading this WMS ...


0

If you want to actually move one raster so that the cells of both rasters align (i.e., 36 cells from the first raster fit perfectly over one cell of the second), then you can register one raster to perfectly overly the other. This overwrites that raster's georeferencing data though. You can also resample one raster with the environment settings such that the ...


0

This may be what you're looking for: Joining tables to your raster attribute table See also: Essentials of Joining Tables A second probably more difficult option is to manipulate your CSV file to match Arc's ASCII raster format and then use ASCII to Raster to create a new raster that perfectly overlays your target raster, then Combine those two rasters.


0

By now it is likely you have solved this, but for those of you who still are looking for this, you can do this with the raster calculator in QGIS. The example Fezter refers to, is unfortunately extremely simplified. Lets say you have values from 1 to 360 that you want to reclassify into 3 classes, then the syntax should look like this: ("raster" < 90) * ...


2

To select the files you could parse the numbers, but if the file names are as regular as you say (January is '01') I think you can also use their character representation ( '9' > '8' == TRUE ) library(raster) selectedFilesFun <- function(files, start, end, fun) { b <- basename(files) b <- substr(b, 2, 9) i <- b > start & b < ...


0

Here is what Mikkel suggested (use of max) library(raster) cell100 <- raster(nr=3, nc=3, vals=c(100,0,0,0,100,0,0,0,100)) cell101 <- raster(nr=3, nc=3, vals=c(0,0,101,0,101,0,101,0,0)) r <- max(cell100, cell101) as.matrix(r) # [,1] [,2] [,3] #[1,] 100 0 101 #[2,] 0 101 0 #[3,] 101 0 100 Another (more complex) approach could ...


1

This workaround should work: Create fake world files (.wld or .j2w). Use pixel size 1, -1 and put the origin of your master image into 1,1. Check the size of your images is pixels (width, height) with gdalinfo and calculate origins for the other tiles to match. Remember these: origin is at the center of the top-left pixel Y (northing) is decreasing from ...


0

I tried the Raster Calculator method LeonB used but ran into Out of Memory error, which is crap given my system specs. Wrote a small stand-alone python script - modified from here - in IDLE that worked for me... import arcpy from arcpy import env from arcpy.sa import * env.workspace="D:/Watershed/" inRaster="D:/Watershed/tamtr14_1m" ...


1

One way to get statistics for each band in QGIS raster layer is: Go to Raster menu Expand the Miscellaneus list and select Information... tool In new window select your raster layer Activate command edditing with a Pencil icon Add -stats flag to a command (between gdalinfo and path to raster) Run a command. As a result you will see log with simple ...


0

You can use the tool Clip (Data Management) to create a new raster of only the areas that you want. For this to work you need a mask (polygon) of the areas that you want to keep. In image 1, I have the image that I want to crop and the polygon of the areas that I want to keep. Image 2 shows the setting of the tool Clip (data management). In order for the ...


4

You can make a paletted raster by assigning a colortable in the legend. If you have a raster called r and a data frame like yours above called ctab, with value and red/green/blue colour values, you can do something like this: > ctable = rep(NA,max(ctab$value)+1) > ctable[ctab$value+1] = rgb(ctab$red,ctab$green,ctab$blue,maxColorValue=255) > ...


2

Nearest neighbor is exactly what you describe by (1). (2) would be some form of interpolation, bilinear if you just multiply the color values by the percentage overlaps. Docs are here: http://postgis.net/docs/RT_ST_SnapToGrid.html Also consider ST_Resample: http://postgis.net/docs/RT_ST_Resample.html I noticed that the docs don't really describe how the ...


1

A simple "ifelse" statement should suffice in evaluating a condition. Here we create two random vectors of [1,2] and apply an ifelse to evaluate the condition of if x = 2 and y = 1 THEN change (1) ELSE no change (0). ( x <- round(runif(10, 1, 2)) ) ( y <- round(runif(10, 1, 2)) ) ifelse( x == 2 & y == 1, 1, 0) Since this is just an ...


-1

I just tried with combine (local in Spatial stat tools) and it worked just fine (need to be carefull with the raster parametes in each date data set), the first column shows the first year, whereas the second shows the last (LC change analysis). Now I'll compare these values with the ones I got from Idrisi land cover change modeler and see if they're the ...


0

Shouldn't matter if it is just the data frame, but looking at the dimensions and orientation of those tiles it looks like you have a projected data frame or data. Have the tiles been projected? You'll need the original geographic tiles. For something small like this I usually just mosaic rasters with the Image Analysis toolbar and export that to a file after ...


0

The tool I would use is Euclidean Allocation, this will 'stretch' out your values based on the existing closest value (not changing any existing values), then use Extract by Mask to get the area that's just within the extent to keep it neat. The Euclidean Allocation tool (spatial analyst required) only works with integer rasters, if you have floating point ...


1

It's just a display option. In ArcMap, right click the layer in the Table of Contents, select layer properties, Display tab and change resampling from bilinear to nearest neighbour.


0

The QGIS Processing toolbox is very well done, but the problem is that the "external" applications used (GRASS GIS, SAGA GIS, ...) are not QGIS and most QGIS users are unfamiliar with them. The original GRASS GIS command is r.cost (6.x) or r.cost (7.x). This is a command with many options. They are simplified in the toolbox with 3 commands, r.cost, ...


5

Index each day with its year and julian day. September 1 is 244, March 31 is 90. Not knowing the format of your files, you can probably figure out a date format to use to parse and turn it into a POSIX date (from http://stackoverflow.com/questions/21414847/convert-a-date-vector-into-julian-day-in-r): tmp <- as.POSIXlt("16Jun10", format = "%d%b%y") ...



Top 50 recent answers are included