Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
R package with classes and methods to create and manipulate spatial data
4
votes
Counting number of points in polygon using R?
You can achieve the same using the sf package. Check the reproducible and commented code below. The package sf is used to handle spatial objects as simple features objects. In this answer the package …
1
vote
Counting how many times a point is inside a set of intersecting polygons in R
You can count the times one point is in a polygon or in different polygons with simple R functions using base and sp packages. … example below you can:
Identify and count the times one point is inside a set of polygons
Identify which point/polygon intersects
Load libraries and make some example data:
# Load libraries
library("sp …
3
votes
Slow plotting of spatial data in macOS RStudio's plotting device
Also, I had a better impression for performance when plotting than sp. And sf will replace sp.
I tried download your shapefile and plot in RStudio using sf. …
4
votes
3
answers
2k
views
How to sort points from a SpatialPoints object over a SpatialLines object according to line ...
An example using a small dataset sample:
# Load packages
library('sp')
# Define projection
epsg.32721 <- "+proj=utm +zone=21 +south +datum=WGS84 +units=m +no_defs"
# Load data points
x <- c(794801.3 …
3
votes
Accepted
How to sort points from a SpatialPoints object over a SpatialLines object according to line ...
I could answer my question traveling through every line segment in the SpatialLines object and finding the intersected points from the SpatialPoints object. I made a function that is all explained by …
1
vote
1
answer
637
views
Find closed lines inside SpatialLines objects in R
# Libraries
library("sp")
# Points
points.x1 <- c(-54.00000, -54.43489, -54.78560, -54.00000, -53.57810, -53.22097, -54.00000)
points.y1 <- c(-40.74859, -40.00000, -38.00000, -37.49485, -38.00000, -40.00000 …
4
votes
2
answers
3k
views
Calculate distance of points - SpatialPoints object - along a path - SpatialLines object - u...
Here is a code example:
# Load packages
library('sp')
# Define projection
epsg.32721 <- "+proj=utm +zone=21 +south +datum=WGS84 +units=m +no_defs"
# Load data points
x <- c(788690, 788722, 788824, …
2
votes
1
answer
2k
views
How to subset a SpatialPoints object to get the points located on each side of a SpatialLine...
This is the code example in R:
# Load packages
library('sp')
# Load projection
epsg.32721 <- CRS("+proj=utm +zone=21 +south +datum=WGS84 +units=m +no_defs")
# Load data and create Spatial objects
# …
2
votes
Accepted
How to subset a SpatialPoints object to get the points located on each side of a SpatialLine...
I answer my own question defining two SpatialPolygons objects from the SpatialLines object coordinates and the SpatialLines object bounding box bbox(). After that, I made an intersect between the Spat …
1
vote
Accepted
What are the coordinates on my rectangle of the closest point to a polygon in R?
When the vertices from a polygon are the closest points from another polygon you can use the Answer 1 example. However, sometimes may occur that a line segment from one polygon is the closest part of …
6
votes
Accepted
Lapply function on raster iterating through SPDF polygons in R
You can try crop and mask instead of only masking over the Raster Layers. Try the reproducible and commented code below. In this example, using crop reduced ~ 92% the size of the objects in the R envi …
5
votes
Accepted
Set the minimum and maximum values for an elevation raster in R
Try the commented and reproducible example below. You can assign NA values to your elevation RasterLayer as elev[elev < 0] <- NA and elev[elev > 1200] <- NA.
# Load libraries
library('raster')
libra …