Questions tagged [r]

Statistical computing language and software environment.

Filter by
Sorted by
Tagged with
0
votes
0answers
3 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
8 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 ...
1
vote
1answer
27 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 ...
0
votes
1answer
30 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
11 views

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

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 ...
0
votes
0answers
21 views

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

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
vote
1answer
31 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
54 views

Setting origin raster to resample using R?

I need to resample a raster from nrow= 467, ncol=805, res=0.0416667 degree to nrow=2335, ncol=4025, res=0.00833333 degree. Basically make the pixel size smaller, because I have too many small polygons ...
2
votes
2answers
42 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 ...
5
votes
2answers
2k views

Seeking QGIS affine equation?

I am at the mercy of a govt authority who have provided utility information in a cad format with a 0,0 origin and a nonsense grid. About a dozen files, the grid and origin are entirely arbitrary. To ...
0
votes
1answer
52 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
35 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.
-1
votes
0answers
29 views

Mapping large shapefiles with R? [closed]

I have a large shapefile (134MB), which I am working on in R. I want to generate an interactive map of this, something along the lines of tmap or leaflet. The trouble is, every tool I have tried ...
1
vote
0answers
38 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 ...
1
vote
0answers
23 views

Easy way to plot separate groups of SpatialPolygons in R

I have SpatialPolygons grouped by 81 polygons and in each there are some other Polygons I'd like to plot them group by group but have little trouble with it. > rtu_spl class : ...
0
votes
0answers
33 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
25 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 ...
0
votes
0answers
31 views

What's cause differences between zonal statistics in QGIS and extract function in R? [closed]

I want to extract pixel values from my polygons in R. I tried to do it like this : library(raster) library(rgdal) library(dplyr) extent <- readOGR("myshapefile.shp","myshapefile") myraster <...
19
votes
3answers
28k views

Join spatial point data to polygons in R

I am trying to perform a spatial join between point data and polygon data. I have data that indicate the spatial coordinates of an event in my csv file A and have another file, shapefile B, that ...
1
vote
2answers
1k views

Calculate centre point of SpatialGrid object

I am using R and have a SpatialGrid object similar to the example from this question: Overlay a spatial polygon with a grid and check in which grid element specific coordinates are located ## read ...
1
vote
1answer
37 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 ...
1
vote
1answer
1k views

How to get latitude and longitude data from the borders of a state in R

Here is my problem: I need to get longitude and latitude data from the borders of the Brazilian states. With this data I can plot a map of each Brazilian state and, of course, of the whole country. I ...
12
votes
1answer
16k views

Reprojecting raster from lat/lon to UTM in R?

i have to turn it into a UTM in order to make the buffer functional. wets<-readOGR(dsn=".",layer="shapefile") r.raster <- raster() extent(r.raster) <- extent(wets) res(r.raster) <- 100 ...
-2
votes
0answers
33 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
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
votes
1answer
25 views

Which R package has basic map data of Europe embedded?

Where can I find open source map data for countries in Europe? I need geographical data such as borders, rivers,elevation and I need also statistical data (population, etc.) Is there by chance an ...
1
vote
1answer
24 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 ...
1
vote
1answer
117 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
1answer
31 views

st_write fails for object created with st_difference using R?

Using publicly available sea area shapefiles bahamas: http://www.marineregions.org/gazetteer.php?p=details&id=8404 ("eez.zip") watl: http://www.marineregions.org/gazetteer.php?p=details&id=...
0
votes
0answers
31 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, ...
1
vote
0answers
22 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
47 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 ...
2
votes
1answer
35 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 ...
2
votes
1answer
75 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 ...
0
votes
1answer
13 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 ...
1
vote
0answers
23 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 ...
1
vote
0answers
12 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 ...
2
votes
1answer
34 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
10 views

VCT Algorithm Using Landsat time series

I want to apply the Vegetation Change Tracker (vct) algorithm using Landsat time series. I have removed the water bodies out of the images, I have computed the FZ and IFZ values so that every image ...
2
votes
1answer
38 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 ...
6
votes
1answer
61 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....
0
votes
0answers
18 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 ...
0
votes
0answers
26 views

Split lines in R creating 2 group ids [duplicate]

I would like to split a linestring into two features separated by a point. Here's what I mean: This is what I've tried so far in R using the sf package: Sample data library(sf) library(dplyr) # ...
0
votes
0answers
7 views

Dynamic selection of data frame [migrated]

I have several data frames (or actually xts objects) that are named x_10min, x_h, x_d, x_w, as they have different time steps (10 minutes, hours, days, weeks). I would like to dynamically select the ...
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 ...
0
votes
1answer
57 views

Weighted mean of raster by polygons in R?

I have two rasters, raster_a and raster_b, and a shapefile, world_shapefile. Both rasters are of the world extent and overlay each other. What I want to do is to create a weighted average of raster_a,...
0
votes
1answer
21 views

Finding datasets embedded in R GISTools package?

How can I find the embedded datasets in R package GISTools? I can find examples of datasets (Georgia, Newhaven etc.), but I cannot see exactly which datasets are available.
1
vote
1answer
13 views

Deleting small polygons in an sf-object

I have an sf-object (shp downloadable here: https://drive.google.com/open?id=1ERFdsqDGLH1a_FbxwawE_gPm0Au0Q9vT) with multiple glaciers. I want to delete glaciers smaller than 0.05km² by using a for-...
2
votes
2answers
43 views

writeLAS writes corrupted file: 'end-of-file' after 10468 of 10474 points

I am seeing strange write behavior with lidR. The outputs from lidR are compressed to fall on a single line. I vaguely recall discussing this with JR before, but cannot recall a solution. #ok las0=...
1
vote
1answer
13 views

How to delete parts of a multipolygon inside an sf-object in R?

I have spatial data (about some glaciers) as an sf-object. My shp-file can be downloaded here: https://drive.google.com/open?id=1ERFdsqDGLH1a_FbxwawE_gPm0Au0Q9vT Some of the glaciers are separated ...