Questions tagged [r]

Statistical computing language and software environment.

950 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
0answers
859 views

Adding a custom color scale for a sp.points layer to levelplot() legend

I'm wondering how I can add a customized color palette that I used to display a sp.points layer in a call to levelplot (lattice plotting) in the rasterVis package in R. I used a function that Dave X ...
2
votes
0answers
125 views

how to extract line features from a raster

I have a raster of land cover types where roads are represented by pixels (1 pixel = 25m x 25m = 625 m²). Is there a way to extract line features (here roads) from a raster ? ## Create raster as an ...
2
votes
0answers
920 views

Efficient way to resample, crop, and mask a raster image using R

Does anyone know an efficient way to resample an image? I am currently trying to crop a large image and clip two regions from a shapefile. From this clipped image, I would like to increase the pixel ...
2
votes
1answer
73 views

Clear QGIS plot results window

How do you clear old plots from the plots result window in QGIS? Is there a line of R code that you'd need to run to do so, or is there a means of doing so through the GUI?
2
votes
0answers
369 views

About shp for ggmap in the R

I am a new in R and GIS, so I kindly ask you on advice. I had a shp which I want to plot on google map. The shpfile is here: http://www.filedropper.com/exercisestanddata First I do this: ogrInfo(...
2
votes
0answers
711 views

Delineate watershed using manual points in RSAGA

I'm currently trying for an automated solution to delineate watersheds within a large basin. I have a collection of locations (X,Y coords) for various tributaries reaching a larger river, and the end-...
2
votes
0answers
270 views

How to visualise change matrices over time

i've hit a bit of a tricky visualisation issue; I am quantifying some land use and land use change (LULUC) over a number of years. Typically, for data going from year to the next, a land change ...
2
votes
0answers
544 views

Raster memory usage in R

I am working with raster/brick data in R and running into memory issues. I am basically trying to use raster objects to perform some simple agent-based modeling, but the objects keep increasing in ...
2
votes
0answers
985 views

Performing Theil-Sen regression on raster data by R software

I have seven NDVI raster layers (in ERDAS img format) of an area. Each NDVI layer is the peak growing time of that year. I want to do trend analysis of NDVI values change over the years pixel by pixel....
2
votes
0answers
184 views

Merge Spatial polygons from shapefiles

I have downloaded the shapefiles from the following website: http://download.geofabrik.de/europe/france.html Each zip contains a "landuse" shapefile and I want to merge all of them in one single ...
2
votes
0answers
341 views

From track+waypoints to elevation profile with waypoints

I have a track and waypoints (1) imported in QGIS. I want to calculate the closest point from every waypoint to the track (2). Then, I want a table with data that allows me to draw an elevation ...
2
votes
0answers
229 views

rgdal with multiple Feature Datasets in R

I am trying to read shapefiles contained within a geodatabase file (.gdb) into R. The .gdb contains two Feature Datasets with multiple Feature Classes within each. The problem is only one of the two ...
2
votes
0answers
260 views

How to re-grid a raster using area-overlap weighted averaging?

I have two rasters r and r2 with different resolutions. I want to re-sample (re-grid) r2 to be the same as r using area-overlap weighted averaging:If an r grid cell is covered by more than 1 ...
2
votes
0answers
687 views

R geographically weighted regression with negative binomial distribution

I'm trying to find a R package that allows me to do geographically weighted negative binomial regression. I'm aware there's 'spgwr' and 'glm.nb' package. But is there a package that combines the two? ...
2
votes
0answers
189 views

How to measure similarity of approximately congruent polylines

My initial question was posted here. The answer of whuber provides a nice solution for the case when polylines are congruent. However, the problem is that my polylines are approximately congruent (...
2
votes
0answers
1k views

Calculate Euclidean distance to raster WITHIN multiple polygons

I am using ArcGIS 10.1 on a Windows x64 system. I am working in a study area where I have 360 000 locations of about 50 territorial animals. I have a shapefile containing 125 sometimes overlapping ...
2
votes
0answers
274 views

kriging of compositional data (grain size)

I have posted this already in the GEONet Forum but without any suggestions, now I am hoping for some feedback here: I have a problem concerning interpolation of compositional data of grain sizes. I ...
2
votes
0answers
98 views

Solving coordinate differences between packages

I have two maps generated by two different methods. The first, I used maps package and the function map() and symbols(). On the other hand, I used the ggmap package with the ggmap() and geom_point() ...
2
votes
0answers
139 views

how to display the legend when the map contains external icons in R

I haven't found anything about the legend when the map contains icons external R (in png), is't possible to use the legend function or another function in R.
2
votes
0answers
381 views

does the census bureau provide clipped / water-bounded files as nice as certain cities?

this question says they do but when i compare what i can find in the cartographic boundary files section of the census bureau's gis page, they don't look as good as certain shapefiles provided by the ...
2
votes
0answers
195 views

Calculating surface and lines in 3D projection in R

For my internship research I am trying to compare the surfacearea and length of geometric shapes and lines in one coordinate system to another. I have a SpatialPolygonDataFrame in the European equal ...
2
votes
0answers
415 views

spatialpolygons heatmap in R - NAs in grey?

I have a spatial polygon data-frame and I am trying to plot a heatmap via spplot. It's a map of Europe and the values for the heatmap are in a column of the data-frame. Plotting it works fine but I ...
2
votes
0answers
801 views

Doubts with Ripley's K function Interpretation

I'm a self-taught person, I'm studying the K Ripley's function and I would need some person who give me some advices. First, I have written a little script of R in QGIS processor: ##Point pattern ...
2
votes
0answers
433 views

Ecoregions shapefiles: subsetting, extracting and summarizing data from raster

I am attempting to subset and project an ecoregions shapefile from : EPA ECOREGIONS my data set is found here: SHAPEFILES and RASTER When I run this code, two major problems occur: 1) I cannot get the ...
2
votes
0answers
324 views

Defining the boundary of a catchment area

I digitized contour lines from topographic maps and created a DEM. With the DEM, I estimated the boundary of a catchment area. Estimated positional accuracy of topographic maps is RMSE = 65 m, with a ...
2
votes
1answer
1k views

Python equivalent of spatstat's spatial point process functions

Is there a free Python package (i.e. PySAL?) that implements the standard summary statistics for spatial point processes, e.g. the F, G, J, and K functions? I'm happy to use R (i.e. spatstat) if that'...
2
votes
0answers
234 views

Write raster with its attribute table and symbology

I am classifying lots of rasters and I'd like to automate the legend creation and symbology displaying for easy manipulation. Here is the kind of raster I'm dealing with: library(raster) r <- ...
2
votes
0answers
1k views

R, GeoJSON and Leaflet

I recently learned about leafletjs.com from an R-Bloggers.com post. One such tutorial that I would like to achieve is to create interactive choropleth maps with leaflet. I have been using the rjson ...
2
votes
0answers
233 views

Moving point on OpenStreetMap route

Basically I generate random numbers in R language which are indeed times between bus arrivals. I need to simulate a moving point(a bus) in OpenStreetMap by using this generated numbers. I have read ...
2
votes
1answer
334 views

Extract areas with certain pixel values from raster

I have land cover data from GEE (https://developers.google.com/earth-engine/datasets/catalog/ESA_GLOBCOVER_L4_200901_200912_V2_3) for specific countries. I would like to extract the values from the ...
2
votes
1answer
2k views

Lagrange Multiplier in lm.LMtests (spdep package for R)

Are the Lagrange values comparable in lm.LMtests? If both RLMerr and RLMlag are significant, would the test with the largest Lagrange value be considered 'better' at explaining the spatial ...
1
vote
0answers
22 views

How can you overlay raster data on a stamenmap in R?

I'm trying to overlay an image output from Google Earth Engine (.tif) on a basemap obtained using get_stamenmap {ggmap}. The object returned by get_stamenmap doesn't have a coordinate reference system ...
1
vote
0answers
20 views

On the calculus of joint-count test on no-full grid

I have a data points of presence-absence records and I want to perform joint-count test as it was suggested in the post https://gis.stackexchange.com/a/388939/178392 by calculating it on a grid (...
1
vote
0answers
38 views

Merging one polygon that is entirely contained in another polygon in R

I am working with subcounty division polygons obtained with the tigris package in R. Some of the county subdivisions polygons are entirely contained within another polygon. For an example of this, we ...
1
vote
1answer
21 views

How to find distances between countries based on borders in R?

I'm trying to get the distances from one country to a list of other countries based on the countries border in R. I was able to find one example: Closest distance between countries but it is using the ...
1
vote
0answers
41 views

How can I add the outline of Europe countries in this figure in R?

Here is my code to create this distribution map of Europe in R. So how can I add the outline in this figure to divide different countries and also add the countries' names in relevant regions? >...
1
vote
0answers
25 views

What is the canonical way to perform raster calculations using R stars?

I have a data cube that I am handling in the R stars package. It has 3 dimensions (latitude, longitude and time) and 2 attributes (northwards and eastwards components of wind). A dummy equivalent ...
1
vote
0answers
31 views

Plot “large” raster with leaflet in R

I have a geotiff that is around 26MB on my hard drive. I would like to use leaflet to plot it within a shiny application. However, it just doesn't load. When I use mapview just to plot it locally it ...
1
vote
0answers
29 views

Cannot open TIFF file due to missing codec

I am trying to rasterize a tif file by doing this: newData <- raster("file.tif"). However, when I run it, it says that it "Cannot open TIFF file due to missing codec". Upon ...
1
vote
0answers
26 views

Upper and lower bounds from gstat::krige() and gstat::idw()

Is it possible to obtain lower and upper bound values from a kriging estimation using gstat::krige() in the same way it can be obtained from a simple lm() model? The following lm() example comes from ...
1
vote
1answer
46 views

r sp::CRS() returns NA

I just updated R (from 4.0.2 to 4.0.3) and all my R packages (previously updated about a month ago), and got an error in a previously working workflow on raster objects. It seems that it comes from ...
1
vote
0answers
15 views

R -raster: Define raster extent from centre and rotation

I am quite new to R spatial transformation. My aim is to write a GeoTiff to be correctly geolocated in GIS software (e.g. ArcGIS). I have a raster with known coordinates of the centre (proj: UTM WGS84 ...
1
vote
0answers
36 views

How to “split” a single MULTILINESTRING into multiple MULTILINESTRINGs that intersect?

I'm trying to solve this problem using the R sf package, but I assume that an answer in PostGIS could also help me get to an answer in R. Basically, I have a shapefile with the following columns: &...
1
vote
1answer
60 views

R - Calculated shapes should be perfectly symmetrical but are not - why?

I'm trying to generate shapes to describe the no-fly-zone around airports. What I'm getting is shapes that are not symmetrical around the line of reflection, so this is either my lack of understanding ...
1
vote
1answer
78 views

R spTransform() in lidR - error: non quantizable value

I am trying to reproject a las file in lidR (doawnload file here) from epsg:2232 to epsg:32613, and get the following error message after about 3 seconds of processing: las <- readLAS("...
1
vote
0answers
12 views

Clever way of calculating and storing cumulative rainfall for each polygon of a MULTIPOLYGON sf-object

What I have is this sf-object: Simple feature collection with 50 features and 8 fields geometry type: POLYGON dimension: XY bbox: xmin: 611398.7 ymin: 5122699 xmax: 745144.8 ymax: ...
1
vote
0answers
25 views

How to compare the results of the random forest algorithm with the other SDMs?

I'm using the random forests algorithm in species distribution context. I have presence-absence as a dependent variable, so I decided to work with classification. At this point, I recovered the ...
1
vote
0answers
24 views

Spatial regression: general nesting spatial model using splm package in R

I have a shapefile of panel data (multiple years of observations for each polygon). I am estimating fixed effects spatial regression models with this data. I used one year of this data to generate a ...
1
vote
0answers
44 views

Calculate auto covariant term using focal function from raster package

I want to calculate the auto covariant by myself. At this point I found the function focal from raster package. Here I show I proceeded : glm_BEF_AUTO <- glm(as.formula (MODEL_FORM) ,family = ...
1
vote
0answers
21 views

Filtering duplicate records using space and time overlap

I have a dataset consisting of about 23,000 fire incidents obtained from years of fire brigade reports. The incidents have a lat, lon, and timestamp. The problem is that in the case when two (or more) ...

1
3 4
5
6 7
19