New answers tagged

1 vote

Could not open CMIP6 data downloaded from worldclim (v 2.1)

I had this same problem opening 2081-2100 tifs in QGIS. Some of the models worked, including wc2.1_30s_bioc_MIROC6_ssp585_2081-2100, but more than half, including wc2.1_30s_bioc_MIROC-ES2L_ssp585_2081-...
user avatar
1 vote

GeoServer raster data store URL

Now you can, using the COG community module: https://docs.geoserver.org/latest/en/user/community/cog/index.html Mind, the TIFF you're pointed at must be a valid Cloud Optimized GeoTIFF.
user avatar
  • 15.5k
1 vote

R Terra: Write multiple time series variables to NetCDF

A SpatRasterDataset does not have a time dimension. The SpatRasters it contains can have that dimension, and it may be different for each SpatRaster. Here is a simplified script that suggests that all ...
user avatar
0 votes

Define raster extent

This turned out to be a case of a projection issue (see my edits). As noted by Vince, this shouldn't be this hard. Nevertheless, I was interested to see whether I could use ArcPy to achieve the same ...
user avatar
  • 23
1 vote

Using raster object to normalise rasters

The error is happening because you are making up methods that do not exist for the object in question. You should always refer to the help file when coding and if you look at the page for the Raster ...
user avatar
  • 38.5k
1 vote

Polygonize/Vectorize large raster

I would point out the a 47000 x 37000 pixel raster contains 1.7 billion pixels. If your binary raster is mostly "salt and pepper" (1's and 0's not clustered into contiguous areas) then you ...
user avatar
  • 14.2k
0 votes

Exporting raster of a map to QGIS from GGplot in R

Your question reminds me of a quote from a smart fellow: "You're trying to get back the fish after making fish soup". You should be saving to a "*.tif" raster file the density that ...
user avatar
  • 14.2k
0 votes

ArcGIS clip raster with polygon - keep only cells that are fully within the polygon

This can be done after masking out conflicting cells at boundaries of polygons. So set sell size and snap raster to original raster and: PolygonToLine_management("POLYGONS", "in_memory/...
user avatar
  • 21.4k
0 votes

ArcGIS clip raster with polygon - keep only cells that are fully within the polygon

I think the issue here is that your polygons are captured using a different technique (e.g. manually captured) and scale so they don't align with the raster cells. Here is a simple model that will ...
user avatar
  • 38.5k
1 vote

How can I improve the accuracy of a DEM using surveyed points?

Don't be fooled into thinking that you are improving the accuracy of your data. The only 'accurate' data would be the survey points themselves. You apparently do not know anything about the quality ...
user avatar
  • 7,137
1 vote

Showing historic path of river using ArcMap

This image appears to be a relative (detrended) surface model derived from LiDAR data and then symbolized with a monochromatic color ramp based on the resulting detrended surface's elevation. The ...
user avatar
  • 7,137
1 vote
Accepted

Dynamically mask raster layer by features from vector layer in GeoServer

No, that's currently not possible. You can get something similar but setting up the GeoFence extension and managing its rules, which include cutting rasters over polygons. GeoFence has a REST API that ...
user avatar
  • 15.5k
1 vote

Showing historic path of river using ArcMap

Such an image is built from a time sequence of data. DEM's tend to be a single time period so you could never build such an image. Satellite data over a long time period would work, the obvious is ...
user avatar
  • 38.5k
1 vote
Accepted

ArcGIS Pro Pixel Editor - Saving takes forever

A 3GB raster is a large dataset so any edits will take time. Perhaps you can get smarter with your edits. You don't actually describe in any way what you are doing so maybe these pixel locations you ...
user avatar
  • 38.5k
0 votes

Soilgrids points outside of projection domain

Perhaps this is because the extent of your template raster is a bit off: -180.0001, 179.9999, -90.00014, 83.99986 (xmin, xmax, ymin, ymax) Now, -180.0001 is not wrong (it is the same as 179.9999) but ...
user avatar
2 votes
Accepted

Merging rasters from multiple days in loop using ArcPy

Here is the code you can use, obviously I don't have your data so I spoofed it up with text files, so you need to edit the code and replace the txt with tif. Here is my sample data: # Import modules ...
user avatar
  • 38.5k
0 votes

Merge a .gpx with a DEM

Run Menu Raster > Conversion > Rasterize the line. Set the value for A fixed value to burn to 10 and define Output raster size units (either pixels or layer units) and set the resolution you ...
user avatar
  • 40.1k
1 vote

How do I change my view to nadir in QGIS?

I had the wrong CRS. After searching through, and trying several of the WMS services with NADIR imagery mentioned by Vince without significant changes, I tried making a new project altogether and ...
user avatar
1 vote

Artificially extend a DEM to clip it

I found a way to do it on Python: (PS: I USED A DIFFERENT DEM FOR THE EXAMPLE, TO DEMONSTRATE HOW TO DEAL WITH BORDERS) # Open the DEM and extract all the info about it src = rio.open('IfSAR_merged....
user avatar
  • 107
0 votes

Check for NAs in `RasterLayer` and plot them in different colour

Example data f <- system.file("ex/elev.tif", package="terra") r <- rast(f) Count the cells that are NA (1, TRUE) or not-NA (0, FALSE) freq(is.na(r)) layer value count [...
user avatar
0 votes

Extract by polygon from a rioxarray's raster

The answer was simpler than I thought, just calling zonal_stats from rasterstats: nbr_zonal = zonal_stats( vectors=polys, raster=nbr_mosaic[0,:,:].values, # since it's a 3D array affine=...
user avatar
  • 11.8k
0 votes

How to create suitability map from categorical raster and Euclidean distance raster in ArcMap

Agree with what @Oliver Burdekin has mentioned. As suitability modelling is an iterative process and you start off with applying a set of weights for each raster layer, you could extend this to cover ...
user avatar
0 votes
Accepted

How to create suitability map from categorical raster and Euclidean distance raster in ArcMap

There is detailed documentation on esri's site outlining the process of suitability modeling. Suitability modeling is an iterative process. As such it can be beneficial to set the process(es) up in ...
user avatar
4 votes
Accepted

Saving Mapzen Global Terrain in QGIS with extent layer (-90 to 90 Lat and -180 to 180 Lon)

No. Mapzen Global Terrain tiles will be designed for use in Web Mercator projection, which only goes to ±85.05.. degrees of latitude. From Wikipedia: Because the Mercator projects the poles at ...
user avatar
4 votes
Accepted

How to treat NAs using a custom function in the lapp function of {terra} in R

As @Spacedman says, a vectorized solution should work this function should give you the expected result. t <- lapp(c(r,s), fun = function(a,b){ a[is.na(a)] <- 55 ...
user avatar
2 votes

How to treat NAs using a custom function in the lapp function of {terra} in R

This from the docs: Before you use the function, test it to make sure that it is vectorized. That is, it should work for vectors longer than one, not only for single numbers. Let's test: > fun(...
user avatar
  • 51.2k
0 votes

GDAL raster shifting with python error: 'NoneType' object has no attribute 'GetGeoTransform'

To solve that, just put an r before the path: rast_src = gdal.Open(r'C:\temp\raster1.tif', 1)
user avatar
0 votes

Translating (reposition) TIFF raster layer in QGIS

Here is an example on how you do that with rasterio Reference: An issue I opened and dissuaded a while ago. Example 1: read, reposition/shift, and write in a new tif file import rastrio # specify ...
user avatar
2 votes

Implement plot purchases on fictional map

Here's a workflow using QGIS and some data from the Leaflet examples. Before you start, read the Leaflet tutorial about L.CRS.Simple. I mean it. Stop what you're doing, and read it. Lauch QGIS. Read ...
user avatar
  • 9,285
0 votes

Polygonizing global raster using Python/GDAL?

You can indeed split a raster into smaller tiles, but you will need to know the extents of each tile. gdal_translate and -projwin will give you the result you want. Another solution, one I have used ...
user avatar
3 votes
Accepted

Extracting mean of multiple SpatRasters using Terra?

The terra equivalent of raster::calc is terra::app so, to return the mean for a multi-band raster you would use: rmean <- app(x, mean) or to return the mean for an entire raster: global(x, mean).
user avatar
0 votes
Accepted

Combining GEE layers to create a global categorical raster with class values?

I had to convert my variables into a binary by using .gt(0) or .lt(0) and then multiplying the areas of presence (now assigned a value of 1) by the number I wanted to associate them with. For the ...
user avatar
0 votes

Find the distribution of nlcd categories within polygons

Depending on the exact number of unique buffer polygons you have, my first recommendation is to use each buffer polygon (which should have a unique name & ID) to clip the NLCD raster to a new ...
user avatar
2 votes

gdal_calc - How to calculate where raster A is not equal to raster B?

From GDAL version >= 3.3, you can use --hideNoDatata option to ignore the NaNs in the calculation (it takes the NoData value as if it was a real value).
user avatar
0 votes

Apply linear stretch to Landsat 8 images in the tmap R package

I figured out how to improve the contrast: fcc_nir_s <- terra::stretch(fcc_nir, minv = 0, maxv = 255, minq = 0.2, maxq = 0.98) tm_shape(fcc_nir_s) + tm_rgb() This rescales rasters to 8-bit and ...
user avatar
  • 103
0 votes
Accepted

Count multilinestring elements crossing a raster cell in R

Following @JeffreyEvans suggestion, I achieved it using an "extract" approach: First, I assigned an unique ID to each raster pixel: values(rast.w) <- 1:ncell(rast.w) Then, I used the ...
user avatar
  • 75
0 votes

Apply linear stretch to Landsat 8 images in the tmap R package

Linear stretch with stretch="lin" in plotRGB will stretch up to the max of your data, which is 23358. If you do: tmap(fcc_nir) + tm_rgb(max.value = max(values(fcc_nir))) then you should ...
user avatar
  • 51.2k
0 votes

Why Landsat images are tilted/rotated?

Each near-polar Landsat orbit takes about 90 minutes to complete. The Earth rotates beneath the satellite at a rate of 15 degrees per hour (time zones are split into 15 degree segments). The satellite ...
user avatar
  • 103
0 votes

Reprojecting a raster from long/lat to UTM take 2

Use projectRaster function with crs argument. You can also use terra since it's faster and projection takes a lot of time. But with raster library: r3utm <- projectRaster(from = r3, crs = "+...
user avatar
  • 11.8k
0 votes
Accepted

Expose raw pixel values instead of RGB values of ArcGIS Image Service in QGIS

Solution: the ArcGIS Image Server Connector Plugin is able to load the image service and allow for access to the pixel values. It seems to be having issues with re-loading the layer upon scale ...
user avatar
  • 59
0 votes

projectRaster on a list of rasters

You are reprojecting to the last raster's CRS. It's a bit confusing, I recommend you to: Project to a known CRS (it could be stored in an object as well) Use a raster as template Also, since this ...
user avatar
  • 11.8k
1 vote

using function inside raster::calc with loop

I would use lag function from dplyr package: Your data: library(raster) r1 <- raster(nrows = 1, ncols = 1, res = 0.5, xmn = -1.5, xmx = 1.5, ymn = -1.5, ymx = 1.5, vals = 0.3) rr <- lapply(1:12, ...
user avatar
  • 11.8k
2 votes
Accepted

Unexpected resolutions when aggregating rasters with raster package in R

aggregate function decreases resolution x times according to fact. Since it's x times, fact is a positive integer. This is stated in description: fact postive integer. Aggregation factor expressed as ...
user avatar
  • 11.8k
0 votes

Seeing size on disc of raster in file geodatabase

This may help: https://community.esri.com/t5/geoprocessing-questions/best-way-to-get-size-on-disk-of-raster/td-p/373519 I think you can use ArcPy to get the raster pixel area using the Get Raster ...
user avatar
2 votes
Accepted

How to compute partial correlation of pixels in R

Lets first make some test data: sos = rast(array(runif(10*10*20),c(10,10,20))) tem = rast(array(runif(10*10*20),c(10,10,20))) pre = rast(array(runif(10*10*20),c(10,10,20))) NDVI = rast(array(runif(...
user avatar
  • 51.2k
1 vote
Accepted

raster2pgsql no more INSERT/COPY statement in the log

On Linux (more info): raster2plpgsql [<options>] <raster> >> /dev/null On Windows (more info): raster2plpgsql.exe [<options>] <raster> > NUL
user avatar
  • 1,237
1 vote

Downloading recent GRACE data

It looks like GRACE-FO has already been requested. I found that by searching for "GRACE" in the issue tracker that is linked from the Code Editor's Feedback menu in the top right. (These ...
user avatar
  • 8,546
0 votes

Deleting polygon defined area from raster layer in ArcGIS Desktop?

If you have the polygons of your area and unwanted area, use the Erase tool and make a new shapefile in which you have erased unwanted area in vector format, then apply Extract by mask using this new ...
user avatar
0 votes

How can I get the correct mean from focal() with a circular window?

A somewhat simpler function (but perhaps no faster, though I haven't checked) using raster is to first convert the focal weights matrix to 1s and NAs, then (using focal) multiply the window (x) by ...
user avatar
1 vote

Calculate multiple bands average raster in QGIS with high number of bands

You can use python to build the expression. This should work for any number of bands: rasterlayer = QgsProject.instance().mapLayersByName('infra-red')[0] #Change infra-red to the name of your layer ...
user avatar
  • 51.4k

Top 50 recent answers are included