Questions tagged [r]

Statistical computing language and software environment.

612 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
123 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
388 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
0answers
82 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
0answers
105 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
43 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
97 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
852 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
43 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
286 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
157 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
339 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
201 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
38 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
289 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
0answers
183 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
328 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
47 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
0answers
82 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
0answers
47 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
209 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
189 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
144 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 ...
0
votes
1answer
290 views

Plotting and/or exporting VIIRS SDR DNB data as GeoTIFF in R?

I already asked this question @stackoverflow however, perhaps it fits better here, due to the spatial nature of VIIRS data and the hdf5-eos file format. Im looking into how to handle .h5 (hdf-eos) ...
0
votes
0answers
297 views

Raster Time Series, express years in time series

What's the best option to express years in Raster Time Series object in R. I define years as dates: YEARSSEQ <-seq(as.Date("2008-01-01"), as.Date("2009-01-01"), "year") and then I pass them in ...
0
votes
0answers
50 views

Extent of shp files with R for overlapping

I have 2 shapefiles: data (spatial point dataframe) and polys (polygons dataframe). I want to do an overlap but is seems that it does not work. Here are data and polys: > data class : ...
0
votes
0answers
34 views

Preparing two raster datasets for grouped barplot

I have two overlying raster datasets in ArcGIS which do have the same extent. One is a digital elevation model and the other one is a raster mask that contains three landuse classes (see figure below)....
0
votes
0answers
121 views

Mapshaper running out of memory on R

I'm using rmapshaper, the R wrapper of MapShaper, to simplify polygons without slivers and it works well on small shapefiles. However, when I run it on a larger one (~150M, ~5000 shapes), it runs out ...
0
votes
0answers
109 views

Comparing feature values between spatial points (same locations and variables - different surveys)

How can one (statistically) compare the feature values of one set of points against the feature values of a different set of points (within the same spatial extent)? I am aware of methods of ...
0
votes
0answers
190 views

Is there a way to retrieve shapefile attribute table information for a given coordinate in R?

Does anyone have an idea how could one get information out of shapefile attribute table (class SpatialPolygonsDataFrame in R), in my case data from column that contains species names, based on a list ...
0
votes
1answer
315 views

How to estimate kernel bandwidth function with cross-validation gwrr package

I am relatively new to R. I am attempting to use the gwrr package because I suspect that local collinearity may be an issue in my geographic weighted regression model. If I am not mistaken, I first ...
0
votes
0answers
367 views

Plot RGB raster on basemap in R

I want to plot my RGB raster on a basemap in R. So far I have a RasterStack object and I have downloaded the basemap with ggmap. I can plot them individually but not together. stack_rrs <- stack(...
0
votes
0answers
153 views

Appropriate method for transforming log-transformed kriging predictions back to original scale (R)

I am attempting to run some interpolations using kriging on transformed data using the transformation log (x + 1) - because my non-negative data has many zero values. The problem I have is with back-...
0
votes
0answers
69 views

Reclass a landuse shapefile based on another shapefile using R

I have a landuse shapefile that I want to modify based on another shapefile. In this example I have three classes in landuse shapefile A. Say I'd know that everything within one of the small ...
0
votes
0answers
61 views

Map point class diversity on raster efficiently in R

I have a point data set of roughly 2'000 features that represent User GPS locations. I'd like to calculate the User diversity per pixel. This is a (very slow) Pseudocode: library(raster) library(sp) ...
0
votes
0answers
82 views

Copying coordinate system and extent from a TIFF to a polygon shapefile in SAGA GIS

I used R to batch process object based image segmentation on some geoTIFF files using rgdal to communicate with SAGA GIS. I got the resulting shapefiles, all with the following properties: Projection ...
0
votes
0answers
296 views

Summarizing multiple raster values by polygon

I have seen several discussions about zonal statistics and similar processes for summarizing rasters by polygons, however I have a question that I can't seem to find an answer to. Most of these past ...
0
votes
0answers
193 views

is plotkml no longer updated for current R release?

I am attempting to use plotkml to read gpx files and plot them using R. Many others have done this with great success. A few examples are below: https://www.visualcinnamon.com/2014/03/running-paths-...
0
votes
0answers
62 views

May I change rgrass7 location in R script

I'm using Grass-GIS 7.2 in R with rgrass7. I would like to use rasters from 2 different location. Is there a way to do that without brutality ? At this time it works with : library(rgrass7) # ...
0
votes
0answers
511 views

How to write netcdf files with multiple variables?

I'm using raster stack objects and I want to use multiple stacks and write them in a single netcdf file. In case of one stack its straight forward as the below example, but how can I have both of the ...
0
votes
0answers
84 views

Cannot extract cell values after reprojecting raster in R?

I've downloaded an 8-day composite (4x4km) of "chlorophyll a" for May 1, 2014. https://oceancolor.gsfc.nasa.gov/cgi/l3?per=8D&prd=CHL_chlor_a.nc&sen=A&res=4km&num=24&ctg=Standard&...
0
votes
0answers
477 views

Reading a BigTIFF file in R

I am trying to load a BigTIFF file into R, so that I can extract some data from a set of coordinates. The file I am working with can be found here: ftp://ftp.soilgrids.org/data/recent/...
0
votes
0answers
281 views

Extracting information from Esri Grid Format (ADF) file using R?

I have an adf file that has a variety of "attribute" or field layers, and I am trying to extract one layer from that adf file, and convert it to a tiff image for further processing in python. Here is ...
0
votes
0answers
145 views

R memory issue with large polygon grid file

I have a 1 km by 1 km grid polygons for all of Ontario, Canada. This file is roughly 1 GB with 1116965 rows and can downloaded here: https://www.ontario.ca/data/utm-universal-transverse-mercator-1-km-...
0
votes
0answers
37 views

Recode 1 raster conditionally, based on many others

the basic premise is that I have 1 chief raster with values 55 to 75 and 6 rasters (A to F) which have all sorts of values between 1 and 15. If the chief raster has values (e.g.) 50 to 55, those ...
0
votes
0answers
176 views

import SpatialPolygonsDataFrame (SPDF) into PostgreSQL DB schema from R

This is a followup question to Writeogr to PostgreSQL/PostGIS database with R How can I choose the schema where to put the SPDF (or any other spatial object)? postgis_insert(con, df=catchments, tbl=...
0
votes
0answers
316 views

Extract raster values from RASTERSBRICK using XY coordinates falling within each polygon R

I have a rasterbrick s (10000 raster layers) that actually is a time series raster. Accompanying s is a SpatialPolygonsDataFrame with many sub-polygons which can be identified by names and/or IDs etc. ...
0
votes
1answer
909 views

Converting raster stack to RGB GeoTIFF for use as a background image in maps using 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 ...
0
votes
0answers
778 views

Downloading NOAA AVHRR NDVI using R

I am using the gimms package to automatically download NDVI data from 1981-2013. The code is provided here. The data is available here. However, after running it shows that data has been downloaded ...
0
votes
0answers
890 views

Extracting multiple values from list and storing them in data frame using R?

I have a list of 3 SpatialPolygonsDataFrames. Every element has a number which is the perimeter. I want through a loop to store the numbers into one cell of a data frame like: 154,526,442. I tried to ...