Questions tagged [r]

Statistical computing language and software environment.

Filter by
Sorted by
Tagged with
1
vote
0answers
22 views

Getting an error when generating an SDM with the R SDM package's ensemble function

I'm attempting to build a climatic species distirbution model using 3 separate techniques: glm, maxlike, and gam. I'm using the sdm package in R. After generating the model, I'm trying to use the ...
0
votes
1answer
54 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 ...
0
votes
2answers
64 views

Converting list of raster to a data frame using R? [closed]

I could read many rasters as one list of ratsers but when I want to convert them to data frames I get an error. Is there any way to convert them? library(raster) Pro <- function(s) { df <- ...
1
vote
0answers
23 views

Error in sampleStratified() r

I am trying to randomly distribute points in a raster (that has 11 unique values). I followed this posting and was able to recreate it, being partially successful. As mentioned about, my raster has ...
0
votes
1answer
34 views

Identify polygon grid in which the point belongs to?

I have a dataframe with 3 columns , which has my custom lat / long with a failure rate associated with each Lat / long head(df) Latitude Longitude Failure.rate 51.3 ...
0
votes
0answers
37 views

Generating Pseudo-Absences in spatialEco?

I want to generate pseudo absences based on kernel density estimate from a linear feature spatial line layer, where pseudo absences have a higher probability of being sampled near a line. I have ...
1
vote
1answer
25 views

Constructing spatial weight matrix from triangulation of point coordinates in R?

I want to know how to construct spatial weight matrix from point coordinates in R,such as using the Lucas County, OH, housing point data set in spdep package. I read here,it says'the list of ...
1
vote
0answers
13 views

Fail to conduct resistanceGA with run_gdistance

I am using a landscape surface resistance distance counting R packages called resistanceGA It can count commuteDistance with the assistance of another package gdistance It uses the following code to ...
0
votes
1answer
21 views

How to convert coordinates to shapefile with R package's dataset?

I need construct spatial weight matrix for data which syear=1995 (house$s1995==1)in housedataset in spdeppackage,So I tried writeOGR function as the link suggeust to get shapefile enter link ...
1
vote
0answers
35 views

Performing Spatial join with polygons using st_join in R?

I want to join 2 partly overlapping polygons in R the same way I'm doing it in ArcGIS Desktop . In ArcGIS Desktop I am doing it like this: Analysis toolbox - Overlay toolset - Spatial Join. The rows ...
2
votes
1answer
39 views

Calculating polygon around point and extract gridded data

I'm trying to calculate 50km circles around lat-long points and then extract gridded rain data (1km x 1km). However, for some reason my long-lat points are shown in the center of the U.S (picture ...
3
votes
2answers
88 views

Filtering above ground LiDAR points using a catalog in lidR?

I am analyzing LiDAR data collected two separate years- 2007 and 2015. My analysis is centered around changes in vegetation during this time period. The ultimate goal is to thin the data from the 2015 ...
0
votes
1answer
21 views

Merging two spatial objects in R: spCbind gives error “row names not identical” [closed]

## Importing map of Brazil map <- readOGR ("UFEBRASIL.shp") class (map) plot (map, axes = F) title ("") ## importing file with case data data <- read.csv2 ("cases.csv") # Recognizing the names ...
0
votes
0answers
24 views

Joining CSV and shapefile by two fields?

I have CSV (mydata) and shapefile (nc). I want make such as merged = left_join(nc, mydata, by= nc."NAME", by mydata."Country") How make it?
0
votes
1answer
55 views

Joining CSV and shapefile to map using R?

I have one CSV file and one shapefile mydata <-readr::read_csv("~/map/done.csv") mymap <- shapefile("~/map/tyumen.shp") How merge it to one table and draw plot? map_and_data <- merge(...
0
votes
1answer
38 views

Use sf (R) to return the overlapping area between two polygons by rows?

I have two sfc data frames with the same number of rows (individual IDs), but each data frame contains a polygon assigned to the individual. For example, dataframe1 may have a circle assigned neared ...
1
vote
0answers
51 views

st_buffer() not preserving the shape of the original polygons [closed]

I am currently trying to create buffers of 5km around polygons of the region of interest. However, every time I increase the radius from 500 metres to 5000 metres, the shape of the buffer is not ...
1
vote
1answer
32 views

R or Python geometry checker that outputs results as table

Is there a R or Python solution that 1) checks the geometry validity of vectors and 2) outputs the results in form of a table (see table below). QGIS for example has a nice plugin that carries out ...
1
vote
0answers
70 views

After installation of gdal (to enable PostGIS tools) on Windows, sf gives warnings about dependencies?

To get a PostgreSQL/PostGIS setup working on my Windows 10 machine I had to manually install GDAL using these instructions: https://sandbox.idre.ucla.edu/sandbox/tutorials/installing-gdal-for-windows ...
3
votes
1answer
67 views

Counting points in polygons with sf package of R? [closed]

I'm quite new to R and especially GIS with R. So recently I had to proceed to a quite simple analysis: counting health centers (points) per administrative unit (polygons). Quite common process in ...
1
vote
1answer
47 views

Combine bands with shapefile [duplicate]

I want to create a data frame in R combining the bands wth the shapefile. The final file will have the pixels as rows, the bands as well as the other columns from the attribute table from the ...
0
votes
1answer
56 views

Input points shapefile in shiny app

The application I created allows me to import a polygon shapefile into my Leaflet map. However, I would like to set up a point shapefile import on the same button. I tried several attempts, especially ...
0
votes
0answers
16 views

Day of the year values of pixels

I am trying to implement TWDTW model in R with dtwSat package. (You can find all the data here: https://www.jstatsoft.org/article/view/v088i05) In page 12, the paper gives a method to produce a land ...
0
votes
2answers
45 views

Reading shapefiles using for loop: Error in readOGR() : length(dsn) == 1L is not TRUE

I'm using a for loop to read in multiple shapefiles within a directory and manipulate them individually. Presently I cannot do this because the for loop results in the error: "Error in readOGR(...
0
votes
1answer
39 views

Mask with ring polygon in R?

I'm trying to mask a raster with a ring polygon using the function raster::mask, but only recognizes the outer edges of the polygon, can anyone help me with this? I only need the pixels within the ...
3
votes
0answers
27 views

Split a tmap legend and display in two locations

I would like to split the legend of a tmap object, so that one of the two elements is in the top left, and one in the top right. I have been through the documentation of tm_legend, but could not find ...
4
votes
1answer
97 views

How to use lastrees on a catalog with a function requiring a CHM raster?

I'm still fairly new to using LiDAR data and R, so please let me know if this isn't clear. I am using the lidR package to segment individual trees over a large landscape. I have been using the ...
1
vote
1answer
42 views

Splitting an administrative region into given number of parts

I have the following plot. I want to divide the administrative region into given number (say 20) equal parts. library(maps) data(world.cities) Pakistan <- data.frame(map("world", "Pakistan", ...
2
votes
0answers
32 views

Smoothing MODIS LAI? [closed]

I am trying to smooth 8 days LAI data from MODIS and managed to work around it with several algorithms such as loess, Savitzky–Golay, smooth.spline etc. This is pretty much going well if the level of ...
0
votes
1answer
26 views

Order features in a spatialpolygonsdataframe in ggplot2

I have a spatialpolygonsdataframe with many overlapping features. I want to create a map in which the smaller features are displayed on top of the larger ones so that the small ones aren't fully ...
0
votes
0answers
10 views

VCT Algorithm Using Landsat time series

I want to apply the Vegetation Change Tracker (vct) algorithm using Landsat time series. I have removed the water bodies out of the images, I have computed the FZ and IFZ values so that every image ...
0
votes
1answer
54 views

Using BFAST Spatial algorithm in R?

I have 65 monthly MOD11A2 (LST) images. The images came from the average of the original 8 day products. I have made them a time series stack using the timeStackMODIS function of the bfastSpatial ...
0
votes
0answers
17 views

How long should a spatial mixed model with spaMM take?

I have a dataset that's about 5k lines long, with a binomial response variable, five continuous fixed effects, and one random effect with seven levels. I initially ran a model with glmer{lme4}: glmer....
1
vote
1answer
28 views

What unit is returned by the ncf::correlog function?

I'm using the correlog function from the ncf package to figure out the distance between points at which spatial autocorrelation isn't detected. I was wondering what unit was being returned in the ...
0
votes
2answers
101 views

Dissolve only overlapping polygons in R using sf

I extracted information from open street map that contains many polygons, some of them overlapping. I want to union all polygons that overlap with other polygons. This question has been asked before ...
0
votes
0answers
45 views

Multiple break levels in color legend

Please look at the color legend of the image: This image was plotted in ferret program, which has different breaks, like 0-3 with 0.5 interval, 3-9 with 3 interval, 9-10 with 1 interval, 10-20 with ...
0
votes
0answers
22 views

Is there a way to get coordinates from a map using Leaflet on a Shiny app in R by clicking, but without a marker?

In this example I have some polygons and I click on the centroids (variable centroides) to get values from a raster (variable s). server <- function(input, output, session) { points <- ...
1
vote
1answer
97 views

What causes Error in ogrInfo when using readOGR to open a layer in a shapefile? [closed]

When I use readOGR to read a shapefile from thematicmapping.org, the shapefile is successfully displayed by leaflet in a shinyapp. However, when I use readOGR to read a shapefile from mt.gov, the ...
0
votes
1answer
21 views

Write a text file per image with same name in R

In R I would like to create a text file for each picture I have in a folder and with the same name. By example: Picture 1.png - Picture 1.txt Picture 2.png - Picture 2.txt But the text file name I ...
1
vote
0answers
41 views

Extract Raster Values with points in R

I have a raster file with gridded population raster26 class : RasterLayer dimensions : 132, 140, 18480 (nrow, ncol, ncell) resolution : 699, 931 (x, y) extent : 2248290, 2346150, ...
2
votes
2answers
35 views

st_transform producing spurious ribbons across region

I am trying to use st_transform on PERZONES shapefile available here . In its native projection, it looks like this: However, when I run the command: tansformedPF<-st_transform(PF,"+proj=sinu +...
0
votes
1answer
34 views

Correcting scale of heatmap data when plotting GeoTIFF file as map in R?

I'm trying to use R (and R studio) to examine a GeoTIFF file that I've gotten from NASA's Socioeconomic Data and Applications Center (SEDAC). I'm a complete beginner in GIS, so as a first step, I was ...
0
votes
1answer
54 views

Subdivide raster file by polygon in R

I am trying to get a raster file of nightlights data for Brazil and subdivide/regroup it into several rasters for each state, in a list or data.frame in R I managed to download the nightlights file, ...
1
vote
2answers
48 views

Create a circle in R, and plot it in a shapefile

I want to plot a circle with a radius of 5 miles around a hospital in Massachusetts. I was using some previous answers found here, but it is not working. st_buffer shows an error. library(sp) ...
0
votes
0answers
7 views

Is it possible to assign values from polygons to a new layer in an existing raster in R?

I'm a bit of an R novice and looking to see if there is any way to assign values to a raster layer based upon polygons. Some background - I am working on a mining project and have a regular grid of ...
1
vote
1answer
29 views

How to reproject a raster based on another raster when the datum is not said and get the same extent?

I am working with two rasters. I am trying to reproject r1 the same way as the raster r2. Rasters are available here r1 class : RasterLayer dimensions : 30286, 58025, 1757345150 (nrow, ncol,...
1
vote
1answer
43 views

Filling NA values of raster stack using R?

I am trying to fill NA values of a raster stack with interpNA but the first raster stays empty. I wish to obtain similar results as in substituteNA in a sense that all rasters of the stack are filled. ...
3
votes
1answer
58 views

Same equal area projection results in different areas when shifting the center of projection

I found that using an equal area projection results in different areas for the same polygons if you shift the center of projection (ie to minimize the distortion of your area of interest when you ...
1
vote
1answer
27 views

Raster calculation over multiple layers using a function or do-loop

I have a bunch of raster calculations that are working, but there must be a more efficient way to do this with a do-loop or function. Essentially I have a bunch of combinations of: rates (county ...
3
votes
0answers
56 views

Create foldable section in QGIS tool using R script

I am developping a GUI tool in QGIS using an R script and I am wondering how to add this kind of foldable section in the graphical interface.