Questions tagged [r]

Statistical computing language and software environment.

Filter by
Sorted by
Tagged with
0
votes
0answers
4 views

R: How to get coordinates information at un-sampling and unknown locations in an area?

I have an atmospheric sampling dataset from a certain area like this: Rows: 100 Columns: 4 $ Pressure <dbl> 976.4521, 976.1801, 976.3160, 975.6355, 975.7716, 975.... $ Temp <dbl&...
0
votes
1answer
39 views

How to calculate mean for multiple raster files and multiple variables using R

I have a folder with multiple raster files (.asc) which contains the biomass of different fish species (e.g., Anglerfish, Bathydemersal etc) for different years (e.g., 00012, 00024, 00036 etc) I want ...
0
votes
1answer
25 views

Get rid of overhang beyond masking border in ggmap?

I built a terrain map of Nevada and plot the state border around it. The resulting map has a buffer-like overhang across the state border which I used to mask the raster. How can I get rid of the ...
0
votes
1answer
32 views

Calculating area between two SpatialLines

I'm trying to calculate the area between two lines. The two lines have the same start and end location, but the number of vertices for each line can vary. I've tried to create a polygon from the ...
0
votes
0answers
19 views

Error while converting raster to ploygon using stars package

I am trying to convert raster to polygon using stars package as suggested in this and this. I have used the following code library(raster) library(stars) library(sf) library(magrittr) #read raster r1&...
0
votes
1answer
37 views

Deleting values from raster layer using R

I am looking for a way to delete values in my raster layer in R programming. Assume I have a raster layer with the following unique values: 0,1,2,3,4. minimum is 0 and maximum is 4. How do I delete ...
-1
votes
0answers
32 views

What kind of time series model would be suitable for predicting 4 years of Sentinel data? [closed]

I have calculated 5 vegetation indices for each of the 4 years and also I have yield data for 4 years(2015, 2016, 2017, 2018). I have pre-processed every data and correlated. I want to model in such a ...
0
votes
0answers
23 views

How to convert dataframe with repeated observations into spatialpolygonDataframe [closed]

I am a novice in this area. I want to run an analysis in R but it requires the data to be in spatialpolygonDataframe. I am having difficulties converting my data frame into spatialpolygonDataframe. My ...
0
votes
1answer
28 views

How to calculate mean of raster layers where some layers have missing values (R or QGIS)?

I am trying to create annual averages of some raster layers, but some of these layers have gaps in the data. If all pixels in all of the layers contained info I would just use Raster Calculator and do ...
0
votes
1answer
32 views

In R, abstract data from SpatialPolygonsDataFrame but got NA

I tried to extract data from a SpatialPolygonsDataFrame, but got all NA. slot(nc,"data")[c("Northampton","Clay","Macon","Graham","Yancey","Mitchell","Avery"),] The data show as: SP_ID CNTY_ID ...
0
votes
2answers
33 views

R and sf - How to know this exists, data(us_states), without first using, (requireNamespace(“sf”, quietly = TRUE))

I am not new to using R, but I am newer to using the sf package, or any other similar geospatial packages. I can easily explore and subset the world dataset and then plot the map of the US - which ...
8
votes
5answers
3k views

How to speed up raster to polygon conversion in R?

I've decided to process my Landsat data in R instead of ArcGIS - due to my missing knowledge of python and because of (assumed) high computation capacities of R. I want to : import r1 raster to R, ...
0
votes
0answers
16 views

How to create a spatial polygon from 2 known spatial data points in r?

I have 2 spatial data points which have UTM coordinates. I want to create spatial polygons of 100x20m using these 2 points as boundary references (see picture). Background: This for the purpose of ...
0
votes
1answer
51 views

Converting a CSV to a shapefile in R : “Creating Name field failed”

I was trying to convert a CSV to a shapefile (process that I've already managed to do several times with R without particular problem) but today I'm facing a troublesome issue I haven't been able to ...
0
votes
0answers
14 views

How to fit the TOTRAM soil moisture model in R? [duplicate]

#load spatial packages library(raster) library(ggplot2) r1 <- raster("C:\Users\Admin\Downloads\NDVI (5).tif") plot(r1) r2<-raster("C:\Users\Admin\Downloads\LST (2).tif") plot(...
-1
votes
0answers
31 views

Raster values change after any kind of operation/calculation in ArcGIS, QGIS, R to -3.402823e+38 and new maximum

I have a single band raster file (.tif) with pixel values indicating the water depth (in meter) of a flooded area. The pixel size is 1m. My general objective is to extract these values for a given ...
2
votes
1answer
58 views

Colour code points over raster stack in R

I am very new to R and spatial analysis. I have a column with different categories and I want to colour code my points according to category type. I have seen posts on working with continuous or ...
0
votes
0answers
15 views

Extract band values to points from mosaic (ArcGIS) in R

I am classifying satellite images in ArcGIS. I would like to partially evaluate my results in R, e.g. through Crossvalidation. I want with mosaic (raster with 6 bands) extract band values to points ...
0
votes
0answers
12 views

Trouble applying bfastmonitor function in R

I am trying to apply a BFAST monitor to my time series but keep getting the following error. What does it mean and how can I fix this? Error in if (!foundBreak & any(abs(obj$process) > ...
0
votes
0answers
44 views

How to scatter plot raster data NDVI and LST in R? [closed]

I have already created two raster data (TIFF) in R (LST and NDVI) to determine the slope and the intercept of the dry edge and the wet edge. I have obtained the dispersion diagram but not yet the line....
1
vote
1answer
8 views

Transforming CRS for globcover data using R

I have two set of data: raster land cover from [Globcover]:(http://www.fao.org/land-water/land/land-governance/land-resources-planning-toolbox/category/details/en/c/1036356/) A set of point ...
2
votes
2answers
61 views

Ignoring ellipsoidal heights recorded from GPS when only interested in location?

I am not interested in converting ellipsoidal height into AHD heights, because I have a good DEM. However, this whole business about geocentric vs geodesic coordinate systems is thoroughly confusing ...
0
votes
1answer
23 views

Raster image error when entering stack layers

I am a beginner user of Rstudio, I want to run Random Forest by using a couple of "raster layers" which were stacked in ENVI. Before doing stacking I checked the cell size and the columns ...
-1
votes
0answers
15 views

Resources for building convolutional neural networks for image classification? [closed]

I am beginning to look into using convolutional neural networks (CNNs) for image classification. For what I will be wanting to do, I will be building a large training database of images that will be ...
1
vote
2answers
21 views

How to find the intersection of 5 bounding boxes in R

I have 5 rasters. I computed the bounding boxes with st_bbox for each of them. I would like to put all the raster-values in one dataframe. For that I figured they should have exactly the same extent. ...
2
votes
1answer
58 views

Why is normalize_height() function aborting in lidR?

I'm trying to run normalize_height() on 328 las files. Maybe or maybe not relevant: I'm not running using LAScatalog because I couldn't get that to run at all. Anyhow, I'm running using a parallelized ...
3
votes
2answers
29 views

Extracting poly.counts through loops using R

I want to extract the count of points over Africa at the first administrative district level at monthly intervals over 26 years. My point data consist of conflict events. I am struggling to figure out ...
0
votes
1answer
30 views

How to plot shapefile in R

I am trying to plot a shapefile on top of a raster using the command 'readOGR'. My current code is: > CEZ <- readOGR(".", "Shapefile/CEZ1") This is followed by the error ...
0
votes
1answer
16 views

Group raster stack layers by year

I have about 468 layers in my raster stack (new layer every 16 days between 2000 and 2020). Is there a way to group the layers by year and instead have just 21 layers? [1] "X2000.02.18" &...
1
vote
0answers
11 views

Extract paleoclimate variables from wordclim

I1m relative new in to RStudio and I'm trying to download the paleoclimate variables (http://ww.worldclim.com/paleo-climate1) from worldclim, but I can't, the unique solution that I found was to ...
1
vote
0answers
18 views

Leaflet and tiler for R - can't get the correct tiles for displaying in Leaflet (wrong reference systeme or something)

I have got an issue with tiler (https://github.com/ropensci/tiler). I am setting up a webapplication and want to convert .grd files to tiles that can be read by Leaflet. This example can be easily ...
1
vote
1answer
17 views

Why raster stack function changes the number of layers

I have a list of 12 rasters: IN_folder_S2 <- "T:\\New_SM\\Indices_UXC" IN.files_S2 <- dir(IN_folder_S2, pattern= "_11.tif$",full.names = T) IN.files_S2 IN.files_S2 [1] &...
1
vote
0answers
28 views

Weighted Voronoi polygons in R

I want to build weighted Voronoi diagram in R, as in How to draw weighted voronoi polygons (thiessen) from points in QGIS? or Create weighted Thiessen polygons?, but I could not find any function for ...
0
votes
0answers
12 views

Package wdpar question

I am trying to download protected area data for the Democratic Republic of the Congo (ISO3 code = COD) using the wdpar R package. library(wdpar) library(dplyr) library(ggmap) library(sf) ...
0
votes
0answers
31 views

Using bfast in R [closed]

I'm trying to use bfastts in R in order to have time series of NDVI, but when I run the plot is empty. How can I fix this? The code: ndvi12.bts <- bfastts(ndvi12.zoo,dates, type = c("...
1
vote
1answer
47 views

Issue with CRS in R's writeRaster and SAGA's raster-format

I have a normal RasterLayer in R and I would like to write it to a file and visualize it in QGIS. When I look at in in R it says: class : RasterLayer dimensions : 3035, 1469, 4458415 (nrow, ...
1
vote
1answer
67 views

Avoid calling tm_shape() multiple times?

Posting here (rather than Github) as it is not an issue with the tmap package. Situation: I am doing simple choropleth maps of varinterest for U.S. counties (N~3000) using tmap (data stored in data ...
0
votes
1answer
10 views

R when I reproject coastscoarse to Robinson using spTransform I get an unwanted horizontal extra line

When I run this code library(rworldmap) data("coastsCoarse") plot(coastsCoarse) RobinsonProj <- "+proj=robin +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs" ...
0
votes
0answers
24 views

How to create a linear model based on latitude for a raster and plot the semivariogram? [closed]

I am trying to plot the semivariogram of a raster file based on the residuals. I have tried to use Variogram() in R, but the result does not look correct. Is there a way to plot the semivariogram of a ...
0
votes
0answers
70 views

Programmatic way of accessing mapbox tileset from leaflet WITHOUT studio

I have a R shiny app that successfully uses leaflet to interact with a custom mapbox studio style. mapbox_url = "https://api.mapbox.com/styles/v1/bweinstein/ck94nmzn20an31imrz6ffplun/tiles/256/{z}...
0
votes
1answer
35 views

Error in overlay - formula not vectorized

I've run into another error while trying to get my predictive model to work. My base model is basically done (extracting locational parameters from archaeological sites in an area, and calculating a ...
1
vote
1answer
28 views

Convert/Display ODK GeoShape to R

After downloading data from an ODK form (hosted on ONA.io) and importing it into an R dataframe, all the fields are neatly parsed but for a column which contains spatial data. Here is the first ...
1
vote
1answer
45 views

Plotting species distribution on map in R of Europe and Africa

install.packages("rgbif") library("rgbif") Species.Name <- "The name of the species" #Search GBIF and download observations Species.key <- name_backbone(name=Species.Name)$speciesKey locations ...
0
votes
0answers
16 views

Adding rasters to pgsql with rpostgis - why are raster constraints so slow?

I am adding rasters to a postgresql DB using the function pgWriteRast from the package rpostgis. I am noticing that the additions to the DB are slowing down as more and more rasters are added to the ...
1
vote
1answer
53 views

Linear regresion on each raster pixel to predict future month (in R language)

I have successfull run this code. I have read it from: https://stackoverflow.com/questions/47435206/cant-calculate-pixel-wise-regression-in-r-on-raster-stack-with-fun?rq=1 library(raster) # Example ...
3
votes
1answer
58 views

Generate a stars object from tabular spatial temporal data?

I have tabular data with columns longitude, latitude, time, and intensity, like so: library(lubridate) ## mock example data ex <- tibble(longitude = 1:10, latitude = 10:1, ...
1
vote
0answers
24 views

gIntersection results in a new dataframe with more rows

This is my first time using rgeos::gIntersection, and I have a dataset with that I rasterized using rasterFromXYZ, then turned into a spatial polygon dataframe. I wanted to intersect this SP dataframe ...
0
votes
1answer
21 views

How to efficiently get the length of linestrings intersecting a huge raster file? [duplicate]

I have a huge shapefile (roadnetwork of Europe) and a raster file (Europe, 100x100m resolution). I want to calculate the length of the roadnetwork for each raster cell, resulting in a new raster layer....
1
vote
0answers
24 views

Calculating nearest distance with nngeo

I need to calculate the nearest distance between objects (schools). I have two sf-data-frames with lon/lat. The way I understand the output of st_nn is, that dist gives me the minimum distance to the ...
0
votes
1answer
564 views

How to extract raster attributes by lat/long location?

How can you extract an attribute value from a raster from a point (lat/long)? Example data: Raster with attribute table - value of interest is temperature I have a list of points with lat/long ...

1
2 3 4 5
81