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.

0
votes
1answer
47 views

Write multiple rasters in R

I am trying to write a series of raster files into a new folder (after doing some image processing). However, when using my code, the files are but are not in the folder that I have created for that ...
2
votes
1answer
45 views

How to create independent/fixed inset maps with leaflet?

I am trying to create a leaflet map of the USA focusing on the contiguous 48 states and then add two inset maps of Alaska and Hawaii on the side. The problem is that addMiniMap() option creates an ...
1
vote
1answer
50 views

R leaflet set zoom level of tiled basemap (ESRI World Imagery)

I need to define the maximum zoom level of a tiled map in R leaflet. The problem is that I have points that are placed very close to each other and I would like to be able to distinguish each of them ...
0
votes
0answers
61 views

Connditionally extract values from raster brick in a loop using R

Quick story I have multiple netCDFs representing different time periods, and a dataframe containing observations (point data) taken at different time periods. I would liek R to only extract data from ...
0
votes
0answers
46 views

Project Raster in R not Producing Same Output

I am projecting a raster in R using the raster library and the projectRaster() function. I have projected a copy of the raster file in ArcGIS Desktop in order to create a template for the projection ...
0
votes
2answers
28 views

Raster operations in a raster list in R

I have a raster list (21 in total) S1 that have the same projection, resolution but not exactly the same extent. Due to this difference, I cannot stack them without solving the extent/dimensions ...
0
votes
2answers
78 views

Extracting non-spatial data from imported KML file using R?

I have a KML file which was created using Google's My Maps. The original file can be downloaded here: Google My Maps Using R, I can import this using the "readOGR" function of the rgdal library ...
-1
votes
1answer
47 views

How to use inverse distance to a power algorithm in R(not weighted)? [closed]

Can some one provide an example R code to replace the GRID (inverse distance to a power) interpolation algorithm in QGIS. I am looking for R code.
-1
votes
0answers
230 views

Error in model.frame.default(formula , drop.unused.levels = TRUE) :invalid type (S4) for variable ''

I have to predict soil organic carbon (SOC) through regression kriging using elevation (DEM) and NDVI data as covariate both of 30m resolution/cell size. Data of SOC at X and Y locations is in txt ...
0
votes
1answer
33 views

Combining raster file with country boundaries into a .csv dataframe in R [closed]

I have a raster file from the FAO's Global Agro-ecological Zone database ( http://gaez.fao.org/Main.html#) which gives the yields of specific crops in 5' grid cells. I would like to assign a country ...
3
votes
2answers
65 views

conditional st_join and st_intersection in R (sf)

I just started working with the R sf package and am trying to rewrite a simple procedure from PostGIS to extract shared borders between polygons. In PostGIS, I usually do a "conditional" self-join ...
0
votes
1answer
36 views

Add extra color class in leveleplot that covers values ranging from a threshold and above, supressing its extent in the color scale

I use levelplot in R to plot two raster stacks with values ranging from 0 to 600, by 20. This results to the first color palette below. However, I observed that I have some very sporadic pixels in my ...
3
votes
1answer
61 views

Constructing a function to pass to lidR::grid_metrics

I am attempting to write an R function, as part of a package, that takes a lidar tile (LAS object) and a vector of cut-points defining vertical layers, and returns a RasterStack where each layer has a ...
1
vote
2answers
47 views

Cropping in a shape of catchment area (not rectangular) in R

I have daily rainfall values in a NetCDF (.nc) file which is of larger extent covering a catchment area of a river basin. I want to crop it and extract the rainfall values that are within the ...
0
votes
1answer
21 views

Can't find my zip codes in TIGER/tigris

(This is my first attempt to use R, so I apologize for any stupidity. Also, please let me know if this is better posted in Stack Overflow.) I'm trying to use the Microsoft building footprint dataset ...
1
vote
2answers
80 views

Getting a masked raster with no NAs and sum pixels within overlaying polygon?

I have done an IDW interpolation in R for precipitation data following the routine of Manny Gimond (https://mgimond.github.io/Spatial/interpolation-in-r.html) to get precipitation inside a catchment. ...
0
votes
1answer
29 views

Setting fill to a variable based on data within SpatialPolygonsDataFrame?

I'm currently on the cusp of getting done what I want to get done - but having a slight problem with referring to my data from within R's sp SpatialPolygonDataFrame object. The issue is how ggplot2 ...
0
votes
2answers
74 views

R: Reclassify a raster stack through the range of the quantiles of each layer. Generic quantiles function ; layer by layer

I have a raster stack that contains terrain bends extracted with different neighborhood windows "crosc_nxn" (e.g. 3x3, 5x5, etc ...). crosc_nxn <- raster::stack(path.files.list) > crosc_nxn ...
1
vote
0answers
26 views

How to get the area of the pixels of a raster in Africa Lambert Conformal Conic CRS in R

My question has been previously asked here (R How to multiply the values of the raster pixels with the true surfaces of these pixels?), I have to multiply the precipitation value of each cell by the ...
1
vote
1answer
21 views

point.in.poly (spatialEco) returns non-intersecting points

I just updated the spatialEco package for R, and now the point.in.poly function behaves differently from previous behavior. Previously, it returned only points that intersected at least one of the ...
1
vote
1answer
37 views

Parallel rasterizing with GetCover option? [closed]

I'm trying to rasterize a shapefile in parallel using the solution from this post: Processing vector to raster faster with R However, this fails to give the correct answer when the GetCover = T in ...
1
vote
1answer
34 views

Using R to create a choropleth generated from lat/lon lists - with data generated internally

a friend referred me here as opposed to the regular Stack Overflow site, as this community maybe better able to help! My issue is largely with the syntax and framework of ggmap,ggplot, and the sp ...
2
votes
1answer
58 views

Extract values from raster, R and ArcGIS different results

My goal is to extract values from the raster called pftnc by using the other raster sp after converting it to a point shapefile. Files available here pftnc and sp I have two raster files pftnc=...
2
votes
0answers
45 views

Comparing yearly changes in TaxLot land use in NYC (mapPLUTO) - tax lots change through time

I am trying to build a database for NYC in which, for specific boroughs of the city, I track changes per tax lot unit in terms of land use and other attributes, both qualitative and quantitative. For ...
0
votes
0answers
34 views

Kriging shapefile points values in R

I have at my disposal a set of points spaced 8km * 8km. Each point has a precipitation value. I would like to interpolate by krigging values. I usually use ArcGIS to do this by taking an ordinary semi-...
0
votes
0answers
34 views

Format of data for doing the IDW interpolation in R

I have time-series of precipitation for a 30-year period for three climate stations that are situated out of the catchment of interest. I have to obtain the spatial distribution of precipitation, the ...
3
votes
1answer
70 views

How to know if two projections are the same?

I am using R but also tried with QGIS, visually the two maps look the same but the projection info it's not. QGIS provides the same info. first map +proj=longlat +datum=WGS84 +ellps=WGS84 +towgs84=0,...
1
vote
1answer
99 views

Random selection of points in SpatialPointsDataFrame R object with distance constraint

I need to select points randomly (without replacement) from a SpatialPointsDataFrame (input object) in R with a minimum distance of 3,000 meters between them. I want to get random 50% of all points. I ...
0
votes
0answers
44 views

Legend not shown in r-leaflet.minicharts and zoom buttons not working anymore

This script used to display a legend for the pie charts on the map. I cannot find the reason why the legend is not shown anymore. I suppose it is related to some problem with the leaflet plugin ...
0
votes
0answers
35 views

Spatial imputation for missing values in multiple variables in shapefile in r

I currently have a shapefile with approximately 20 numeric variables. Several of these variables have missing values. As this is a shapefile I do not think using the median or mean as a form of ...
1
vote
1answer
31 views

Estimate the spatial relationship between two sets of points

I have two sets of point data, structured like below. Table A long | lat | class ... | ... | A ... | ... | A ... | ... | A Table B long | lat | class ... | ... | B ... | ... | B ... | ... | ...
0
votes
0answers
101 views

Error in compareRaster(rasters) : different extent

I'm preparing independent raster for LR model: the resampled rasters files: Aspect=raster("resampleData/Aspect_re.tif") Curvature=raster("resampleData/Curvature_re.tif") Elevation=raster("...
1
vote
1answer
30 views

Kriging for unevenly spaced points using R?

I started to read about Kriging and the implementation into R. In all the tutorials I found, a (regular) grid is used to do ordinary or universal kriging. My situation is as follows, I try to ...
2
votes
0answers
38 views

TIFF image from R displaying only white in ArcMap?

I cannot get this TIFF image, which was exported from R to display in ArcMap 10.5. I would like to georeference the nodes, but the image only displays as all white. Can someone help me with this? ...
0
votes
1answer
14 views

Stack RasterDataset taking into account the dates between images

Good morning, I would like to stack a raster dataset taking into account the number of days between images. Sometimes the number of dates between observations are 8, 16 or 365 days. Is there any ...
0
votes
1answer
79 views

Mann-Kendall test with R

I am trying to do Man-Kendall test over a stack of 620 MODIS images. The code is as follows: library(sp) library(raster) library(Kendall) library(spatialEco) setwd("C:\\NDVI_prueba") rlist=list....
0
votes
1answer
16 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 ...
1
vote
1answer
39 views

IDW/Kriging running slow in R

I have a dataset with 2157335 entries, and I am performing IDW/Kriging to interpolate. But the code is running very slow. I am not sure this is because of a large dataset or there is something wrong ...
0
votes
1answer
36 views

Failure to re-project SpatialPolygonsDataFrame to Equidistant Cylindrical in R (units problem?)

I am trying to re-project a shapefile to match the projection and units o Black Marble nightlights data (link below) which comes in a raster with Equidistant Cylindrical projection, units in meters. ...
0
votes
1answer
30 views

Converting lat, long and values to raster doesn't project correctly

I have a some data like so: x <- c(59.06321, 59.22318, 59.38157, 59.53835, 59.69351, 59.84704, 59.99891, 60.14911, 60.29761, 60.44440, 60.58946, 60.73278, 60.87433, 61.01410, 61.15207, 61.28822, ...
1
vote
2answers
65 views

Plotting/Exporting the Spatial Random Effects in BYM model - CARBayes - in R

I am working with visceral leishmaniasis disease cases in a small city with 100 polygons (census tract). I have run a Bayesian Spatial Modeling - Conditional Autoregressive model (CAR) Poisson (BYM ...
1
vote
1answer
120 views

MODIS downloads using Python

I am trying to get a full-functioning download script specifically for the Modis data (Version 6) on the USG/NASA site (AppEEARS/LPDAAC). I’m running Windows 10. I know that there is an R Modis ...
0
votes
1answer
47 views

tauDEM flow accumulation (D8 or D-infinity) results is NA-values for some major rivers

I am having some trouble with tauDEM that I am hoping someone can give me some advice on. I'm running tauDEM via command line through R-studio. I am working with some 30m resolution SRTM DEM data in ...
1
vote
1answer
83 views

Can't extract chlorophyll a values from NetCDF file using R

I'm trying to get the chlorophyll a values from a NetCDF file using R software, but all I'm getting are missing values, NA. I would like to know if I'm doing something wrong or if the file really just ...
5
votes
2answers
88 views

Calculating block statistics from land cover raster using R?

I have a raster (5 x 5 m resolution) representing land cover. Each cell contains a integer value (from 1 to 10) representing a total of ten land cover classes (e.g. 1-forest; 2-agricultural areas; 3-...
0
votes
2answers
67 views

Merge RasterLayers (raster package)

i want to change the resolution of elevation data for several countries and them merge those in one rasterlayer. I use getData function from raster package. I tried this one: library(raster) library(...
1
vote
2answers
114 views

Calculating statistics per area for categorical raster using R?

I am working with the area of New York City (NYC) in ArcGIS 10.1. I have a landcover raster map with several different land cover categories. What I am trying to do is to build up a table in which, ...
0
votes
1answer
27 views

R error reprojecting from EASE 2.0 to WGS84

I have a data file which is in the EASE 2.0 grid (EPSG:6933) which read in with raster looks like so: class : RasterLayer dimensions : 3000, 3000, 9e+06 (nrow, ncol, ncell) resolution : ...
0
votes
1answer
69 views

Add nearest coordinates values from one file to another file in R [duplicate]

I have 2 files df1 and df2. File df1 has lat and lon, file df2 has lat, lon and wind. df1 and df2 files have different lat, lon. Now I want to add df2$value2 in the file df2 corresponding to the ...
0
votes
0answers
72 views

Read NetCDF chlorophyll data in R

I want to plot chlorophyll data in much the same way as is shown in the second part of this answer (I can run the first part perfectly with my data but I want a higher resolution map). The only ...