Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [r]

Statistical computing language and software environment.

1
vote
1answer
19 views

Get wind direction from raster stack U and V in R

I have this NetCDF file (about 130 kb size). I want to get for each day (layer) the wind direction (in meteorological or geographical directions) at every cell. https://drive.google.com/open?id=...
0
votes
0answers
9 views

bfastmonitor stack

I am running a bfastSpatial monitor for the following .tif stack: > s class : RasterStack dimensions : 629, 1660, 1044140, 8 (nrow, ncol, ncell, nlayers) resolution : 997.6809, 997.6809 ...
-2
votes
1answer
25 views

extract mean of pixel values mask from raster before rasterstack or after using R?

i have 6 raster EVI for one year and i have 6 years , and mask im traying to calcul mean of pixel value in the mask for value =1 using raster : library(rgdal) library(rgeos) library(...
-1
votes
0answers
18 views

Forest Types Mapping with Random Forest Classification [duplicate]

I would like to know how to do forest types classification with sentinel 2 using random forest algorithm in R.
-1
votes
0answers
35 views

Code for NDVI using Landsat 7 not giving result between -1 to 1? [on hold]

I am working on NDVI using Landsat 7. I have written a code for this, but it is not giving me the correct result. The values are not in the range from -1 to 1. require(raster) require(rgdal) require(...
0
votes
1answer
63 views

Plot times series for stack raster based on a polygons in my area

I am using R language and I would like to create a EVI MODIS time series plot, EVI vs time. I can did method to create a raster stack and plot the average EVI of the total area over time. But I ...
0
votes
1answer
19 views

What is the meaning of ' QC_val=0x…' in the bfastSpatial package?

I am using the bfastSpatial package in R. One of the parameters that I have to set is the QC_val=0x 'a number'. I do not understand what number I have to insert. I am using MOD11A2 product (MODIS LST ...
0
votes
0answers
15 views

Unable to stack downloaded layers in R [on hold]

I have downloaded images of Landsat. Unzipped them and need to stack them to further process the images for lulc... How do I proceed? Also I have a stacked layer in .img format done in Erdas imagine....
-1
votes
1answer
22 views

How can I use rts function for time series TIFF using R

I am trying to plot a time series for my TIFF stack MODIS EVI with the rts function. I am trying to use this script but I do not know if I can use it for my TIFF stack. path <- system.file("D:/...
0
votes
1answer
18 views

Splitting multipart polygons to single part in R?

I am looking for the equivalent of "Convert multipart features to multiple singlepart features. Creates simple polygons and lines" in QGIS and similar in ArcGIS for R. Background I used the ...
0
votes
1answer
20 views

Extract a list areas and indices of multi-part polygons (SpatialPolygonsDataframe) R

I'd like to extract a list of polygons from a SpatialPolygonsDataFrame that include more than one area (so a polygon with a hole for example, or just 2 areas in one polygon entry in general). There ...
0
votes
2answers
34 views

Zooming in on raster file in R

I used the nsidcICE function located here: https://github.com/cran/raster/blob/master/R/nsidcICE.R and the following code to open a sea ice raster file. However, I would like to overlap vector points ...
0
votes
2answers
57 views

Save WMS layer to TIFF raster

In QGIS, I have a WMS layer. I am saving it to my hard drive by right click > "Save As...". Just like in HDunn's answer here. This is about my understanding of the topic, already this code is strange ...
0
votes
1answer
15 views

Count number of layers in a stack with value equal to raster pixel value

I would like to count number of layers in a stack with value equal to raster pixel value. Here is my current try: r1 <- calc(s, fun=function(x){sum(x == r)}) I get two errors Error in FUN(newX[, ...
0
votes
1answer
37 views

Accounting for orientation for a UAV image

I have a series of images that were taken with MicaSense RedEdge sensor attached to a UAV. My final goal is to input these images into mapping software (ArcMap, ENVI or QGIS) and be able to do stuff ...
1
vote
1answer
23 views

Extracting list of coordinates of all pixels in neighborhood of given pixel in R

I have a Raster layer. I want to get coordinates of all pixels in neighborhood (for example 7*7) of given pixel. Is there any function available to do this in R?
0
votes
1answer
17 views

Run CAR model (CARBayes package) with zip (a zero-inflated Poisson) family in R

I am trying to run the function "S.CARBym" using a zero-inflated Poisson (zip) family because my data y (cases of a disease) has too many zeros. I couldn't run it because the function asks to specify ...
0
votes
1answer
40 views

Raster extract function problem [closed]

I used to run the extract function from raster package without any problem. However, recently I receive an error message and it does not work for me. When I run the extract function to extract stacked ...
0
votes
1answer
20 views

Does the MODIStsp package computes the QA's and eventually corrects the bad quality pixels?

I am using R's MODIStsp package for downloading MOD11A2 time series products. While executing the command it was written that QA's were computed. Several files were created, LST_Day_1km, QC_Day, ...
2
votes
1answer
31 views

Load a CSV as Simple Features R

Is there a direct way to load a CSV as an sf? I've looked through the sf documentation and nothing jumps out at me, currently using: my_csv <- read.csv('my_data.csv', header = TRUE) my_sp <- ...
0
votes
1answer
30 views

How to change the encoding once a spatialpolygon is loaded in R and how to speed up loading a geodatabase .gdb file?

Question How to change the encoding setting for a spatialpolygon loaded in R without reloading it? Similar to the argument encoding=UTF-8 when loading the file with readOGR or similar to the drop-...
0
votes
1answer
20 views

Creating Buffer around series of lines in R?

For a GIS class I'm taking I'm trying to create some spatial statistics for a route through a city. I need to create a buffer of 100m around the route. It looks like i can use gbuffer from rgdal but ...
0
votes
0answers
34 views

Choosing variogram model?

I am trying to krig pH values of water samples in R. However i dont know which variogram model I could choose to bestfit my data if it looks like this. Any suggestions?
0
votes
0answers
14 views

Possible to drop NA geomType in readOGR?

I have a gdb file which is giving me trouble. f = '/path/to/folder.gdb' layers = ogrListLayers(f) geom_list = lapply(layers, readOGR, dsn = f) Gives an error on one of the layers: Source: "f", ...
0
votes
1answer
27 views

Using raster stack function time in R?

I successfully ran a function over a smaller test raster stack (48 layers) in about 30 minutes but cannot run it over my large stack (1462 layers). The last one I tried over the large stack ran from ...
0
votes
1answer
38 views

Save/loading shapefiles with SF in R: no simple features geometry column present [closed]

I have this code: library('sf') #init data xes = c(-122.133533701866, -122.141590665524, -122.382782560179, -122.302227764504, -122.347524548303) yes = c(47.617342005802, 47.6102707417054, 47....
0
votes
1answer
13 views

Why a laz file give warning about numbers of returns, using readLAS in R

Reading a laz file with the lidR package in R I have the following warning. What does it means? las = readLAS("chmp15.laz", filter = "-drop_z_below 0") #> Warning message: #> Invalid data: 8895 ...
1
vote
0answers
40 views

Dividing a large raster into blocks for iteration in R

I have very big rasters for processing (#pixels >1,5*10^10) for this project I am working on. Simple functions such as finding the area of a pixels with a particular value, across the entire raster 1) ...
1
vote
1answer
25 views

Finding shortest path without barriers using the sf package in R

Say I have three ships near PNG in the pacific. I want to know the shortest path between all three, while not going aground. This can be done with the ArcGIS function "cost distance" and "shortest ...
0
votes
1answer
37 views

Addressing Z-dimension discarded when reading in shapefiles from ArcMap to R?

I'm reading in polygons from ArcMap 10.6.1 into R 3.5.1 using raster::shapefile. I sometimes get the following warning: Warning message: In rgdal::readOGR(dirname(x), fn, stringsAsFactors = ...
-2
votes
0answers
43 views

How to stack MODIS EVI for each years and calculate annual mean EVI for year

library(rgdal) #to handle different types of images library(raster) #package to handle images library(rgeos) #to handle geographic data library(sp) #to vector data library(adehabitatMA) #for ...
0
votes
1answer
11 views

Plot a series of subsetted pixels from a raster stack in R

I have created two raster stacks and would like to plot a row or column of pixels through the stack, but am not sure how to approach this. I know I can subset by layer, but how do I subset ...
0
votes
1answer
22 views

batch merge error: Error in match.arg(method) : 'arg' must be of length 1

I am attempting to read in a series of polygon shapefiles from a directory and batch merge them into a single shapefile. They all have the exact same field names. I am using this code: all_data <-...
0
votes
0answers
14 views

How to use kriging for one dimensional locations expressed as factors

I want to predict sales of products on locations/shelves (physical location) in a store it never stood before. I have sales data of products on certain locations, from which the means can be ...
0
votes
1answer
18 views

Performing Intersect of polygon with raster, retaining ID of polygons? [closed]

I have a raster data set of land cover and a set of residential addresses (points). I want to find out what percentage of each land cover type is within 1km of each address (i.e. in a 1km buffer ...
0
votes
1answer
17 views

Seeking package/function in R that can help tag GPS coordinates of fauna sightings to nearest sampling point?

I have 1 dataset of animals sighted walking a survey, and I would like to tag them to the respective sampling points along a transect. Any idea what function/package in R can do that? Maybe ...
0
votes
1answer
30 views

Plotting Points in R with Google Map context. Error in download.file(urlStr, destfile, mode = “wb”, quiet = TRUE)

I am trying to plot point data with Google Map context but i keep getting an Error. I tried the same using OSM context and it worked just fine. R Code below library(RgoogleMaps) Lat <- as.vector(...
1
vote
1answer
66 views

Recording all vertices on shortest path with igraph?

I am working with a river network where vegetation surveys were conducted (black dots). I would like to: calculate the minimum distance between all points and the point highlighted by the red arrow ...
-3
votes
0answers
36 views

Error: Hessian is singular. Try providing starting values or using fewer covariates

I am trying to run a simply occupancy model using the unmarked package in R. Before you point out the various google groups and answers for the same, yes I have seen the above and did not find an ...
0
votes
1answer
15 views

Disaggregating list of rasters in R?

I would like to disaggregate a list of raster files in R. I write the following code but receive an error. # Import libraries require(raster) # Setup filelist and naming convention based off infiles ...
1
vote
0answers
57 views

Reducing “noise” in spatially regressed points

I'm working on spatial data on a grid. I have two variables that I think to be correlated and I would like to build a model (see Fig attached). I did some exploratory analyses following the ...
1
vote
0answers
18 views

R raster - take stratified sample

This question was posted in stackexchange, where there were no views/comments/answers. I have a raster file and would like to take a stratified sample. library(raster) f = system.file("...
2
votes
1answer
12 views

Unable to pull a bts.dot.gov MapLayer using Leaflet in R

I'm trying to get the noise pollution layer from the following bts.dot.gov ESRI MapServer to render in R: https://maps.bts.dot.gov/services/rest/services/Noise/CONUS_road_and_aviation_noise/MapServer ...
1
vote
2answers
44 views

Reproject MODIS data using R (results in NAs or no spatial extent)

I am using GLASS albedo data stored here for pre-2000 (AVHRR) data and here for post-2000 data (MODIS). My end goal is to create a raster stack of each month that contains white sky albedo data from ...
2
votes
1answer
30 views

Handling raster data in a “rotated pole projection” with R?

My question is about using R to transform raster data from a rotated pole projection to a regular latlon grid - and then plotting it. I am working with data from a numerical weather model, which is ...
1
vote
1answer
26 views

How to get latitude and longitude for a matrix data using specific projection in R?

I have matrix of temperature data and I would like to get lat and long for this data set in a particular projection e.g. PROJCS["DHDN_3_Degree_Gauss_Zone_3",GEOGCS["GCS_Deutsches_Hauptdreiecksnetz",...
0
votes
1answer
57 views

Vector averaging wind direction using focal buffers in R?

I have a raster of 1 km wind direction data that I need to run a focal buffer on. Instead of using the default buffering mean function, I need to use vector averaging since my wind direction is in ...
2
votes
1answer
25 views

Binding multiple polygons in R

I have a directory that contains around 700 .shp files. I want to create a map in R that displays all of them. The easiest way i could think to do this was to bind them all together and then use ...
-1
votes
0answers
28 views

create SpatialPointsDataFrame from very large .nc file gives error [duplicate]

I am looking for a solution to extract irrigation data containted which should be termed 'cons_irr' for each month from a .nc file. However, the dataset is very large. Can anyone tell me how I could ...
0
votes
0answers
17 views

Parameters for BSL Package in R

I am using the landsat BSL (Bare Soil Line) package from R https://rdrr.io/cran/landsat/man/BSL.html, and I am wondering why the code sample is using llimit 0.005 and not 0.01: BSL(band3, band4, ...