Stack Exchange Network

Stack Exchange network consists of 175 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

Questions tagged [r]

Statistical computing language and software environment.

1
vote
1answer
312 views

random sample of raster cells based on multiple classes in R

I have a raster dataset that is classified into vegetation classes. I would like to randomly sample from the dataset based on the vegetation classes, but not sure how to do it. Here is some example ...
0
votes
1answer
566 views

spTransform error (unable to find inherited method for function spTransform)

I am trying to reproject a shapefile. For example, the land shapefile from Natural Earth. library(sf) shape <- read_sf(".../ne_10m_land.shp") shape_proj<-spTransform(shape, CRS("+proj=gnom +...
0
votes
0answers
19 views

Overwrite my shapefile in a temporary file

I would like to save my shapefile in a temporary file (named after the name of the shapefile). I would like this one to be saved after the transformation of the coordinate system. For the moment, my ...
1
vote
0answers
17 views

Batch reading features from many Geodatabases in R

I would like to learn to batch import from many geodatabases at once and merge the files together into a new unified shapefile. All of the GDBs and Features have a similar name and file structure. For ...
0
votes
1answer
105 views

How to extract raster attributes by lat/long location?

How can you extract an attribute value from a raster from a point (lat/long)? Example data: Raster with attribute table - value of interest is temperature I have a list of points with lat/long ...
0
votes
1answer
10 views

Plot GeoTIFF using tm_rgb from R tmap package

I've exported a raster object from QGIS into GeoTIFF format and imported it into R as a raster brick using the brick() function from the raster package. The file is too large to share but it imports ...
2
votes
5answers
1k views

Find nearest point along polyline using 'sf' package in R

This is a follow-up question related to my earlier post about using the sf package to split polylines using nearby points. I have 450 points with XY coordinates and a large river network (~214,000 ...
1
vote
1answer
17 views

How to build polygons from buffered points and merge overlapping ones using R?

I have a sample of 3 groups of points which are similarly spread within their groups. > pts x y [1,] 453067.5 364073.5 [2,] 453066.5 364072.5 [3,] 453068.5 364072.5 [4,] ...
1
vote
0answers
23 views

Automatic zoom when uploading shapefile R

I would like to set a zoom on the shapefile's canvas when it is uploaded. is there a function for that? Here is my script that allows adding the shapefile after reading with OGR : observeEvent(input$...
1
vote
0answers
16 views

How to convert from Large RasterLayer to Formal RasterLayer class in R?

I'm a bit confused about types here. While I'm loading a image: tif = raster(paste0(path)) I get some "Formal Class RasterLayer" object. But while I change it's matrix of values, for example: idx &...
-1
votes
1answer
38 views

Converting Kelvin to Fahrenheit in raster stack using R?

I have a raster stack with 372 layers with Kelvin temperature. I want to convert Kelvin to Fahrenheit. I know the function, but do not know how to adjust the code so it can be applied to all layer in ...
3
votes
1answer
45 views

gIntersection error: linearRing not created

I am trying to do something relatively simple but with large shapefiles. I have a shapefile of protected areas in the USA: and watershed boundaries: I want to calculate the percentage and ...
6
votes
4answers
6k views

Dissolving ploygons in QGIS or Grass to new polygons of defined population sizes?

I have a shapefile with 3800 polygons representing the smallest administrative areas in Ireland. Many of these, in rural areas, have tiny populations, under 100 people. In urban areas, all would have ...
0
votes
1answer
62 views

Performing trend analysis with R?

I have data of monthly temperature for 60 years. I want to analyze the trend for the monthly temperature in R. How do I construct R Code which would analyze monthly trend over the time series to ...
0
votes
0answers
14 views

How to bind points with polygons extracted from raster using R [on hold]

I have big tiff and load it using raster: tif = raster(paste0(path)) Next, I can extract all the polygons from the file (using some value P of interesting layer value): rtp = rasterToPolygons(tif, ...
0
votes
0answers
25 views

How to calculate mean for each raster layer in a stack? [on hold]

I have a data of monthly temperature (with several values in each layer (i.e temperature values for a month)for 31 years (372 layers). Now have to calculate mean for each month for 1980-2010 and save ...
1
vote
0answers
18 views

Quantifying similarity between two independent areas?

I'm assessing areas for suitability for species relocations, so essentially I'm looking to quantify how similar a possible relocation site is to a source site in several metrics. The species may ...
-3
votes
0answers
21 views

Creating 3D image from HGT DEM file? [duplicate]

I tried Displaying 3D raster/vector in GRASS from command line?: Error there is no nviz in my GRASS 7.6.x Already tried this too: Error m.nviz.image bad server connection Already see this and the ...
1
vote
1answer
30 views

Save a shapefile in a temporary file

I would like to add a line after the transformation of my shapefile in order to save it in a temporary file. uploadShpfile <- reactive({ if (!is.null(input$shp)) { inFile <- input$...
0
votes
0answers
22 views

Simple “Clip” geopackage with all attributes using R/ArcGIS/QGIS [on hold]

I have recently discovered geopackages and SQLite. I have a geopackage containing a shape (main.stand) and multiple tables (main.assortment, main.treestand,...) of individual forest stands. Some of ...
1
vote
1answer
90 views

R levelplot: How to shade some pixels out to show statistical significance

I am posting this also on stackoverflow because the topic is in the middle between GIS and R programming. I need to include statistical significance in a map in R using rasteVis, which is based on ...
0
votes
0answers
20 views

Extract time series from NetCDF stars proxy object

I'm trying to extract a time series from a netCDF file opened as a stars_proxy object in R. Looking at the raster to stars mapping table, I should use the aggregate function. But I'm getting a CRS ...
2
votes
1answer
39 views

Configuring lidR catalog to overwrite raster output (with different extension)?

I have a small issue with configuring the lidR package for parametrizing the extracted raster files with grid_metrics() function. My question is how to set in the catalog options that: be able to ...
4
votes
1answer
23 views

Using lidR to count number of pulse returns at different intervals?

I am trying to get the number of pulse at different height interval. I have used the lidR package to do this before with the code below but it seems that recent update in the package breaks my code. ...
0
votes
1answer
48 views

Setting origin raster to resample using R?

I need to resample a raster from nrow= 467, ncol=805, res=0.0416667 degree to nrow=2335, ncol=4025, res=0.00833333 degree. Basically make the pixel size smaller, because I have too many small polygons ...
1
vote
1answer
20 views

R: rasterize SpatialPolygonsDataFrame and keep factor field

I want to rasterize a SpatialPolygonsDataFrame and keep the values of a factor column. Consider the following code (from Processing vector to raster faster with R): library('raster') library('rgdal'...
1
vote
3answers
38 views

Error in Converting XY Coordinates to Lat-Long Using r proj4 Library

I am trying to write a script that will allow my colleagues to easily convert XY coordinates into lat and long. The idea here is to take a spreadsheet with only X and Y available and create a new ...
1
vote
0answers
33 views

Raster projected in Google Earth Engine showing weird values within R

I classified a raster in GEE and I am trying to work with the same within R. I have 7 land cover classes and when I view the output in R, I get something that does not make sense. Please see the ...
2
votes
3answers
135 views

R - Create multiple linestrings from multiple coordinates

I have a dataframe with two sets of coordinates X,Y and prevXal,prevYval and I would like to make linestrings column wise, and create an sf object of the same number of linestrings as rows in the ...
3
votes
0answers
43 views

Test the relationship between two point patterns

I have two point patterns obtained from medical images. Points are used to represent cell markers. By visualization, the point pattern A is extremely possible to be a subset of point pattern B. So is ...
1
vote
1answer
15 views

Using Formal Class RasterLayer as RSAGA input and otput

Is there a way to use the data from the R global environment object as input for an rsaga.geoprocessor alghoritm? And if yes, can be the output also saved as a same object? I am writing chain ...
-1
votes
0answers
22 views

Zipped shapefile upload, R Shiny [closed]

I've created a feature to import a shapefile (via .dbf .prj .shp .shx) but I would prefer to import only a zipped shapefile. How will I be able to transform this function? Here's my code : server.R ...
-1
votes
1answer
33 views

Calculating new raster metrics without polygonizing in R?

I have an enormous number of large rasters representing tree canopies. Every individual canopy has a unique number that is assigned to each pixel that is part of the tree. I am working with R and the ...
2
votes
1answer
93 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 ...
0
votes
0answers
33 views

Converting non-conformable multi-layer rasters to a big data frame

I want to create a big data frame from all rasters which are from all folders. All rasters share the same properties such as rain etc. and same x&y in the same folder, but they don't share the ...
1
vote
1answer
40 views

After calling projectRaster in R, missing right edge of world map when plotting with ggplot

I'm using projectRaster and rasterToPoints in R to get a dataframe with lat/lon coordinates for plotting in ggplot but I seem to be losing the right edge of the map (New Zealand). I'm not sure if this ...
1
vote
1answer
32 views

Using tmap for points in R?

I'm having a problem using tmaps to map out points in R. The data is taken from the Chicago data portal, and I was able to turn it into a sf object using the code below. However, when I try to use ...
2
votes
1answer
64 views

Why a laz file warns: 'return number' greater than 'number of returns' in R?

Reading a laz file with the lidR package in R I have the following warning. What does it means? las = readLAS("chmp15.laz", filter = "-drop_z_below 0") #> Warning message: #> Invalid data: 8895 ...
5
votes
1answer
118 views

How to assign (or project) CRS to LiDAR file in lidR?

Can someone enlighten me if there is a difference between initializing a CRS object using the EPSG code versus just the +proj string read from a shapefile? Consider the following objects: A ...
0
votes
2answers
459 views

Creating loop for Lines data (spatial data)?

I am trying to build a lines shapefile with the contour lines from the 20 meters isobath from along the East African coast. This contour line of 20 meters has different segments and I have this ...
0
votes
0answers
24 views

Using R for analysing relations between administrative borders (neighborhood of polygons) and voting results (or void votes)

What would be the relatively simple way to verify if there is a relationship between administrative borders (polygons) and voting results (like: void votes). This would be used to verify if voting ...
2
votes
1answer
124 views

Dividing a large raster into blocks for iteration in R

I have very big rasters for processing (#pixels >1,5*10^10) for this project I am working on. Simple functions such as finding the area of a pixels with a particular value, across the entire raster 1) ...
0
votes
0answers
36 views

Getting census tract centroids in R [closed]

I am trying to get the lat, long for census tract centroids using gCentroid. This is giving me very strange results, with multiple centroids per census tract. ctract <- st_read("tl_2016_06_tract....
0
votes
1answer
25 views

How to get WMTS tile coordinates?

What can I do with the given information: I don't know where I am in the World having some particular tile. It's only an ocean (or sea). "https://services.arcgisonline.com/ArcGIS/rest/services/...
0
votes
1answer
31 views

Using st_read to create an owin in R

I have updated a program because readShapePoly has been replaced by st_read. Changing from: unzip(paste(mdir, "AU_Vic_POA_2011.zip", sep = "")) boundary.shp <- readShapePoly("...
1
vote
1answer
35 views

sp::over vs sf::st_intersection in r

I was wondering why sf::st_intersection() takes too much time, in comparison with sp::over(); I use sf for pretty much all of my geospatial workflows (I was used to sp as well), and more and more ...
1
vote
1answer
36 views

converting non-conformable multi-layer rasters to a data frame

I want to create a big data frame from all rasters which are from all folders. All rasters share the same properties such as rain etc. and same x&y in the same folder, but they don't share same x&...
0
votes
1answer
52 views

Creating coordinate points based on polygon

I am trying to create coordinate points based on a polygon that I've created in Google Maps and imported into R as an sf object. Specifically I have sample points of physical samples I've taken, but ...
1
vote
1answer
36 views

Manipulating polygon data imported from Google BigQuery GIS within R

I have some polygon shapefiles (representing UK postcodes) which I have uploaded to BigQuery, using this guide, hoping to take advantage of the inbuilt GIS support described here. I am trying to ...
1
vote
2answers
199 views

QGIS GeoTIFF layer styling - category labels

I've created a raster object x in R, which is a categorical classification. I've used levels(x) <- RAT with a properly formatted raster attribute table to give the categories names, and then used ...