Questions tagged [r]

Statistical computing language and software environment.

Filter by
Sorted by
Tagged with
-1
votes
1answer
13 views

Creating raster where each cell records distance to sea?

I want to create a raster with a 25 metre × 25 metre resolution, where each cell contains the distance to the nearest coastline, as calculated from the center of the cell. To do this, all I have is a ...
0
votes
0answers
20 views

Reprojecting CRS from Geocode API fails to match shapefile CRS

I have a shapefile obtained from this link. library(rgdal) library(rgeos) dir <- tempdir() unzip('~/Downloads/4106902.zip', exdir = paste0(dir, '/4106902')) shape <- readOGR(paste0(dir, '/...
0
votes
0answers
10 views

How to calculate standard deviation using moving window on multiple raster layers in R or Python? [on hold]

I have two raster layers (1km and 30m). Similar to the focal statistics tool in ArcGIS, I'm trying to calculate standard deviation (STD) using moving window. Differ from focal statistics, I'm using ...
2
votes
1answer
21 views

Calculating destination point using sf package

I have the following data: lat <- c(-1.404361, -1.403221,-1.387369) long <- c(35.35373, 35.35047,35.35171 ) distance <- c(220,150,300) bearing <- c(67,27,159) df <- data.frame(lat,...
0
votes
0answers
24 views

Weather system radius [on hold]

I have two lists, locations (lat/longs) and weather stations (lat/longs). I previously posted a question about attempting to find the three closest weather stations surrounding each location. I have ...
2
votes
1answer
23 views

Creating minimum bounding geometry using the convex hull method in R

I would like to create a small enveloppe around a set of polygons that encloses around them. I would like to avoid using the bounding box function (example below) because it would be too big. Rather, ...
1
vote
1answer
19 views

Spliting a polyline object by line ID based on @data values

I am trying split a SpatialLinesDataFrame by attributes I merged into @data I extracted a list of line ID's associated with a points data frame and aggregated them by category and line ID in dplyr # ...
1
vote
0answers
24 views

Generating randomised coordinates data set using R?

I am looking to produce a data set of randomised coordinates points that can easily be generated in R with something like: Seqlat <- seq(from=-90, to=90, by=.01) Seqlong <- seq(from=-180, to=...
-1
votes
0answers
17 views

Raster package in R - “Error in filename != ”“ : comparison (2) is possible only for atomic and list types”

I get the above error when using calc to retrieve values from two rasters (propSummPCP, propWintPCP) in the raster package of R. It works for a single raster (either one). Looking to return NA, in ...
1
vote
1answer
29 views

Exracting data fromSpatialPolygonDataFrame conditionally in R?

For some research I am working on, I have a dataframe called charters of charter schools in New Jersey. Simplified it looks like this: school.name school.id district.id lat ...
0
votes
0answers
21 views

Wrong northing value: standardizing with a correction by 10 000 000 meters

I'm trying to draw points on a map and I have a problem using the projections. I have no problem getting points from longlat to UTM. But it seems that there is a problem when specifying UTM zone 15M ...
1
vote
1answer
52 views

How to detect green areas in Google Earth imagery using R?

I want to detect urban green areas in Google Earth imagery, using R. I've already downloaded contiguous images and assembled them into a larger image. The above PNG image has 800x769 pixels, but the ...
2
votes
1answer
28 views

Can BFAST algorithm be applied to to a whole study area/ ROI?

I am working on identification of breakpoints in Landsat based NDVI time series (1990-2018). I am using The Breaks for Additive Seasonal and Trend (BFAST) algorithm which is a pixel based time series ...
0
votes
0answers
18 views

Generating envelope for Gcross function in R?

I am using R to generate envelope for the Gcross function. At first I used Gcross to generate the theoretical value together with true G(r) value with border correction, my codes are: Bind_ppp <- ...
1
vote
0answers
24 views

Speeding up spatial subsetting in R?

I need to subset a global fishing dataset to just have the fishing in the Pacific. Right now I have a shapefile of the Pacific and I am using the sp method of subsetting (see below) oceans <- ...
1
vote
1answer
49 views

Why do original colors in GEE images appear in different colors?

I seek help to understand why colors that I specified in Google Earth Engine (GEE) do not appear in raster objects in R. Let me explain the processes that I have been going through. The following ...
0
votes
0answers
23 views

Reusing sampled points in R for accuracy assessment? [on hold]

I did 162 classifications with different training datasets in ArcMap, SNAP and SAGA. I want to perform the accuracy assessment in R. So I sampled 10000 points from the validation dataset with the ...
1
vote
1answer
17 views

Sampling stratified random points using R for accuracy assessment

I want to sample stratified random points using R. I found the sampleStratified function from the R raster package. This functions samples the same amount of points for each class of my ...
1
vote
1answer
24 views

Why does the AddGeometryColumn function not exist in RSQLite?

I am trying to add the geometry to a new table with the following statement: library(RSQLite) # db.sqlite was created with spatialite-gui con <- dbConnect(RSQLite::SQLite(), dbname = "C:/GIS/db....
-1
votes
0answers
12 views

Determine the appropriate window size to scale the original point pattern [closed]

I am new to the spatial statistics using R. I have a large point pattern, and I would like to apply model fitting to the local point pattern instead of the whole pattern. To do so, I need to ...
0
votes
2answers
30 views

Rasterize multipoint geometry in R

I would like to rasterize data on protected areas for certain countries (e.g. https://www.protectedplanet.net/country/TH, download button is at the bottom of the page). The dataset contains two ...
0
votes
0answers
29 views

Shapefile not getting plotted on R with leaflet after converting a DXF file into shapefile [on hold]

I had a .dwg file which was converted into a .dxf file. The plugin in QGIS was used to convert this .dxf file into shapefile. The .dwg file was made using a (0,0) reference system. The geo-reference ...
1
vote
0answers
35 views

Map gridded rainfall data to lat-longs and extract daily rainfall data? [closed]

My objective is to create a dataset, wherein for certain locations (lat-longs) I need to report daily rainfall from 1950 to 2017. Rainfall data source: Indian Meteorological Department (IMD) daily ...
1
vote
1answer
15 views

Generating pattern in each of set of polygons using sp (r)?

I have an object of class SpatialPolygonsDataFrame, and for each polygon in the dataframe I have a number of points I would like to generate in that polygon (e.g. I have 130 polygons, and I have a ...
0
votes
0answers
11 views

How can Köppen climate class values be derived from multiple bioclimate raster inputs? [closed]

There doesn't appear to be an R package to create a raster of Köppen climate class values, so I am looking at other options. I am using North America climate raster data (https://journals.ametsoc.org/...
2
votes
0answers
29 views

R: How to get a filename list of raster layers in a geodatabase?

In R, how do we get a file list of rasters in a geodatabase folder? We know the case of vector layers as follow. library(rgdal) fgdb = "C:/path/to/your/filegeodatabase.gdb" subset(ogrDrivers(), ...
0
votes
0answers
15 views

Setting extent before stacking multiple TIFF files in R?

I downloaded 15 tiles from Earthdata of MOD17A2 (GPP). I converted the HDF files to TIFF formats via R software. Now I would like to stack them altogether, I am aware there are many questions related ...
2
votes
0answers
20 views

Row-wise Reprojection of SPDF in R [closed]

I have multipolygons that span across the globe. I was wondering if it was possible to re-project each row, i.e. each country/ ISO3 to a local projection, using a central grouping mechanism. For ...
2
votes
1answer
67 views

R (spatstat, sp, sf): Grid a single polygon, divide, alphanumeric labels based on column/row

I am trying to take a polygon and add grid lines over top, then divide the polygon into many polygons based on the grids. I've accomplished this through st_make_grid() and raster::intersect(). The ...
1
vote
1answer
32 views

Remove empty polygons from shapefile in R

I have a shapefile witch contains several empty polygons. I´m extracting values from raster file based in some polygons of this shapefile. But my loop stops at every empty polygon. Simple solution ...
2
votes
0answers
34 views

Stratified ordinary kriging using gstat and stars packages

The gstat package supports stratified ordinary kriging using sp objects as shown at https://github.com/r-spatial/gstat/blob/master/demo/examples.R (the code below). This year (https://r-spatial.github....
0
votes
0answers
19 views

Calculate the sinuoisty of a line

I have an sf polyline layer in R an would like to calculate the sinuosity (i.e. actual length of segment divided by the shortest distance between start and endpoint). Does anyone know of a function ...
-1
votes
1answer
39 views

How to convert missing values to the mean of the other values in R? [closed]

I need to convert the missing values of a column in a dataframe with the rest of values of this column, grouped by Districts and Month. This is a sample of my df1: Date Day Month Year ...
0
votes
1answer
42 views

Calculating total shared boundary between polygons based on their attributes?

I tried to do this over the weekend but had no luck - even after searching this forum. I'm trying to calculate the frontage (length of the property bordering the street) of a number of properties. I'...
0
votes
0answers
12 views

R: Creating custom polygons based on geom of subset data [duplicate]

I hope that I titled this question correctly. Reproducible code: library(tigris) library(leaflet) colorado <- counties("colorado") leaflet(colorado) %>% addProviderTiles("CartoDB.Positron"...
1
vote
0answers
33 views

Generate equal distanced sections on polygon

I generated a polygon by buffering a reference line. What I want to do now is generating multiple equal-distanced points along the reference lines, upon which to generate sections on the polygon. A ...
2
votes
1answer
34 views

Loading shapefiles for reprojection using sf

I'm trying to automate my workflow, but having trouble with one step. My data come as processed shapefiles saved in .RDA files; I load them to a PostGIS system, cleaning up little issues (spTransform()...
1
vote
0answers
8 views

Raster or Brick from nedf with lat lon = matrix

I have a netcdf file 3 dimensions, lat, lon, time : lat and long are matrix (nrow=263, ncol=512) time is vector of date the variable is precip observed at a given (lat, lon) and date What I would ...
0
votes
2answers
40 views

Convenient way to download MCD19A2 product using R

I want to download MODIS MCDA219 product. I have been downloading manually from https://ladsweb.modaps.eosdis.nasa.gov/ and https://earthdata.nasa.gov . As a new to R user, recently I have learn ...
2
votes
1answer
33 views

Creating random plots with coordinates within polygon using R [closed]

I am trying to create random plots in a polygon shapefile and then to plot it with index no as 1,2,3,... along with a legend comprising XY coordinates corresponding to each index no. Code example: ...
2
votes
2answers
39 views

Use Lat and Long to Zoom and Crop A Color GEOTIFF Based Map In R

I have a strong background in R but have only done limited GIS work. I have a color Geotiff file that I downloaded from the USGS Earthexplorer. It is a "LandsatLook Image with Geographic Reference". ...
0
votes
1answer
29 views

Could not find function “coord_quickmap” in R

I was trying to actually crop part of a country (example is Korea) using this code in R: korea + coord_quickmap(xlim = c(126.5, 128), ylim = c(35, 37)) However, this error appears.. Error in ...
1
vote
0answers
44 views

Enable WMS GetFeatureInfo request in Leaflet using R?

I've been using R with Leaflet and Shiny to produce a web map that is accessible to the public online. It is a real-time air temperature map of Tasmania, Australia based on current Bureau or ...
1
vote
0answers
18 views

Error while rendering Leaflet map on Shiny

I have been trying to reproduce a Leaflet map on a Shiny webpage. I have made this code so far: library(shiny) library(shinydashboard) library(leaflet) library(rgdal) library(dplyr) library(DT) Map &...
1
vote
1answer
25 views

How to convert a polygon to a polyline using the sf package in R?

I have some simple polygons that I would like to convert to polylines using the sf package in R. I have found st_polygonize to convert polylines to polygons but I cannot but the reserve operation. ...
1
vote
0answers
18 views

Extracting or masking of very large raster to reduce file size on disk?

I have a very large 8-band raster (339806 x 61704) that I cannot load to memory to manipulate (R, raster:canProcessInMemory indicates I need 4999.16 GB of ram to load this file). However, I only need ...
1
vote
1answer
41 views

Creating connected network of roads from overlapping roads using R?

I am trying to create a dataset of roads data to do shortest path analysis. To do this, my roads data needs to be connected: it should be possible to jump from one road to another. I am planning to ...
3
votes
1answer
62 views

R Code in QGIS - Stratified Random Sampling of Land Cover Classified Raster

I'm trying to write code using the Processing R Provider scripting in QGIS. The script is to perform a stratified random sampling scheme on a classified land cover raster image. The land cover codes ...
1
vote
0answers
13 views

Create ltraj in adehabitatLT Error

I'm trying to use adehabitatLT analyze animal movements. However, I'm having issues with creating a ltraj object in R. I have followed the as.ltraj() example in the documentation and I'm getting this ...
1
vote
0answers
41 views

Multiple Spatial Point Patterns, create “average” heatmap

I am using R's spatstat package to analyze spatial patterns of objects across plant leaves. Let's say I have 10 leaves, each with corresponding X,Y coordinates of the objects and a window in the ...