# Tagged Questions

Statistical computing language and software environment.

38 views

### Deciphering coord. ref. in R – very basic question

I'm trying to make sense of the coord. ref. parameters for rasters in R. For example, for a given raster, crs() gives the following: +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0 ...
75 views

### collocated cokriging with gstat in R

I am trying to perform cokriging with temperature as the target variable and elevation as a secondary variable. Elevation (the secondary variable) is collocated with temperature (the target variable) ...
41 views

### Using the extract function in raster package for R with polygons

I have a shape file that contains some polygons and an unprojected raster. I'd like to extract the cells within the polygons using R, so I use code like this: # Load my polygons MyPoly <- ...
94 views

### How to generate a buffer outside polygons having a given pixel value?

For example, I would like to build a 20-m buffer (represented in yellow in the image below) outside polygons having a value of 2 (represented in green) and to assign the value of 3 to buffer cells. ...
40 views

### How to overlay a polyshape to faceted maps in r with ggplot?

So i am quite new to the use of r and ggplot to produce high quality output maps for publications. I have managed to create a faceted map from my data following the approach proposed here http://...
51 views

### Tabulate intersect in R

I would like to get the areas related to the polygons resulting from the intersection between two SpatialPolygonsDataFrames: 'A' and 'B'. SpatialPolygonsDataFrame 'B' has 3 different 'classes', which ...
31 views

### Estimating Daily average temperature from 2021-2050 in R

For my study I am dealing with daily temperature modeled data from 2021 to 2050. My data is in ncdf format. I want to calculate the average daily temperature across this period i.e the result should ...
87 views

### Find NoData values inside a polygon area from a raster

I have a raster (representing a polygon in black) which contains NA values (represented by white pixels) that are located inside the polygon and outside the polygon. How can I get the index value ...
47 views

### Converting data from data frame into raster file using R?

I have the following data frame (long, lat, value) (all coordinates are within Colombia): Spoints: x y z 1 -75.67083 7.57916667 7.328901e-19 2 -74.59583 ...
204 views

### Leaflet output is grey

I would like to implement leaflet in shiny with R. I try to go with the simple examples I found online: library(leaflet) library(ggmap) somePlace <- ggmap::geocode("Vienna") # Information from ...
81 views

### Troubling using MODIS package in R (mac). Error with gdal

I'm new to using MODIS data, and have been trying to set up a a way to use the HDF files produced by MODIS on R. I had trouble with gdal (could only download the package through system dialog), and ...
55 views

### Finding and loading global population density raster data into R?

I am using the Bioclim dataset for a maxent project right now, but I want to add demographic predictors along with climatic ones. I have the 19 layer raster data from Bioclim and I'm hoping to use the ...
81 views

### Crop Raster from using Polygon shapefile in R

I am trying to crop a raster by a polygon in R to the state of Sergipe-Brazil. My raster is a raster brick criated by 7 .tif files which are EVI (vegetation index) time series. Since the EVI archives ...
172 views

### Create polygons of the extents of a 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) but don't know how ...
37 views

### Find Maximum value per month in rasterstack/brick and corresponding timestamp R

When dealing with raster images, I found the raster and rts packages in R to be very flexible for analysing my raster data unlike ArcGIS. In my learning efforts, I have had to do some stacking/...
60 views

### Error writeOGR using R

I am learning how to use writeOGR to write a GPX file. When I run the line of code I get an error message: Creation of output file failed. Example set of data dput(head(location_information)) ...
93 views

### Converting position data created in R to GPX format?

Does anyone know if there is a way to convert position data (latitude and longitude) created in R to GPX format to use with navigation software? I have been searching and havent found an answer. ...
74 views

### How do I get rid of edge effects while using focal in R to smooth a raster?

I am trying to use R with the focal function from the raster package to smooth raster images. I am working with Radar images that have already been preprocessed. As part of that, some calculations ...
73 views

### extract() function from r raster package returns different cells if “weights” parameter is TRUE or FALSE

I am trying to extract cell values from a RasterLayer based on a SpatialPolygons object. I create the raster with library(raster) rasterValues <- matrix(rnorm(20),4,5) r <- raster(rasterValues)...
167 views

### Differences in MaxEnt between 'Biomod2' and 'Dismo' package

I am trying to run an ensemble species distribution, however the the results I am getting for MAXENT.Phillips model are not reasonable projections compared to the Random Forest and Boosted Regression ...
69 views

### Changing/ updating dimension values of ncdf file in r

I posted this question to SO but in hindsight, gis.se is a much more suitable place: I have several ncdf files that do not have the correct spatial dimension values so I want to update these values. ...
40 views

### Find Lat and Long points on land only

I'm new to R and GIS so please forgive me if this is a simple request. I was looking for a way to find out if a Lat/Long point is on land or ocean. I found this previous post from a couple of years ...
53 views

### Is there an R package for finding the maximum-area rectangle in a non-convex polygon?

Does anyone know if there is an R package out there with an algorithm which finds the largest rectangle within non-convex polygons? I have Googled, searched the R Sig Geo archives, and looked here on ...
64 views

### How to clip MrSID Files in R and export to GeoTiff?

I would like to use R to: Read in an MrSID raster (.sid format) Clip the extent using a shapefile Save the new clipped raster as a geotiff I am fine with steps #2 and 3, but I can't find any ...
57 views

### Downloading MODIS data of cloud cover less than 10%

I use ModisDownload from rts package for downloading MODIS data. But is it possible to specify cloud cover and view angle before downloading? e.g. if I want to download MODIS data for cloud cover less ...
99 views

### Convert raster stack to RGB GeoTIFF for use as a background image in maps (in R)

I've been trying to use R to download google maps images as rasters, then convert them into GeoTIFF files which can be imported as a geo-referenced background layer in GIS programs. I've been ...
52 views

### How to clip a .osm.pbf file to a shapefile in R

I have (1) an OpenStreetMap file of a large area in .osm.pbf format that I would like to clip with (2) a shape file .shp of a smaller area using R. The output output I would like to get is a .osm....
45 views

### How can I plot points with proportional circles, but also by colour from another attribute? [duplicate]

I have point data of population density that I have plotted to show density with proportional circle symbols. This is straightforward with many ways of achieving this in different software and ...
93 views

### Change the values of NA cells in a raster by using a geographic subset of the raster as a condition

I would like to replace the NA cells that are within a specified extent (here rectangular area defined by drawExtent in the code bellow) of a raster object. My idea was to use the functions ...
62 views

### Create shapefile connecting points “as the crow flies” in R

I have a set of locations (with latitude and longitude). I know how to get the distance between these points, but I want to create a line that connects them with the shortest path ("as the crow flies")...
28 views

### Link between arcgis and R

I am modelling vector abundance using R-INLA package. Next I need to made a map of vector distribution and I use ArcGIS, raster calculator tool. Is there any form to link R and ArcGIS for this purpose?...
38 views

### GIS Least Cost Spanning Tree in R

Is there an R package/function that computes a least cost spanning tree given a shapefile or vector containing the latitude/longitude of each point and a raster file that contains the cost of ...
49 views

### non-finite value supplied by optim when I use estiStAni or fit.StVariogram

I have computed an empirical spatio-temporal variogram and I want to fit it into a model I built using vgmST. However, whenever I call fit.StVariogram I get the error "non-finite value supplied by ...
15 views

### glcm texture in R (mean_Envi)

I am running a Image texture measures from grey-level co-occurrence matrices (GLCM) using the glcm package in R and I would like to know what is the difference between mean' and 'mean_ENVI' / '...
118 views

### Remove lines from inside a polygon (shapefile) in r

I have this code which prints the Galápagos Islands. But inside the islands, there are lines that I want to get rid off. How is this possible in R? library(rgdal) library(ggplot2) URL <- "https:/...
53 views

### ArcMAP / R: Convert raster pixels to Long and Lat

I have downloaded a raster, which has the following information. Item Data Date 2015-01-03 00:00:00 Product cold partial sst Satellite NOAA-18 Direction Unknown Dimension 1596 x 1617 BPP ...
61 views

### Transformation from EPSG 31983 to EPSG 4326 change only one axis (R + ggmap)

I'm trying to convert my shape file with spTransform(), but it's not successful. I don't know why it's changing only one axis. I want to change the axis into decimal degree. # Libraries --------------...
217 views

### Converting SpatialLinesDataFrame to SpatialPointsDataFrame in R?

In R I have a SpatialLinesDataFrame (for example from a coastline shapefile) and I want to convert it to a SpatialPointsDataFrame. I want to keep all the vertices from the line shapefile to become ...
109 views

### Changing the cell size and projection of a raster to correspond with the ones of another raster

I have two rasters with different resolution and projection. > r1 class : RasterLayer dimensions : 2510, 5233, 13134830 (nrow, ncol, ncell) resolution : 56, 56 (x, y) extent : ...
54 views

### How do you extract the mean fire frequency (raster) for each point within a given buffer size using R?

I am trying to extract fire data (mean and max fire frequency) for each point within a given buffer size (250m) around multiple points. Currently, my point data is in Lat and Long. For the raster ...
63 views

### Copy resolution extent CRS metadata from one raster file to another using raster R

I have two geotiff raster files, one has all the metadata information and in the other the information was lost. I know that all the metadata information was exactly the same so I want to copy it from ...
36 views

### Assigning column names dynamically

I have an interesting problem: I need to batchprocess a few files. I do that in a for-loop, where some operations are performed. Later on I want to write the outcome into an existing shapefile which ...
12 views

### Using 'Index-type' raster layers with negative values as independent variables in a multiple linear model in R

Using a multiple linear model I am trying to quantify the "effect" of abiotic landscape characteristics (slope, elevation, solar radiation, and a load of terrain indices) on vegetation greenness (NDVI)...
23 views

### Computing intersection of distance circles around fixed points [duplicate]

(to simplify calculations, I assume a spherical earth. All distances are assumed measured "as the crow flies") Suppose we have the lon/lat coordinates for two points (p_1,p_2) less than Nkm apart. ...
84 views

### How to do operation after using over() for a shapefile in R?

I am copying the answer of Counts the number of points in a polygon in R library("raster") x <- getData('GADM', country='ITA', level=1) class(x) # [1] "SpatialPolygonsDataFrame" # attr(,"package") ...
55 views

### Determine if mapped points are related geographically [closed]

Hoping you can help. I'm a clinician trying to determine if some mapped points are related. I basically have a data set of certain long/latitudes. Each lat/long is associated with a positive Sputum ...
83 views

### Great circles path not curved (in R)? Conventions and convertions problems?

I am given the great circle equations of two paths. The first one is Longitude = 168 degree. and the second one is: tan(Lattitude)=.11 cos(Longitude) + .64 sin(Longitude) However, I am ...
442 views

### Read a table from an ESRI file geodatabase (.gdb) using R

I am trying to read a table directly from an ESRI file geodatabase into R. An example data file can be downloaded here. The database contains a point feature class (Zone9_2014_01_Broadcast) and two ...