Questions tagged [r]

Statistical computing language and software environment.

Filter by
Sorted by
Tagged with
1
vote
1answer
14 views

Keep spatial lines intersecting spatial polygons using R?

I am trying to keep spatial Lines objects intersecting a spatial polygon in R. The intersect function from raster package is doing actually a crop. But what I need is to keep the lines intersecting a ...
0
votes
1answer
21 views

Extracting basic statistics (raster data) from different latitudes using R? [on hold]

I want to extract the mean, min and max stats from latitude -50 to 0 and from 0 to 50 etc. No idea how to do this. I would prefer using R for this as I have a lot of these to do.
3
votes
2answers
41 views

Converting output of crosstab() in R to a raster; from classified raster images to show overall land cover change in different classes

I have two classified landsat images from 2014 and 2018 both of them containing 6 classes including urban,forest,barren etc. In order to see how each pixel's class changed or remained same from ...
1
vote
0answers
28 views

Writing to file geodatabase 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 ...
1
vote
0answers
19 views

Adding raster layers to an existing GeoPackage in R

I have a GPKG file with a few vector layers. I have a few processing steps in my script and every now and then a new layer is added to the file. This works fine for vector layers using something like ...
0
votes
1answer
26 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
1answer
30 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
33 views

get intersects of indexed grouped polygons between 2 SpatialPolygonDataframes in R

I am testing 2 different methods (m2b & hmm) for classifying the movement behaviour of penguins to ultimately classify feeding behaviour from gps points and from these create kernel polygons to ...
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 ...
0
votes
0answers
29 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 ...
0
votes
0answers
17 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 ...
2
votes
1answer
95 views

R dissagregate method in python

It seems an easy question, but I can't find the Python equivalent of R's Dissaggregate: Disaggregate a RasterLayer to create a new RasterLayer with a higher resolution (smaller cells) I expected ...
2
votes
1answer
29 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 ...
2
votes
3answers
46 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
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-...
3
votes
1answer
775 views

Export a QGIS print composer file (.qpt) as PDF from the command line

I have a workflow where my R script produces csv's and shapefiles. Those csv's and shapefiles then serve as layers in a QGIS project. Every time the R script is run, it overwrites the previous data, ...
1
vote
1answer
20 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 ...
0
votes
0answers
31 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 ...
12
votes
1answer
10k views

Create polygons of the extent and boundary of a given Raster in R

I want to create two polygons. One is of the rectangular extents of my raster. I know I can obtain the extent of the raster using r <- raster("band5.tif") e <- extent(r) plot(e) gives me this: ...
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
0answers
15 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. ...
0
votes
1answer
747 views

spTransform error (unable to find inherited method for function spTransform)

I am trying to reproject a shapefile. For example, the land shapefile from Natural Earth. library(sf) shape <- read_sf(".../ne_10m_land.shp") shape_proj<-spTransform(shape, CRS("+proj=gnom +...
0
votes
1answer
13 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....
1
vote
1answer
24 views

Creating a 3D TIN or similar 3D Delaunay triangulation in R

Background: I have topographical datasets with height information as a starting point. The endgame is to create a dataset of triangulations which I can use to import into Parasolid to be used further ...
1
vote
0answers
545 views

gIntersects with large spatial data

I am using the gIntersects function from the rgeos package to check whether a river layer (polyline) intersects with a species maps (polygons). However, it is taking ages to do the calculations, ...
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): ...
0
votes
1answer
32 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
1answer
16 views

Plot GeoTIFF using tm_rgb from R tmap package

I've exported a raster object from QGIS into GeoTIFF format and imported it into R as a raster brick using the brick() function from the raster package. The file is too large to share but it imports ...
0
votes
0answers
19 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 ...
-2
votes
0answers
35 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
26 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 ...
1
vote
1answer
33 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
43 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, ...
-1
votes
0answers
18 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
35 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
57 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
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 ...
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
59 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.
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 ...
1
vote
0answers
24 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
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
30 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 ...
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
2k 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 ...
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 ...