Questions tagged [r]

Statistical computing language and software environment.

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

Writing to FileGeoDatabase in R on Windows?

The title above basically states the question. I have looked around but haven't quite found anything yet. I see this driver: https://gdal.org/drivers/vector/filegdb.html I haven't seen any R ...
0
votes
1answer
20 views

R: mask a raster by a polygon also keep cells partially covered [duplicate]

I want to mask a raster by a polygon, the R script was as followed. However, some cells with only partially covered weren't included in the masked raster as listed in the picture link (https://drive....
0
votes
0answers
16 views

Extracting current and future individual RCPs (2.6, 4.5, 6.0 and 8.5) for Current, 2050 and 2070 and specific months [on hold]

Worldclim has several GCMs (global climate models). Has Four RCPs (representative concentration pathways) (2.5, 4.5, 6.0 and 8.5). Has three time steps (Current, 2050 and 2070). How can I use R or ...
0
votes
0answers
27 views

Infer stops and traffic signal from GPS traces [on hold]

I work in a hive database of GPS traces. I would like to know whether there is a library in Python or in R (OR SIMILAR PROJECTS) that deals with the same. My approach is to calculate distance between ...
2
votes
3answers
43 views

Batch processing/extracting raw data of one raster using one shapefile (with many polygons)?

If we have a raster, say of integer elevation data for a country, and one polygon shapefile, say of 300 river basins in that country, with a unique name for each, how would we most easily get output ...
0
votes
0answers
29 views

What is the most suitable projection to calculate area across sub-Saharan Africa in R? [on hold]

I'm working with a large animal-tracking data set that covers sub-Saharan Africa. I'm interested in calculating home range areas and would like to work in metres. My data are currently in lat-long ...
0
votes
0answers
16 views

Error in R: startAsciiWriting (x, filename, …) [on hold]

I am new to R. I am trying to transform elevation data in R for input into MaxEnt. Returned: Error in .startAsciiwriting (x,filename ...): x has unequal horizontal and vertical resolutions. Such ...
0
votes
1answer
25 views

R gstat krige() NA predictions increasing with larger nmax

I've been playing around with a King County house dataset posted on Kaggle (link: https://www.kaggle.com/harlfoxem/housesalesprediction) and tried to predict house prices with Kriging. The entire ...
0
votes
1answer
25 views

Create mask for each layer of time-series raster in R

I'm trying to create a mask using each layer of my stacked Pixel Reliability QA rasters in R. I'm trying to exclude pixels with values greater than 1. I will use them to mask my vegetation index time-...
0
votes
0answers
14 views

How to select SpatialPoints inside the SpatialPolygons

I have two documents. One is a csv file which contains lon and lat information. Another is a shapefile. I want use "over" command in r to select points inside the polygons, but I get all NA results. ...
3
votes
1answer
43 views

Calculate the travel time from locations to the closest N points

I want to calculate the travel time (based on walking time) from locations to the closest N points of another dataset. Then I want to create a hull around those N closest points per location Is this ...
2
votes
1answer
28 views

lidR: no slot of name “header” for this object of class “LAScatalog” [duplicate]

edit: This question does share an answer with an existing question, and the problem is the same: lastrees() does not work on LAScatalogs. However, I'm going to leave this question up, because I think ...
0
votes
1answer
12 views

Removing empty polygon from sf object in R?

I have such object: > p_mb Simple feature collection with 52 features and 0 fields (with 9 geometries empty) geometry type: GEOMETRY dimension: XY bbox: xmin: 585001.4 ymin: 211001....
0
votes
1answer
31 views

Remove polygons having less than 4 coordinates in R

I have a multiPolygon shapefile of buildings in a particular city. I read it in with readOGR and and transform it to my desired planar projection with the following code: buildings_data<-readOGR("...
0
votes
0answers
18 views

Error in RGEOSDistanceFunc(spgeom1, spgeom2, byid, “rgeos_distance”) : negative length vectors are not allowed

What does the error in the title mean? I'm fairly new to GIS and can't understand which negative length vectors R is talking about? Here is what I'm doing: I have a csv of lat/long locations of ...
1
vote
2answers
36 views

stack() in R does not include all .tiff files in my directory

I am trying to perform stack() in R using enhanced vegetation index (EVI) time-series maps but it doesn't include all the .tiff files in my directory. Here's the list of files when I dir(files.evi): ...
-2
votes
0answers
34 views

How to Modify GEE script working for Landsat change detection to work for MODIS MCD12Q1? [closed]

I have dataset from MODIS land cover product (MCD12Q1) from 2001-2016 for Thailand. Now I want to perform change detection on this pre-classifed dataset so that I can visualize the change that has ...
0
votes
0answers
29 views

How to correct border between 2 polygons in R? [duplicate]

What algorithm to use to correct (average) the borderline between 2 polygons? All I know is that they have their own borderlines very close to each other. Sometimes they may overlap, otherwise not. ...
0
votes
1answer
25 views

Simple condition on rasters with different extents, R

I have multiple raster objects, with the same resolution but slightly different extents. I have use the following function in order to reclassify them and now their values are between 1-6. What I ...
1
vote
1answer
20 views

R Reprojected raster stack loses band information

I'm attempting to reproject a multiband raster image in R to Orthographic for export https://www.naturalearthdata.com/downloads/50m-raster-data/50m-cross-blend-hypso/ However when I project the ...
0
votes
0answers
15 views

Polygon boundary is not properly connected in R

I have two points sets, when plotted using geom_point, they look like: What I want to do is draw a polygon using these two datasets, and I expect to get a ring-shape polygon. However, when I use ...
0
votes
1answer
40 views

How to fill the gap by using IDW(inverse distance weighting method) in R?

I'm beginner of R. I'm trying to fill the gap using idw, but I still had no idea about this. The data in used is below: The names sequence of columns are date/SO2/CO/O3/NO2/PM10/Lat/Lon. As you see, ...
0
votes
0answers
23 views

How to get middle line of buffered shape in R? [closed]

Just simply, what function to use to get the middle line of such shape? This is a product of sf::st_buffer( ) function and these are 2 polygons, smaller and larger. How to get average one (in the ...
-1
votes
0answers
17 views

How to solve 'need finite 'ylim' values' in R while plotting a time series graph? [closed]

I am working with a large MODIS dataset and I am trying to plot the time series graph of it's NDVI values. I have created a raster brick of all the imageries and then converted the brick into a vector ...
1
vote
1answer
32 views

Crop multiple rasters using map or mapply?

I have a folder of rasters with slightly different extents. I would like to apply crop to the whole list of rasters. I'm trying to teach myself how to use the purrr map family, but I can't get that or ...
1
vote
1answer
34 views

Determining which layer in raster stack is first to meet condition using R?

I want to analyze a raster stack and determine the first layer in the stack that meets a condition for every pixel. Here's a reproducible code example generating rasters and making a stack. # ...
0
votes
1answer
56 views

Creating raster cell squares around SpatialPoints (until a certain value range of the raster cells is achieved)

I have a DEM raster and a list of SpatialPointsDataFrames (data available here https://drive.google.com/open?id=1ERFdsqDGLH1a_FbxwawE_gPm0Au0Q9vT). EDIT: (with regard to @Spacedman's comment) I ...
-1
votes
1answer
37 views

Creating isometric “stack” of raster bands using R?

Is it possible to create an image like this one by using R? The image is taken from UseR! 2019 Spatial workshop part I.
0
votes
0answers
36 views

Creating buffer for polygon in R

I am quite new to GIS area. I have a polygon and use concave hull function I could get a boundary like this What I what to do is add a certain-width band along the boundary, so that it could look ...
0
votes
1answer
29 views

R Shiny Openstreetmaps - lock map within a set of upper and lower bounds

I am using Openstreetmaps with R/Shiny. I am trying to restrict map display to a given range of coordinates, i.e.xmin, ymin, xmax, ymax so that the users of the map won't be able to look other parts ...
1
vote
0answers
40 views

Problem creating a GeoTIFF with RGB splitting image - R

I've like to split a RGB raster in multiple pieces and save each image in GeoTiff format, but in the file name I need the count of points (pts) inside each piece. My code runs perfectly when I used a ...
-2
votes
0answers
35 views

Reprojecting raster from UTM to latitude/longitude in R? [duplicate]

I have two rasters. The first is projected in latitude/longitude The second in Lambert. So, I would like to reproject the raster in Lambert projection to latitude/longitude using R. How can I do ...
2
votes
1answer
44 views

How to make 'gdalUtils' package in R to use GDAL installed in OSGeo's directory instead of QGIS's directory

I have GDAL installed through QGIS and OSGeo in the directories: C:\Program Files\QGIS 3.6\bin\gdalinfo.exe C:\OSGeo4W64\bin\gdalinfo.exe My gdalUtils package uses GDAL installed in QGIS and I want ...
2
votes
0answers
27 views

Assign different colours to intersection between two polygons and difference area

I am quite new to GIS using R. I have two sets of data, upon which I could create two polygons like this: What I want to do is colour the common area (inner 'circle') and the space between borders. ...
1
vote
1answer
132 views

Finding overlapping polygons in two shapefiles and deleting them in R? [closed]

I have two shapefiles with more than 1000 polygons each, and they represent two types of agricultural fields in the same area, which means they should be different types. Some of the polygons are ...
1
vote
0answers
24 views

Calculating nearest distance between points and Spatial Polygons in R? [closed]

So right now I have pretty large datasets, about 200,000 (lat,long) locations and a Large SpatialPolygonsDataFrame with a polygons list of length 428386 spread in a single city of around 450 square ...
1
vote
0answers
51 views

Areas of imported features in Google Earth Engine

I originally wanted to ask the following question: "In the FeaturesCollection r_features, why do the two features have such different areas? They should have the same areas because they are both ...
0
votes
1answer
14 views

Using erfc function in r raster package, to convert temperature data to permafrost probability?

At present, I am looking at mapping permafrost in mountains, which is modelled as a function of Mean Annaul Air Temperature. To predict statistically the probability of permafrost, you use an equation ...
2
votes
1answer
38 views

CRS validity and PROJ versions

I'm not sure where the right place to raise this is, so: The PROJ strings for EPSG codes 4151 and 4283 are identical: +proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs which is a hassle ...
1
vote
0answers
25 views

Combining/getting elevations from .asc files or .tiff with x and y locations [closed]

I am new to R and still getting to know the environment. I am doing a project in animal movement. I have x and y locations (plus IDs, dates, hours) in an Excel table, converted into .csv as well. I ...
2
votes
2answers
46 views

Move features in spatial objects in R

QGIS has a "Move Features" tool where points can be moved. Is it possible to move features from within R? If not, is it possible to open R spatial objects in QGIS, move points in QGIS then import the ...
2
votes
1answer
79 views

Sampling random cells from certain areas of a cropped raster?

I have a raster cropped to the extent of some glaciers and divided it into three masks to address inner glacial cells, border cells and non-glacier cells adjacent to the glacier. Data can be found ...
1
vote
1answer
19 views

Read Postgis geom available as string variable with R

I have a Postgis Database from which I query data. I know that I can use the rgdal::readOGR() function with the PG driver to get geoms from the database into R. However, I am also querying lots of ...
1
vote
1answer
27 views

Randomly sample existing points from within polygons in SF | R

I have a set of existing sf points and want to randomly sample 1 point from each of a 1km2 grid cell over a landscape. I can create a grid of 1km2 polygons, but I can't work out in sf how to then ...
2
votes
1answer
37 views

Plotting State Border without Water using R and Raster?

Suppose I want to plot New York or Ohio using R: library('ggplot2') library('map') library('raster') map <- raster::getData("GADM",country='USA',level=1) map <- map[map$NAME_1 %in% c('Ohio'),] ...
0
votes
0answers
32 views

Select layer by location and copy features from multiple shapefiles to multiple shapefiles

I want to apply the reverse of the intersection tool between two shapes several times for different shapefiles. I have 95 point features in folder A, each representing a species location. In folder B, ...
2
votes
1answer
39 views

Converting coordinates from a local coordinate reference system

I am trying to define a local CRS in R based on the information in the screenshot image below My R code is as follows: I define the local CRS from the screenshot image I apply it to my dummy ...
0
votes
0answers
19 views

Problems with legend in DEM raster

This is a follow up question to this one: Addressing just the outermost cells in a raster? In this question you can find all the code and the data. To summarize: I have a DEM raster masked to the ...
6
votes
1answer
63 views

Addressing just the outermost cells in a raster?

I have a DEM cropped to the extends of a shapefile with different glaciers (see here for data: https://drive.google.com/open?id=1ERFdsqDGLH1a_FbxwawE_gPm0Au0Q9vT). DEM <- raster("***Glacier_Clip1....
1
vote
0answers
23 views

Not seeing R script folder?

Similar to one of the past questions above I am struggling to see my R script folder. Although despite restarting QGIS3.6.2 and also checking in this pathway: Options > Processing > Providers, for ...