New answers tagged r
0
votes
How to prepare the spatio temporal data sets for Spatio-temporal variogram?
If you are using the spacetime package, you can pass it vectors of space time indicies and a Spatial-class frame (e.g. SpatialPointsDataFrame from sp). Here is an example.
library(spacetime)
library(...
0
votes
Spatio Temporal Interpolation with gstat in R
Heyyyy,How are you creating these spatiotemporal data sets.
I am facing troubles to make one.
I have satelite data for 10 days (say 01-01-2018 to 11-01-2018)
at lat long and data values
How to create ...
1
vote
Accepted
Create multiple rasters in PostGIS from a (xyz) table
The Good News: There is an rpostgis package on CRAN which has a pgWriteRast function that can create a PostGIS raster.
The Bad News: You only have another 9 days in which you can use it.
It works by ...
1
vote
Colouring wrld_simpl countries with a variable
Its using the integer value behind the factor for the colouring, and then getting the colour from the current palette.
Convert the factor to character if you want to use a factor column's levels as ...
0
votes
How to remove NA value of legend when using R tidyterra?
I prefer using tmap. Note my order of loading libraries, placing of functions, arguments and replacing == with %in%. This can be reproduced even more parsimoniously using other tidyverse functions I ...
1
vote
Tracing a Route on a Map
Check with an online map. The red point top left is Toronto Airport, but all its roads approach from the north, so you haven't included them by using the bounding box to get the OSM data.
Expand the ...
3
votes
Accepted
Mathematical formula to convert lat-lon to Lambert Conformal Conic
So I've figured it out.
I had the right formula. To validate that, the projection wkt gives:
METHOD["Lambert Conic Conformal (2SP)",
ID["EPSG",9802]],
Which fits with ...
1
vote
Accepted
Mean and standard error of raster data
That SE seems reasonable. Reversing your calculation tells us that you have
> (87/0.02)^2
[1] 18922500
about 19 million pixels. If I create 19 million values from a normal distribution from the ...
0
votes
Accepted
Pixel level landcover change analysis
Ouch, that double loop is quite unnecessary :) You can use the terra::crosstab function to evaluate class-level change. We will move this analysis to terra so that the depreciation of raster will not ...
0
votes
Accepted
Decide consensus after finding location of unknown point with distances to two known points
Here's how to do it by finding the point that minimises the sum of square differences between the distances in the data and its distance to the points.
If the data were perfect, each circle ...
1
vote
Accepted
MODIS MCD641 quality bits from TIFF file in R
This boils down to "select where bit 0 and bit 1 = 1".
Counting up from 0, this happens every fourth integer (ie its true for 3, 7, 11, 15,...). So you can use a modular arithmetic operator, ...
0
votes
Opening .NC file in R online rather than downloading it
Try OPENDAP url instead if there is any available for your data.
1
vote
Accepted
Extent not found on NASA's Black Marble monthly images - How to set it?
Read the data using terra::rast - I'm not sure what sds wins you here, this works:
r <- rast("VNP46A3.A2018182.h06v05.001.2021125183820.h5")
Define the coordinates to be lat-long WGS84:
...
0
votes
Accepted
Distance measure that constrains a walk over land and accounts for the shape of the Earth
Here is a Stanford computer science paper from 1992 that describes an algorithm: https://graphics.stanford.edu/courses/cs268-09-winter/notes/handout7.pdf . Unfortunately the coding is left to the ...
0
votes
R sf package: Error in subsetting geometries - "invalid subscript type 'list'"
st_within() and I think all topological relation functions return a sparse matrix (in a list: see https://r.geocompx.org/spatial-operations.html#topological-relations).
You can have multiple points ...
0
votes
Get values from raster file in R
The .ovr file contains "overview" images - lower-resolution versions of the main data file to make mapping at low resolutions quicker, for software that understands it.
If you try creating a ...
1
vote
Accepted
Error using "if" in R: "== : missing value where TRUE/FALSE needed" for spTransform
There's a few problems here: d1 at the error point has an NA (missing) CRS so any attempt to reproject it with spTransform will fail.
On my system it fails with a different error message:
> d1=...
0
votes
Double indexing and looping over raster lists in R
This aproach shoud work:
re_zero <- list()
for(i in 1:length(re)){
r <- re[[i]]
r[is.na(r[])] <- 0
re_zero[[i]] <- r
}
0
votes
Issue with scaling factors for Landsat Collection 2 Level 2 data when calculating NDVI
I don't understand why this problem has been around so long and not fixed at this stage. Not sure what the benefit is to spread the range of digital numbers way beyond the original range to create an ...
0
votes
Accepted
vis.gam spatial interaction output as a raster grid instead of plot object
You're very close - create a grid of X-Y values and a single value of green (or other covariates) and use predict.
Fit the model:
fit <- gamm4(age~ s(x,y) +s(green),data=gambia)
Make a 150x100 ...
1
vote
read geojson file which is not in CRS 4326
I don't think the CRS is a problem here. Although the geojson spec says "only use epsg:4326" there is a paragraph in the spec where it grudgingly concedes that if two people agree to use ...
2
votes
Function to draw lines based on starting point, angle and length
Loads of ways of doing this. Easiest may be to compute the X and Y coords of the start and finish points in R and create a GeoPackage and load that into QGIS instead - use the sf package in R to do ...
Top 50 recent answers are included
Related Tags
r × 5704raster × 1721
sf × 593
coordinate-system × 458
shapefile × 420
qgis × 374
polygon × 336
sp × 298
rgdal × 196
lidr × 196
spatial-statistics × 181
arcgis-desktop × 159
gdal × 154
terra × 149
python × 137
ggplot2 × 135
leaflet × 120
netcdf × 113
lidar × 107
kriging × 105
point × 104
interpolation × 104
geotiff-tiff × 102
modis × 100
distance × 98