Questions tagged [r]

Statistical computing language and software environment.

Filter by
Sorted by
Tagged with
0
votes
1answer
56 views

Mismatch in area calculation using R and ArcMap?

I am new to spatial statistics using R. In this scenario, I am trying to calculate the polygons area with in a shapefile by usingrgeos::gArea and compared with ArcMap calculate geometry value. both ...
0
votes
1answer
85 views

Using R and SQL together in sf - what is an efficient workflow?

Do anyone have any tips/tricks/workflows for working with an SQL query within a read_sf/st_read function call in RStudio? (I am struggling to figure out how to make a postgrsql/postgis example ...
0
votes
0answers
111 views

Convert list of raster* object into rasterBrickTS object in R

I have a list of raster bricks that have a date value in the z slot. I am trying to perform weekly averages across this list. For example, if my list had one brick for each day of a single week, I ...
0
votes
1answer
75 views

Write information on file using exiftool_call in R

I have a series of images (.tiff) that are only georeference at the true centroid of the picture. I have calculated the missing coordinates (top right, top left, bottom right and bottom left) in the X ...
0
votes
1answer
134 views

gstat variogram errors

I am at a complete loss on what I am doing wrong here. I am trying to build a variogram. No matter what i do i get errors. My Data: id lon lat datetime ...
0
votes
2answers
658 views

Error when using projectRaster in R

I'm having a problem with projectRaster on a raster brick in WGS84 to a projected coordinate system in R. I have obtained some oceanographic data in netCDF format from the Copernicus Marine ...
0
votes
0answers
72 views

Cokriging, Zero distance semivariance in cross-variogram error

Trying cokriging with simulated data, I faced a problem that did not seem one in the demo(cokriging) with the meuse dataset: I can't use fit.lmc() default but need to specify fit.method=1 as the ...
0
votes
1answer
77 views

Create a list of .TIFF without losing the metadata in R

I have a series of images (.tiff) that I would like to put into a list and then convert each image into a data frame. For that, I have created a list with my images. list.pics<-list.files(path="/...
0
votes
0answers
36 views

Map size, change the language of the legend plus get rid of the islands

I was able to build this map with data from the Eurostat As I am working in Spanish, the legend should be in this language nevertheless, in the legend still appears two words in English (under and ...
0
votes
1answer
349 views

Adding labels to raster with levelplot and spplot

I am trying to add district labels for a country, which I am plotting using levelplot (to use worldclim precipitation data) and adding boundaries using spplot. I am having trouble adding text labels ...
0
votes
0answers
79 views

Create projected raster from h5 file in R

I would like create a projected raster from an h5 file in R. The h5 file I am using is a snow-water equivalent grid for the Sierra-Nevada, California, and the origin for the coordinates is in one of ...
0
votes
1answer
79 views

R sf extrapolate grid from centroids

I've got a grid/raster in R that is represented as centroids of the grid instead of polygons. I am trying to merge that with points. library(sf) nc <- st_read(system.file("shape/nc.shp", package="...
0
votes
0answers
956 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
142 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,...
0
votes
0answers
49 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
2answers
111 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
2answers
425 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 ...
0
votes
1answer
181 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
2answers
172 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 ...
0
votes
1answer
107 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[...
0
votes
0answers
114 views

Plotting NetCDF File using R?

I download this data from the Argo website. When I tried to open it in ArcGIS 10, it produced only one set of LAT/LONG but I know there should be more than that. I tried using R. library (ncdf4) ...
0
votes
0answers
34 views

reverse clip (erase) for spatial point data frame (R) [duplicate]

I am trying to recreate the suggestion from this link but instead of using it on a sPolygondf, to do the same for a sPointdf. All is well, but I get an unexpected output - when I do the difference ...
0
votes
0answers
44 views

Efficient way for Buffering polygons with a large dataset

I use artificial grid cells (Polygons) for Sub-Saharan Africa to do a sub-national study. I have many variables assigned to each grid cell. Now, I need to include information (development aid programs)...
0
votes
0answers
98 views

problem with resizing Polygons with gBuffer in R

I'm working on something and having a little problem. library(tmaptools) library(rgeos) library(raster) library(leaflet) library(dplyr) USA <- getData(country="USA",level=1) Texas <- USA[USA@...
0
votes
0answers
903 views

Coordinate converter in R (GPS, DMS, dd, etc.)

There is probably a way to do this, but I can't find a way to transform a GPS DMS format to degree decimal in R. e.g. from GPS coordinate, see below, is there a way to transform this in R? gps....
0
votes
0answers
46 views

Seamless US Topo Rasters with R

I'm attempting to make a seamless raster from US Topo Maps for a large portion of the Western US. I have succeeded in converting the GeoPDFs from The National Map into GeoTIFF format using ...
0
votes
0answers
19 views

Integrating R into ArcGIS Desktop (ArcMap)? [duplicate]

Does anyone have any insight into using R with ArcGIS Desktop? I do not have any R experience, I mainly use SAS to do my data handling before I move into Arc. I currently run a geocoding and ...
0
votes
0answers
316 views

difference between gdalwarp in gdal and in R

I have got some issues using reprojection tool in R, which I already mentioned it HERE. Also read some topics like this but still have some problems understanding the different outputs from R ...
0
votes
1answer
80 views

How to regrid a raster after replacing the values of raster by the mean of 2 by 2 window and move to the next grid using R?

I am working on a raster image which is of 120m resolution. I need to make the raster divided into grids or windows of size 2 by 2 and then take the mean of the values in the grid and replace the ...
0
votes
1answer
276 views

GDAL framework does not exists after brew install; cannot locate gdal_polygonize.py

I am trying to get raster to shape form in R using John Baumgartner's code. This function needs gdal_polygonize.py from gdal package. I installed gdal package using: (I am using MacOS Sierra Version ...
0
votes
1answer
327 views

How to rasterize point data into a grid which can ensure 1 point in each cell at most

I'm trying to create a raster whose grid cell takes at most one point. The data looks like this: > head(ras) lon lat z1 z2 1 267573.9 2633781 213.29545 6 2 262224.4 ...
0
votes
1answer
178 views

Error in gstat.formula.predict(d$formula, newdata, na.action = na.action, : NROW(locs) != NROW(X): this should not occur

I'm trying to perform regression kriging using the code creating variogram m <- vgm(var(soil$Ba), "Sph", sqrt(areaSpatialGrid(slope))/4, nugget=0) v <- fit.variogram(variogram(Ba~RASTERVALU, ...
0
votes
1answer
369 views

Highlight Borders When Mouseover Fill Area - Leaflet-R

Following the guidance of TimSalabim I separated the borders and fill of my neighbourhood polygons so that I could order them appropriately with zIndex. https://lawsblog.netlify.com/post/leaflet-map/ ...
0
votes
1answer
217 views

Rasterize shapefile according to another big raster using gdal_rasterize

I want to rasterize a shapefile into a raster according to another raster (97284, 154208, 15001971072 (nrow, ncol, ncell)). Since the raster is very big, I am using gdal_rasterize following the ...
0
votes
0answers
39 views

Extract SpPolygon or SpLine vertices in RSpatial

I aim to calculate the concave Hull from all the points of my database. I'm trying to extract the vertices: -of a SpPolygonsDataFrame -of a SpLinesDataFrame both are imported by readOGR() I tried ...
0
votes
0answers
310 views

spTransform doesn't seem to actually reproject my data

I'm trying to create spatial point data and lay it over a shapefile. I'm starting out with simple LatLons, converting to sp using Coordinates(), changing the CRS to the same as the shapefile, and then ...
0
votes
2answers
54 views

Deriving grid of points from gridded vector dataset using R?

I have a large gridded vector dataset (see extract below) and would like to derive a grid of points centered in each cell of the grid. Is there a way to do this in R?
0
votes
1answer
74 views

R does not load coordinate reference when importing a multiband tif raster from Triplesat satellite

I'm trying to read Triplesat imagery into R. However there seems to be a problem with the coordinate reference in the .tif file as the crs, extent and resolution are not loaded. I tried two ways of ...
0
votes
1answer
181 views

change ggmap to sp.: Create circle where radius represents distance (km)

I am trying to made multiple concentric circles of multiple radii in kms scaled to a map, similar this post was using the post here (ggmap: create circles). map.sp<-readShapeSpatial("C:file.shp") ...
0
votes
0answers
196 views

Open NOAA daily datasets in R language

I need the daily mean temperatures and precipitation values for particular days and specific localities, far from any weather gauge. I guess that, for example, this dataset kindly provided by NOAA ...
0
votes
0answers
348 views

Might my file be too big to be written with 'writeRaster' in R?

I am trying to write a GeoTiff of a rasterstack that I created after some calculations. I am not quite sure how big the output-file might be. But I assume it has more than 4 GB. I can plot the stacked ...
0
votes
0answers
50 views

Why there is a mismatch of layers in R according to how the plot panel is resized?

Background In R, I have downloaded two datasets using the following commands (slighlty modificed from https://mgimond.github.io/Spatial/point-pattern-analysis-in-r.html): library(maptools) z <- ...
0
votes
1answer
144 views

Use spei() function with user specified parameters from a rasterstack in R?

This is a follow up to Using spei() function on time series from rasterstack in R? I am trying to use the spei() function from the SPEI package to calculate drought metrics. I have a rasterstack of ...
0
votes
0answers
84 views

How does the raster package handle no data/flagged values of ncdf4 files when loading them into raster objects?

I have ncdf4 files of NDVI measurs. When I load them with raster("path/to/file.nc") it seems that no data ("missing values") is replaced by one value that is within the ndvi value range (e.g. 0.928). ...
0
votes
1answer
172 views

r-Mapview non reponsive with large simple feature dataframe?

I am trying to visualize a large sf dataframe with around 1000 rows containing linestrings with mapview::mapview() in R. Unfortunately a warning comes up when I perform the command: mapview(data....
0
votes
0answers
51 views

Why does myRaster[1] <- 5 takes a very long time for a large raster?

I have a raster, which is not very big, only a few hundred megabytes compressed, but it has about 10 billion values, each stored in 1 byte (0..255). Uncompressed it would take about 10gb (lots of ...
0
votes
0answers
13 views

Exported feature class attribute table fields containing data read as NULL or 0 length vectors in R [duplicate]

I have encountered some odd behaviour trying to work with data exported from feature classes using the Export Feature Attributes to ASCII tool in ArcDesktop 10.4.1 (advanced licence). The data looks ...
0
votes
0answers
220 views

Rgdal: writeOGR to SQLServer

I am trying to write geodata to a Microsoft SQLServer 2017 using rgdal. dsn = 'MSSQL:server=XXX;database=XXX;trusted_connection=yes' data=data.frame(lat=c(52.52437), lon=c(13.41053), value=c("v")) ...
0
votes
0answers
202 views

Cloud detection in various scenes in R

I have 99 LS8 scenes (mountainous terrain) and before processing them any further I would like to mask out cloudy and snow pixel since they might mess up the topographic correction I have to apply. My ...
0
votes
0answers
158 views

limit photon geocoding results to a specific place

I would like to geolocate addresses from a particular city. I have just recently used photon R package as a geolocation solution with certain degree of success. Unfortunately, some results are ...