Skip to main content

New answers tagged

0 votes

Adding borders to 2D plot in ggplot2

If you have your boundaries file, and it contains your region names, we can use geom_sf and geom_sf_text First, assume the following is your plot library(sf) library(tidyverse) NC_counties <- ...
ryanzom's user avatar
  • 136
2 votes
Accepted

How to compute weighted mean centroid of lat+lon points taking into account spheroid

I'm pretty late, but since there are no answers to this question, I want to discuss a few of the easier approaches. Data library(sf) pts <- data.frame( x = c(-100.5, -98.6, -98), y = c(35, 41,...
ryanzom's user avatar
  • 136
0 votes

Overlapping emmissions with Euclidean decay

I have a solution: The focal function of the terra package provides the possibility to pass a custom, weighted matrix as the window. This is a pretty awesome feature of terra, most software only allow ...
Ratnanil's user avatar
  • 1,003
0 votes

Algorithm for catchment delineation with equal size basins

A very good toolbox is the PCraster , but in order to be able to run it you need to have newer QGIS editions , check this video out https://www.youtube.com/watch?v=C3AMh3sZzJQ&t=14s. In PCraster ...
dimitris fotopoulos's user avatar
0 votes

CDO combined commands not working

I'm using: CDO version 2.0.4, Copyright (C) 2003-2022 MPI für Meteorologie and I run: $ cdo -remapbil,r720x360 -sellonlatbox,-80,10,-20,15 \ t2m.daily.an.era5.720.360.2018.nc t2m_daily_ERA5_2018....
Spacedman's user avatar
  • 65.1k
0 votes

R: 'area' function for las-file

@Spacedman anwser is correct but let me add some insight lidR::st_area() extends sf::st_area() and does not clash with sf library(lidR) library(sf) LASfile <- system.file("extdata", &...
JRR's user avatar
  • 9,479
-1 votes

dismo - Plotting individual predictor responses

in this command I would like to: plot confidence intervals in color blue check the coordinates where y is maximum for each variable
Re_di_Roma's user avatar
0 votes
Accepted

Adding WKT to VRT using R / LidR

You must Change the WKT global bit encoding remove the GeoTIFF CRS add a wkt string library(lidR) f = system.file("extdata", "example.laz", package="rlas") las = ...
JRR's user avatar
  • 9,479
3 votes
Accepted

R: 'area' function for las-file

The terra package creates its own area function that is incompatible with working out areas of las objects. From a clean R session: > library(lidR) lidR 4.1.1 using 4 threads. Help on <gis....
Spacedman's user avatar
  • 65.1k
2 votes
Accepted

Cloud masking ECOSTRESS LST data

@Spacedman I found another solution, which seems to work okay and there is no need to install other libraries. library(terra) # working dir wd <- "path/" # read the raw LST lst_raw <-...
Nikos's user avatar
  • 1,093
1 vote

Cloud masking ECOSTRESS LST data

Using the bitops package you can work on values at the bit level: > library(bitops) First test a matrix with all 8-bit values from 0 to 255 in a 16x16 raster: > r = rast(matrix(0:255,16,16)) ...
Spacedman's user avatar
  • 65.1k
1 vote
Accepted

Raster extract function on R return values incompletely

The problem is likely with the cropping and masking of the input rasters before running exact_extract. There is no need to do this - the values can be extracted from the original rasters directly. ...
dbaston's user avatar
  • 13.2k
3 votes

Unable to open .grd file on R using raster

If you look at the linked Fortran code you can see there's no header info or geographic metadata. The file is simply the 129x135x365 values. These are read in by the Fortran code but not printed. You ...
Spacedman's user avatar
  • 65.1k
1 vote
Accepted

Spatial join on R with counting point in grids for different months and years

I would use sf::st_intersects() to count the number of fires, like: smaller_area <- sf::st_read("subset_area.shp") grid <- sf::st_read("GridData/grid_5km.shp") fire_points &...
Grzegorz Sapijaszko's user avatar
1 vote
Accepted

Error when using tmap: Error in if (hover != "" && !hover %in% smeta$vars) rlang::arg_match0(hover, : missing value where TRUE/FALSE needed

Using version 3.99.9001 from github, I get your error, but you can't use tm_borders with a raster. > r = raster(matrix(runif(100),10,10)) > tm_shape(r) + tm_borders() + tm_scale_intervals(style =...
Spacedman's user avatar
  • 65.1k
3 votes

Correlation analysis between large number of environmental rasters

If you have enough memory to read in and correlate two rasters you can do it one pair at a time. I've created a sample set of four .asc raster files. > rastlist [1] "r1.asc" "r2.asc&...
Spacedman's user avatar
  • 65.1k
0 votes

Merging shapefile with data file with coordinates

The issue here is that you are trying to use objects of the sp package with the sf package. Both class systems are usual representations of spatial vectors in R, but you should use now sf as sp has ...
dieghernan's user avatar
  • 1,356

Top 50 recent answers are included