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.

0
votes
0answers
5 views

Combining st_join with st_nn to include all points within, as well as within a given distance of a polygon

This is a follow up to my earlier question (Spatial join in R - Adding points to polygons with multiple corresponding points). I have successfully joined a spatial points file to a polygon file in R ...
0
votes
1answer
13 views

Nearest Neighbor - return object ID in R

I have a csv file that contains the GPS coordinates of about 100 villages and their unique ID. I have an other csv file with the GPS coordinates of some potential destinations and their unique ID. I ...
0
votes
0answers
11 views

Is crop() Limited to 16 Bit Pixel Values?

I am working with Landsat 8 satellite data. In the scene data that I am analyzing, the band 10 pixel values are: low: 0 high: 39087 After I crop the raster, the pixel values are now: low: 0 ...
0
votes
0answers
14 views

Aligning grid to polygon R sf

I am attempting to create a dataframe of point locations based on a polygon. Specifically, I am trying to estimate the locations of trees in an orchard. So I need regularly spaced points within this ...
1
vote
1answer
28 views

Rasterize produces wrong result - R

I am trying to rasterize a polygon in R using teh rasterize function but the output is not correct. I am comparing the result with the output produced by the rasterize tool available in QGIS May data ...
0
votes
1answer
14 views

R - IDW interpolation using gstat

I have a data frame that can be downloaded here: https://www.dropbox.com/s/s5r66eptqm3jb5q/data.csv?dl=0 It contains two coordinate columns dist for distance in x direction and rel_alt for an ...
1
vote
0answers
22 views

Problem of reversed coordinates (XY) when importing WFS data with st_read

This question was originally posted in StackOverflow. I am trying to use French spatial data distributed using WFS. I want to use these data in a Shiny app that allows the user to update the data, ...
1
vote
0answers
13 views

Using R-scripts in QGIS 3.4

I installed the Plugin, and activated R in the provider options. When I go to the processing toolbox R is available, but I don't have the use online R-scripts, which are mentioned in the documentation....
0
votes
0answers
32 views

Mapping in R with latitude-longitude axis [on hold]

I want to produce a nice map in R, similar to the following. I have never used R for mapping and I can only find basic tutorials. Can anyone suggest/advice to any more advanced tutorials in order to ...
0
votes
0answers
20 views

ArcGIS GeoPackage ArcMap Drawing Error

I am trying to understand the meaning of this error. I created spatial data using the sf package in R and wrote out the data as a GeoPackage (i.e. a .gpkg). However, whenever I add the data into ...
2
votes
0answers
25 views

Convert bounding boxes between CRS in R

I feel like this is a rather straightforward question but I can't seem to find a suitable answer online. Hopefully someone here can help. I would like to crop a raster (projected in EPSG:27700) given ...
2
votes
2answers
40 views

Raster Calculation with 2 Raster Layers

I am attempting to create a new raster layer based on the values of one raster layer using a formula that is conditional based on the values in another layer. Two source layers: > ndvi class ...
1
vote
0answers
26 views

Area under the spectral curve?

There is an existing similar question here that I have tried but didn't give me what I need. I have an image with 20 spectral bands. How do I compute the area under the spectral curve that is ...
2
votes
1answer
24 views

Why does fasterize gives different output for multipolygons with and without internally resolved boundaries?

I was thrilled to be clued into the package fasterize, which speeds up the rasterization process in R tremendously. However, I cannot figure out why the fasterize() function outputs two different ...
-1
votes
1answer
41 views

Tabulating land cover types of raster data in R? [closed]

I would like to create a tabulation of cover types (raster) within a buffered area around a point of contact. Can someone point me in the right direction?
2
votes
3answers
27 views

Extracting coordinates of segments in raster from TIFF image?

I'm working with the attached tiff file and I am trying to extract the xy coordinates of the green lines. so far I saved the image as raster stack, and this specific image is from a layer of that ...
0
votes
0answers
14 views

Convert DWG to Shapefile Using FME and R

I converted a DWG file to an ESRI Shapefile using FME Workbench. Now I wish to create an elevation raster. I'm not sure how to extract the elevation info. library(sp) library(raster) # https://www....
1
vote
0answers
16 views

Raster correlation: Error (arg6) in raster.modified.ttest (R)

I am performing pairwise spatial correlation of 6 rasters using the raster.modified.ttest() function in R, as per this very useful post. I have consistently had the following error with my data; ...
0
votes
1answer
22 views

Linear model in R - Multiplication Expression [closed]

I have 3 numerical variables A, B and C. I am trying to create a linear model capable of predicting A. The expression that I am using is the product of B*C in order to predict A; however, when looking ...
2
votes
1answer
28 views

Transform CRS of Shapefile in R

I started with an AutoCAD DWG file and used FME Workbench to extract elevation data into a shapefile. read_sf yields: > shapename Simple feature collection with 41620 features and 1 field (with ...
0
votes
0answers
7 views

VeloxRaster_crop returns numeric

Curious as to why the following only returns a numeric vector with row and column information rather than a cropped raster: ras <- velox("dir.tif") cty <- st_read("cty.shp") ras <- ras$crop(...
0
votes
1answer
27 views

Using compareRaster (rasters): different extent? [closed]

In R I'm trying to make a RasterStack of RasterLayers, they all have the same format, the only difference is that one of them is a solo raster and the others are bioclimatic variables. The soil layer ...
-1
votes
0answers
15 views

Importing data into R .flt? [closed]

I was trying to do everything but my formula is still not working. mydata <- read.table("\\aaaaa.net\Finance_01$\NUC\Warsaw\20190416\20190416_MLT.flt", header=TRUE, sep="|") Error: '\F' is an ...
0
votes
1answer
28 views

Does lasfilterdecimate work when homogenizing by pulse?

In R lidR package, when I run lasfilterdecimate with the homogenize option excluding use_pulse = TRUE it works, but when I include use_pulse = TRUE, it does not work. For example, the code below ...
0
votes
1answer
17 views

Making raster histogram excluding zeros in R?

In R, can I make a histogram of all the non-zero values in my raster? Some reproducible data below. I just want the histogram to be made with the zeros. Happy with a way to do that, or I guess to ...
0
votes
0answers
12 views

Convert DXF file to RasterLayer

I am an R user and have a .dwg file of city buildings that I wish to transform into a RasterLayer using the heights as elevation data. The metadata for the DXF file states: DXF File Metadata: ...
2
votes
2answers
102 views

Compressing georeferenced images

I have a bunch of georeferenced TIFF images created in QGIS. The person creating them saved them as uncompressed (around 1 GB each). I would like to compress them as LZW to save space. How can I do ...
3
votes
1answer
46 views

lidR (rlas) writeLAS changes values from Classification attribute?

I have a point cloud with extra attributes: class : LAS (LASFˇ v1.4) point format : 6 memory : 2 Gb extent :7498400, 7499200, 5779500, 5780000 (xmin, xmax, ymin, ymax) coord. ref. ...
1
vote
0answers
21 views

Use geometry to join Spatial Dataframe

I have two Spatial Dataframe, the first one is the Paris Polling Stations from 2012, the other is the Polling Stations from 2017. They almost have the same geography, it deffers for 20 polygons (2017 ...
-2
votes
0answers
20 views

Object classification in R

I did a supervised pixel-based image classification using Random Forest algorithm in R. Now I would like to compare my results with object-based approach using the same classifier. Is it possible to ...
2
votes
1answer
44 views

Writing raster with attribute table in R?

I fitted a species distribution model and predicted the suitable habitat using this model, and then I got a map plotted in R. I tried to save this prediction as a raster, using code: rf<-...
2
votes
1answer
44 views

Extract areas with certain pixel values from raster

I have land cover data from GEE (https://developers.google.com/earth-engine/datasets/catalog/ESA_GLOBCOVER_L4_200901_200912_V2_3) for specific countries. I would like to extract the values from the ...
2
votes
0answers
21 views

Plotting KML data on Leaflet map

I have 5 different KML files for each subzone of Singapore map. I want to plot the KML data by subzone on a Leaflet map. library(leaflet) library(raster) library(readxl) library(rgdal) setwd("F:\\...
1
vote
1answer
22 views

Add layer to RasterBrick R

I have a RasterBrick and I am trying to add new layers to it, (with addLayer) but every time I try I receive the following message: Error in sapply(x, fromDisk) & sapply(x, inMemory) : ...
1
vote
1answer
26 views

Appending polygons in R using sf

I'm trying to create a multipolygon dataset where each row is identifiable. Example below library(sf) library(raster) # example raster data r <- brick(nl = 2, nrows = 5, ncols = 10) set.seed(54);...
0
votes
0answers
16 views

Combining Bathymetric and Elevation Data using R?

Here is some elevation data of some islands. I wish to add depth info to the water. With the generous help of @Spacedman at Overlaying elevation data and bathymetry data in R I get: To resolve the ...
1
vote
0answers
34 views

Mean function from rts package, returns empty dataset, R

I am using the rts package in R and specifically the mean function, over a a gridded climatic dataset with many NA values. When I use apply.yearly(my_rts_object,mean) all I get is an empty raster ...
1
vote
0answers
15 views

Set attribute length when exporting features with st_write

I have sf features that I have created/manipulated in R that I need to export to shapefile (my client only accepts shapefile format so I cannot use .gpkg or other formats). I have used st_write to ...
0
votes
0answers
11 views

Extract random effects from CARBayes output

We conducted a study at the U.S. census tract level looking at the relationship between environmental factors and social mobility in the ten largest U.S. cities. We used CARBayes::S.CARmultilevel in R ...
1
vote
1answer
39 views

Overlaying elevation data and bathymetry data in R?

I have two layers that cover approximately, but not exactly, the same area. One is land elevation of some islands. The other is the depth of the water around the islands. I can resolve the vertical ...
1
vote
1answer
15 views

Transforming coordinates using R - SWEREF to WGS84

I have some coordinated in SWEREF 99 TM which I cannot convert into WGS84 using the proj4 package in R. temp <- data.frame (x = c(598223, 598812, 598824, 598232, 597614, 597629), y = c(...
2
votes
1answer
28 views

Split a polylines according to a specific point in R

I have 2 distinct spatial objects: on one hand I have a SpatialLinesDataFrame on the other hand I have a SpatialPointsDataFrame Considering one line and one point that intersects that line, I ...
1
vote
0answers
54 views

Why shapefiles created with sf package (in R) do not display same CRS in ArcMap?

I have created a polygon shapefile in ArcMap using 7 points(lat,lon) then read this shapefile into R to obtain the CRS. I then created a shape file in R using the sf package (and the 7 points) and ...
1
vote
1answer
22 views

Convert lists of coordinates to multiple lines based on ID at start of each block of coordinates

I have a list of XY coordinates along multiple lines. The lines are separated by a single identifier at the start of each block of coordinates. How do I convert this to multiple lines linking the ...
-4
votes
1answer
27 views

Performing geospatial analysis in R?

I obtained a rectangular sort of image when I subset shapefile on the raster image. I want to get exact irregular shaped image so that I can proceed my classification to that particular area (B is my ...
2
votes
1answer
31 views

How do I plot spatialpolygon dataframe layer on a leaflet map

I am not sure why this piece of code works library(leaflet) library(raster) adm <- getData('GADM', country='SGP', level=1) popup <- paste0("<strong>Name: </strong>", ...
-1
votes
1answer
30 views

The slot for “plotOrder” comes up as 1 instead of a vector with length specific to my data

My goal is to find neighbors from my SpatialPolygons object using the poly2nb() command from the sp package in R. This is my code thus far: p <- s_gis %>% select(long, lat) %>% ...
2
votes
1answer
38 views

Raster from point data in R different from point data in QGIS

I have some point data, with longitude, latitude and a value, in .csv file format. This is how the file looks in QGIS: I wanted to create a raster of this map, with each of the points ...
0
votes
0answers
30 views

Calculate shortest path distance on a network with R, sf and stplanr

I want to estimate a spatial logistic regression model for car crashes in Milan using R. I downloaded data from OSM for several highways segments in Milan using the R package osmdata. The response ...
0
votes
1answer
42 views

Opening Esri Geodatabase file with GDAL/QGIS/Grass?

EDIT: I have a 64-bit installation of QGIS but 32-bit Microsoft Office Access drivers. It has been suggested that this is the cause of the problem, which is also indicated in this post: https://www....