Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Statistical computing language and software environment.

0
votes
0answers
4 views

Adding polylines to leaflet map in R

I am trying to add great circle routes between various regions in R. Here's the sample data: structure(list(CommencingRegion = c("RedSea", "EastAfrica", "GulfofMexico", "FarEast", "RedSea", "...
0
votes
1answer
11 views

LecoS batch processing - Is there an easier way?

I'm using the LecoS software: https://github.com/Martin-Jung/LecoS I've clipped my raster to reduce processing time to focus in on the areas I'm interested in. The entire raster has 11 classes, but ...
1
vote
0answers
12 views

Adding color to polylines in leaflet in R

I have had a look at this and other links therein. This is exactly what I am trying to achieve and failing. Here is some sample data: structure( list( lat = c(51.88783,51.8878441,51.887825,51....
0
votes
1answer
27 views

projectRaster() result does not have the same nrow and ncol, but has same resolution

I have a land use land cover (lulc) raster in WGS84 coordinate system shown below class : RasterLayer dimensions : 59575, 57541, 3428005075 (nrow, ncol, ncell) resolution : 0.000509, 0....
0
votes
0answers
10 views

labpt, coords and bbox formatting [on hold]

I have one SpatialPolygonsDataFrame with @ labpt, @ coords and @bbox formatted like: num [1:7, 1:2] -74.2 -74.3 -74.3 -74.3 -74.3 Another SpatialPolygonsDataFrame has a different formatting for the ...
0
votes
0answers
16 views

How do I combine/bind two SpatialGridDataFrames into one in R?

I downloaded elevation data from the USGS National Map, in adf format, then loaded it into R using the rgdal package: library(rgdal) adf_file1 <- "/home/ma/Downloads/usgs/archives/n48w110/...
0
votes
0answers
35 views

writeRaster() not writing datum information

I am trying to reproject a raster to the USGS version of the Albers Equal Area Conic projection. Following this post, which talks about projecting vectors by adding the +datum=NAD83 and writing it out,...
1
vote
0answers
20 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, ...
1
vote
0answers
17 views

Using SAGA-GIS topographic wetness index in R?

I want to create a topographic wetness index (TWI) in R and I am trying to set an environment according to the help of RSAGA-package but I am always facing with an error appears in a different term. ...
0
votes
0answers
14 views

How to compare points joined to grid, versus points joined to grid + 15km buffer, using sf package?

I have an issue where I'm spatially joining points to grid squares, but sometimes they're just barely out of range. To address this, I want to identify which points become incorporated into these ...
0
votes
1answer
16 views

Different trend test result with modifiedmk and zyp package in R

I am running two sen slope trend tests in R, the first with the modifiedmk package and the second with the zyp package. I don't understand why with the zyp package the resulting raster raster.mkt2 is ...
-2
votes
0answers
12 views

Wrong presentation of line graph [on hold]

My code to the graph is: data<-read.csv("G://user//data.csv", skipNul=T) plot(data$DATE, data$DETREND, type='l') Then it resulted to the image as posted.
-1
votes
0answers
17 views

Spatial correlation from multiple netcdfs

Below is my code for calculating correlation of geotiffs: library(raster) library(ggplot2) userpath <- "F:\\userpath" r <- raster() A <- stack(list.files(path = userpath, pattern = 'file1*...
3
votes
2answers
46 views

Why different results of mean calculations with focal in R and Esri ArcGis

I want to calculate the ratio of two different classes in a raster with a circular moving window. My classes are 0 and 1 (I do not want to include the NAs). The radius should be 5 meter. I thought my ...
1
vote
1answer
21 views

Error when intersecting large spatial polygons data in R : rgeos_binpredfunc_prepared: maximum returned dense matrix size exceeded

I am trying to intersect two polygons that are SpatialPolygonsDataFrame. I am finally getting output after intersecting a small subset of the data frames. But when i run this on the entire dataset ...
0
votes
1answer
29 views

Running a function on subset of a raster image instead of whole image in R

I have a wide swath raster image. I want to detect cloudy pixels based on criteria such that a pixel in raster layer only consider its 25*25 neighborhood not the entire image. My problem is here that ...
1
vote
0answers
11 views

more than one reactive events to subset markers in Leaflet in R

I am trying to create a shiny ap in R that displays markers on a map. I have a couple of categories that I would like to subset. Currently, I can subset but the map is only reactive on a single input (...
0
votes
1answer
31 views

Create buffers around points and merge with SpatialPolygonsDataFrame to create a list of matched polygons and the area of intersection

I have data on polling booths as points and data on village boundaries as polygons. I want to create buffers of 1km around the polling booths and (a) save the ID of all the villages that intersect ...
0
votes
2answers
22 views

R: Writing individual variables from a RasterStack in loop

I have a RasterStack with 3 layers each one of them containing 19 variables. Using writeRaster I need to save specific variables into my directory while naming the saved files with the actual variable ...
0
votes
1answer
16 views

Spatial joining/merging two spatial points data frames in R via buffer?

I'm trying to spatial join/merge two spatial points data frames in R. One data frame is lacking IDs, which is the information that needs to be joined to the other data frame. To be specific, any point ...
0
votes
2answers
74 views

Correlation between raster pixels within each polygon

I have two raster layers with the same extent, CRS, and resolution, and a shapefile consisting of a number of polygons. I would like to calculate the Pearson correlation between the two rasters within ...
1
vote
2answers
54 views

writeOGR() not writing out datum of shp

I am writing out a shp, in ESRI shapefile driver. In R, the projection of this shp is +proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=23 +lon_0=-96 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=...
-1
votes
0answers
45 views

time series analysis bfast

I have a time series tree cover data from 2000 to 2016. Values of each pixel range range from 0-1. I am trying to figure out the trend in the data using bfast function. When all the values are 0, I ...
0
votes
1answer
22 views

writeOGR KML attributes blank [on hold]

Using the below I output a KML file from a Large SpatialPolygonsDataFrame polygonWGS <- spTransform(Polygon, CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")) writeOGR(polygonWGS, dsn="...
0
votes
1answer
32 views

Points in multiple polygons

I have two spatial objects, one polygon and one points. The polygons may overlap. I would like to associate each point with ALL the polygons it falls in. When the polygons do not overlap, I can do a ...
0
votes
1answer
25 views

Apply mann-kendall analysis on stacked raster in R as a function

I want to run a mann-kendall trend analysis with pre-whitening on a stacked raster and then save the resulting tau, sen-slope and p_value. I am currently doing this by looping through every pixel but ...
1
vote
0answers
14 views

RPostgres: No applicable method for 'st_as_sfc' applied to an object of class “pq_geometry”

Setup I am using sf::st_write() to load data into a PostGIS database. In order to do this, I first had to convert the geometry column of my dataframe from a character to a sfc vector. df$geom <- ...
0
votes
1answer
42 views

Producing animated map of tweets [closed]

I've downloaded a large dataset of tweets, and am thinking of producing an animated map of tweet mentions. For example, if user A mentions user B on Twitter, then I want to show a dot (or arrow, or ...
1
vote
1answer
32 views

Count the number of points in each Voronoi polygon

I have a Data.frame consisting of Longitude and Latitude called Points1, with which I use Voronoi polygon. I also have another Data.frame of Longitude and Latitude called Points2. I then want to ...
0
votes
1answer
34 views

geom_line() does not plot points from a shapefile in its correct order

I have been trying to load and plot a few shapefile in R using ggplot() and am facing an issue with a line vector shapefile. It seems that the readOGR() command is importing the line vectors ordering ...
1
vote
1answer
38 views

How to extract values from .tiff file using R?

Maybe a rather simple question, but I could not find an answer. I am trying to extract long, lat, value from a .tiff file of a map of Africa with long/lat and soil acidity as the values. Here is some ...
1
vote
1answer
47 views

USA Albers Equal Area Conic USGS version (LANDFIRE) projection not read by R or QGIS

I am working with the North America Forest Dynamics dataset. As mentioned it uses the USA Albers Equal Area USGS version projection, which is primarily different from the USA Albers Equal Area ...
0
votes
0answers
15 views

crosstab() rasters in R

I am having a hard time understanding the contigency table produced by crosstab() between two different rasters. Say the command is crosstab(r1,r2) [r1] [r2] Count 0 0 3456 1 41 ...
0
votes
2answers
34 views

Dissolve Shapefile and sum attribute in R

I have a shapefile with thousands of polygons and a separate csv of additional attribute data. I have joined these by new_shp <- merge(old_shp, add_data, by.x="ID", by.y="ID") However, now I ...
2
votes
2answers
39 views

Same colour palettes for two different maps in ggplot2

I am constructing two ion concentration maps in the UK using ggplot2. The dataset used for mapping are lzn.kriged1 and lzn.kriged2 which basically has the same structure: > str(lzn.kriged1) Formal ...
0
votes
0answers
66 views

Spatial analysis and parallel processing in R

I am trying to do a point-in-poly analysis using R. I have 4.5 million points and 5k polygons. This is computationally intensive. I was pointed to parallel processing through another post and tried to ...
4
votes
2answers
82 views

Generating random points inside raster boundary using R?

I have a projected raster shown in the image below (left). I want to generate random points inside the raster like the middle image. However, the result I am getting is the same as the image on the ...
0
votes
2answers
27 views

Remove internal boundaries in spatial object/polygon for plotting

I am trying to plot a spatial object where only the outer boundaries/borders are plotted. The only way I can think to do this is by manually removing all the lines/points within the spatial object and ...
0
votes
1answer
35 views

How I can read a shapefile with R. I have few errors with readOGR

I have a problem with reading my shapefile. The error: Cannot open data source In addition: Warning messages: 1: In normalizePath(path.expand(path), winslash, mustWork) : path[...
1
vote
0answers
18 views

Calculating Moran's I on large point dataframe in R

I have a dataset of about 77,000 points of which I want to test autocorrelation. I have tried to compute the test statistic using the testSpatialAutocorrelation tool in the DHARMa package, which uses "...
2
votes
1answer
39 views

Possible to call Rscript from ArcMap Python console without it opening up Windows cmd console?

I am helping to put together an ArcMap Toolbox, one component of which makes a system call to R's Rscript command-line executable. Everything works nicely, except that while the call to Rscript is ...
1
vote
1answer
26 views

Reprojecting raster between laea and lon/lat alignment issues

This is a follow-up post to a recent question on StackOverflow. I'm now facing a GIS problem rather than a coding one. I'm working with a DEM from this source, which has the following projection ...
0
votes
2answers
54 views

How to copy and past certain cell characteristics of +500 cells in excel at same time to create polygon shapefile?

I am currently looking for a solution which my colleague and I cannot solve. We have this dataset with over >500 areas for which polygons are made. We don't know with which GPS these coordinates are ...
0
votes
2answers
35 views

Creating empty SpatialPoints or SpatialPointsDataFrame in R?

I have been trying to create an empty SpatialPoints in R but have not found the way yet. I have tried with this formula: SpatialPoints(as.matrix(data.table(x = numeric(), y = numeric()))) But it ...
1
vote
0answers
52 views

Add gridlines to projected map in R

I am producing some maps to include in a publication. However, I am not able to include a graticule on my plot such that it resembles that in the image shown below. The image is projected but still ...
1
vote
1answer
49 views

Cookie cutting in R?

Is it possible to perform a cookie cut in R? Firstly, I have a polygon shapefile of many polygon some of which overlap. I then have a second polygon shapefile with contiguous non-overlapping ...
3
votes
1answer
47 views

Many points in many polygons, ID in R

I have a shapefile with about ~5k polygons. I have a database of about 3.8M points. I want to know, for every point, which polygon it's in. For example, Point A may be in Polygon A, Polygon B, and ...
1
vote
2answers
87 views

Batch Calculating Indices

I have 111 Landsat8 scenes which I want to calculate several indices for. The algebra to calculate them is most of the time Index= (b1-b2)/(b1+b2). I have the single bands (bands 1-11 respectively) ...
0
votes
0answers
25 views

Reprojecting MODIS MOD08_D3 to MODIS ISIN grid

Using R, I am trying to reproject/rasterize MODIS MOD08_D3 product (1 x 1 deg) into MODIS isin grid. To do so, I am simply looping the coordinates of the MOD08_D3 image and find the closest isin pixel....
1
vote
1answer
26 views

Can an ASCII Grid contain a CRS or projection?

I recently discovered the raster library in R. With that library one can define a raster's coordinate reference system (crs) or projection. For example, to set the projection as NAD83 UTM 10N: crs(...