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.

4
votes
1answer
301 views

extract() in R raster package slow with non-native format

I've noticed that running extract takes very different amounts of time depending on whether or not the raster is in memory, on disk in the Native format (.grd), or on disk in another format (e.g., ...
0
votes
1answer
20 views

Network analysis with a selfmade shapefile in R

I have created two shapefiles in ArcGIS: A point shapefile containing segments of different shops (e.g. grocery, department stores) A selfmade polyline network (including distances) which connects ...
0
votes
1answer
12 views

Generating random points within series of polygons according to density using R

I have a city that is made up of a number of wards, each with an unequal population. I would like to generate a set of "random" points within the city, but the randomness is influenced by the ...
1
vote
1answer
40 views

Converting large raster to vector?

I have a shapefile which contains 10.000 polygons and I want to know how many of them falls on a specific land use. Unfortunately, the land use map that I have to use is a raster map and not a vector ...
0
votes
1answer
21 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
1answer
26 views

ArcGIS GeoPackage ArcMap Drawing Error [on hold]

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 ...
0
votes
1answer
49 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....
1
vote
0answers
16 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 ...
9
votes
1answer
2k views

Plotting bar charts on maps in R?

I'm using plotrix in R to plot a state level map of the US. It has an excellent function floating.pie to put pie charts on each state. I'm wondering if there are similar functions within the plotrix ...
11
votes
3answers
936 views

From polygon to continuous measure of diversity?

First of all; I have tried to find a similar question, without success. Maybe it's because I'm quite new to GIS and I don't really know what exactly I'm looking for. If someone points me to a similar ...
0
votes
1answer
15 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
1answer
14 views

Set same dimensions multipolygon and point data

I'm trying to plot point data (coördinates) on a multipolygoon map. But I can't get them on top of each other and in the right shape. Underlying projection data of the Netherlands multipolygon data: ...
0
votes
0answers
15 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
30 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 ...
2
votes
2answers
42 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 ...
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 ...
0
votes
0answers
33 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 ...
1
vote
0answers
23 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....
1
vote
1answer
201 views

Mann-Kendall test with R

I am trying to do Mann-Kendall test over a stack of 620 MODIS images. The code is as follows: library(sp) library(raster) library(Kendall) library(spatialEco) setwd("C:\\NDVI_prueba") rlist=list....
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 ...
3
votes
2answers
3k views

Rasterizing polygons with the function “gdal_rasterize” in R

I'm using the function gdal_rasterize in R (package gdalUtils) to convert a polygon shapefile into a raster. Here is my code: r.test <- gdal_rasterize(src_datasource="df.shp", dst_filename="test....
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 ...
0
votes
1answer
132 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, ...
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 ...
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 ...
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. ...
6
votes
0answers
197 views

Packing squares polygons in a raster grid

In the green area of the raster I have to fit as many square polygons as possible, of three different sizes: 3x3 cell size 2x2 cell size 1x1 cell size With the fact that the approach should be ...
2
votes
1answer
340 views

Matching two point clouds without loss (nearest neighbor, but more complicated) [closed]

I have two point clouds, one with demographic and one with electoral data. Points in both clouds represent the same empirical entity (say, a village, or an urban neighbourhood), but are not in the ...
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
1answer
99 views

Extracting GeoTIFF data with coordinates using R?

I have downloaded the following data as a GeoTIFF and I'm interested in determining the value from this raster at specific locations. raster = readGDAL("filename.TIFF") summary(raster) Object of ...
0
votes
1answer
5k views

Extracting value of raster with coordinates using R?

i'm currently working on the distribution of different species on an area, for 23 years. I'll show you a sample of my data, it will be easier to get. My dataframe, let's call it df. x y ...
0
votes
1answer
267 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/ ...
16
votes
1answer
424 views

rMaps choropleth with custom json

With R I want to make an animated choropleth map with the rMaps package and a custom map. I tried to follow the example of Diego Valle described here and to use the custom map info for Datamaps. ...
-1
votes
1answer
42 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
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<-...
0
votes
2answers
285 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
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; ...
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
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 ...
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 ...
1
vote
0answers
390 views

How to load big ASCII rasters in Revolution R? [closed]

Is there anyone in this site using Revolution R with big spatial data? I am trying to load raster files (ascii format) into revolution R using the xdf format, with no luck. Did anyone tried this ...
0
votes
1answer
154 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....
1
vote
2answers
67 views

R sf count number of Polygons in Multipolygon

How can I count the number of polygons that are present in a multipolygon with the R package sf? Example: In the following image that represents a multipolygon I count 3 polygons. I want to be able to ...
1
vote
0answers
55 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 ...
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 ...
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 ...