Questions tagged [r]

Statistical computing language and software environment.

615 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
0answers
700 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 ...
3
votes
0answers
399 views

How do I access layer attributes from within QGIS' manageR plugin?

This is probably a fairly basic question, but searches for manageR come up with a lot of noise, and there's no manageR tag. What I'd like to do is load the attributes from a particular field of a ...
3
votes
1answer
754 views

R: Error when stacking multiple raster files

I have a large number of rasters in grid format ("asc"). I created a list of files: files <- list.files("D:/......../EnvironData", pattern='asc', full.names = TRUE) Then I ...
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. ...
2
votes
1answer
95 views

Writing raster with attribute table in R?

I fitted a species distribution model and predicted the suitable habitat using this model, and then I got a map plotted in R. I tried to save this prediction as a raster, using code: rf<-...
2
votes
1answer
80 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
0answers
81 views

Plotting KML data on Leaflet map

I have 5 different KML files for each subzone of Singapore map. I want to plot the KML data by subzone on a Leaflet map. library(leaflet) library(raster) library(readxl) library(rgdal) setwd("F:\\...
2
votes
1answer
48 views

Split a polylines according to a specific point in R

I have 2 distinct spatial objects: on one hand I have a SpatialLinesDataFrame on the other hand I have a SpatialPointsDataFrame Considering one line and one point that intersects that line, I ...
2
votes
1answer
51 views

Extracting residuals of maxent model in R?

I used "dismo" package in R, and ran a build a maxent model. Now I want to extract the residuals from the model in order to run a Moran I test later. But I got an error. The code was like: xm<-...
2
votes
0answers
39 views

Biweekly time series for raster stack in r

I have a netcdf file with daily data and I calculate for each week some statistics, using the "apply.weekly" command in the "xts" library. However, I would like to calculate bi-weekly statistics, ...
2
votes
0answers
64 views

All (GeoTIFF) raster values NA after converting to velox

Cross-posted to the velox GitHub repo: https://github.com/hunzikp/velox/issues/40 I'm able to extract average tree cover values for each of the three small counties in the US State of Delaware, but ...
2
votes
1answer
41 views

Using viewport rotate in R?

I am trying to rotate a viewport object in R. However, I end up getting boundaries for the rotated object. Any idea as to how to rotate but not end up with these boxes? Below is the code. m_cont, ...
2
votes
0answers
38 views

Detecting QGIS file lock

I tried using rgdal::writeOGR in R to overwrite a SHP file that was open in QGIS. Error in writeOGR(x, "C:/myFiles", "testFile", : Creation of output file failed Not only did it fail to ...
2
votes
0answers
29 views

Removing a 'non-gap' gap from a polygon that straddles +/- 180 longitude; looking for an R-based, code solution

I am working with a set of polygons from here: http://lme.edc.uri.edu/index.php/digital-data. In the artic, there are several polygons that straddle the +/- 180 longitude line. These are single ...
2
votes
0answers
57 views

Load images into a multi-band raster in R?

I have a Landsat image with 11 bands. I need to run k means classification in R. But I do not need the whole of the image as my study area is much smaller. So I have created shapefile of the Region of ...
2
votes
1answer
183 views

Handling raster data in a “rotated pole projection” with R?

My question is about using R to transform raster data from a rotated pole projection to a regular latlon grid - and then plotting it. I am working with data from a numerical weather model, which is ...
2
votes
0answers
62 views

Generating flow path using r.drain from rgrass

I need to generate the flow path using r.drain from the rgrass7 package in RStudio. I am new to GRASS GIS and prefer to use the R package instead. I want to generate a flow path from a grid cell. ...
2
votes
0answers
312 views

Sentinel 2 preprocessing with R

I need to transform Sentinel 2 L1C imagery to preprocessed Level 2A data. Ideally this should happen in R, as the remaining processing stack is already done in R. Are there ready preprocessing ...
2
votes
0answers
66 views

TIFF image from R displaying only white in ArcMap?

I cannot get this TIFF image, which was exported from R to display in ArcMap 10.5. I would like to georeference the nodes, but the image only displays as all white. Can someone help me with this? ...
2
votes
0answers
63 views

Points and bioclim layers plot correctly in R, but not in Maxent.jar

I am trying to use Maxent.jar. This program uses a CSV file of points and ascii bioclim layers (basically, a map of the Americas with climate data) and overlays them on top of one another. I find ...
2
votes
0answers
33 views

Creating networks and regions KML in R

I have >500 very large KMLs that contains only point data and a reference to a .png pop-up Each KML looks like this <kml xmlns:xsd="http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd" xmlns:xmlns="...
2
votes
0answers
65 views

How to create a stream graph with non-spatial data

The raw data would be like this: I want to create a streamgraph with the width of the polygon being the amount in the certain date for the certain purpose, the output should be in shapefile format : ...
2
votes
1answer
108 views

Building footprint polygon from LoD1 CityGML 2.0 using R and sf?

I have LoD1 building data from a federal agency in Germany in the CityGML format. I would like to import and strip the data into R to get only the footprint of the buildings and an attribut about the ...
2
votes
0answers
80 views

GIS Clustering with drawing predefined square area around points as cluster boundaries

I have a layer of points and I would like to create clusters where a predefined square area of 5km by 5km is the boundary for the cluster. Is there a way to iteratively draw square polygons around ...
2
votes
0answers
80 views

Any advantage to use elongated focal window for raster Pearson's Correlation?

I am performing Pearson's Correlation with 2 rasters (same res, size, extent), and will use a focal window, but is there any advantage or robustness to using a focal window that better reflects the ...
2
votes
0answers
68 views

Projection of raster to sinusoidal projection

I have my definitive raster shown below. This raster has the projection as mentioned here class : RasterLayer dimensions : 7276, 8330, 60609080 (nrow, ncol, ncell) resolution : 463.3127, ...
2
votes
0answers
77 views

Selecting raster pixels based on dem range

I have two raster layers that are equal extent and resolution: one that is qualified as nonforest tree cover that is made up of pixels with either the value of 1 or NA, and one DEM. What I am hoping ...
2
votes
0answers
122 views

Read only a crop or certain extent of a tif raster R

I am working with a huge amount of data in daily tif files (thousands of daily files). I am analyzing the mean of the raster in a shapefile area, repeated over potentially thousands of shape layers. ...
2
votes
0answers
181 views

Length of the boundary intersection between two polygons in R

I am trying to find the length of the border shared by two polygons. I have run cleangeo on these shapefiles. There were no flags that came up. I have looked through several other posts on the topic ...
2
votes
0answers
218 views

EPSG code lost when writing shapefile with sf

I've found that the EPSG can be recorded in the .prj file of a shapefile using the "AUTHORITY["EPSG","xxxx"] syntax. However, writing a shapefile with sf::st_write() doesn't seem to add that entry, ...
2
votes
0answers
126 views

Cluster Points on spatial network in R/QGIS

I am searching for a method for clustering spatial points along spatial lines. The points are connected to the lines. I tried nearest neighbour clustering and gProject/gInterpolate from the rgeos ...
2
votes
0answers
151 views

Working out travel time from gdistance's conductance values in R?

Introduction This question is indirectly related to a previous post of mine (Calculating accumulated walking pace from starting location outwards using R?), but asks guidance about a different aspect,...
2
votes
0answers
81 views

Spatial Downscaling of global temperature in R?

I am interested in spatial downscaling of global temperature to grid cell. What I have is a vector of future annual global temperature values which I would like to downscale to (hopefully) 0.5°. ...
2
votes
0answers
456 views

Make linear regression in multiple raster layers

I have a question about multiple raster layer regression using R or Arcgis. I would like to predict biomass using some Vegetation Index - VI (NDVI, EVI, SAVI, OSAVI...). and generate R² and RMSE maps ...
2
votes
0answers
199 views

Creating Adjacency Matrix using SpatialLinesDataFrame and SpatialPointsDataFrame in R?

I am trying to create an adjacency matrix of power plants that are connected via power lines. The plant data is point data (~8000 observations) with longitude and latitude measurements. The line data ...
2
votes
0answers
165 views

Calculating combined area of multiple polygons by counting overlapping area only once in R?

I'm using a shapefile in which polygons represent the geographic distribution of species. I need to calculate the combined range of several species sets, but the overlapping areas should be counted ...
2
votes
0answers
430 views

R coordinates on line nearest to point - multiple points

In R, I have a collection of points (~15,000) within a polygon. For every point, I want to calculate the location on the polygon boundary nearest to the point's location. I'm not bothered about the ...
2
votes
1answer
948 views

Efficiently process large rasters

I am trying to process some raster layers from Global Forest Change (https://earthenginepartners.appspot.com/science-2013-global-forest/download_v1.4.html, data produced by Hansen et al., 2013). ...
2
votes
0answers
282 views

R Leaflet plot ship direction

I want to plot ships and its direction on the map using R Leaflet. I tried to represent a ship as a circle and its direction with a line from the center as in the following picture. The problem is ...
2
votes
0answers
94 views

create neighborhood list in R with large dataset

I want to create a weight matrix based on distance. My code for the moment looks as follows and functions for a smaller sample of the data. However, with the large dataset (569424 individuals in 24077 ...
2
votes
0answers
326 views

how to calculate cumulative cost of movement, accounting for wind direction, in R?

I am trying to reproduce the calculation of the duration of sail-powered navigation as described in an academic article (http://www.tandfonline.com/doi/full/10.1080/15230406.2017.1403376), but using R ...
2
votes
0answers
89 views

Loading raster to R from PostgreSQL via pgGetRast takes a lot of time

I wrote R code in R Studio to load a raster (stored in PostgreSQL) to R. The database is stored here: C:\Program Files\PostgreSQL\ The following versions are installed on the computer: R version 3.4....
2
votes
0answers
218 views

R - Spatial Join Between SpatialPoints (GPS coordinates) and SpatialLinesDataFrame

I am working on a university project which combines data science and GIS. We need to find an open-source solution capable of obtaining additional information from a massive GPS coordinates dataset. ...
2
votes
0answers
181 views

Maintaining same extents in R?

How can I maintain perfectly equivalent raster and SpatialPointsDataFrame extents when in R? Each time I combine rasters, or raster and point data, the extents are very slightly different (like ...
2
votes
0answers
142 views

How to fix distortions at the edges of a UTM zone?

I have a grid of ~48000 points, however this grid has this break which coincides with two different UTM zones (36S and 37S): I don't know how this grid was obtained but it's pretty obvious to me ...
2
votes
0answers
96 views

Running Leroux model in WinBUGs

This may be a long shot, but I have been given some WinBUGs code to run a model with a Leroux prior. I'm interested in 'fixing' the precisions for Leroux prior and the intercept term in this model. ...
2
votes
0answers
443 views

R Shiny / leaflet map: Projection problem in creating map in Plate Carree projection

I'm trying to create an R Shiny map using the leaflet package to display input layers in the Plate Carree projection rather than the default Spherical Mercator projection. I've input OSM and WMS tile ...
2
votes
0answers
51 views

One-dimensional data in spatstat

I have data of one-dimensional points (locations in a straight line). I want to check if the cluster poisson process models or Cox models are a good fit for the data. Since my data only has x-...
2
votes
0answers
251 views

Extent projection from UTM to latlon (WGS84) and back again to UTM

I'm trying to crop a raster dtm.temp1 (with higher resolution and in WGS84) at the extent of another dtm.temp (coarse resolution in UTM). Using different approch I reach different results I try ...
2
votes
0answers
917 views

Draw shapefile over PNG image in R

I have a satellite image as a PNG with known coordinates (bottom, left, top, right). I want to draw a shapefile on it (the limits of a county) in R. My first thought was to convert the PNG (it's read ...