Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.

Questions tagged [sp]

R package with classes and methods to create and manipulate spatial data

29 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3
votes
1answer
104 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 ...
3
votes
0answers
735 views

Group and aggregate SpatialPolygonsDataFrame by column in R

I'm working with rgdal, sp, maptools, etc. I have a SpatialPolygonsDataFrame that has each row/Polygons list with only one Polygon. It also has an identifier column which I want to use to group by, ...
3
votes
0answers
307 views

How to apply a rectangular buffer on spatial polygons in R/qGIS

I am trying to find a way to apply a rectangular buffer on my spatial polygon dataframe in R. At the end, I would like to be able to shrink my polygons by specified units on both sides. So far, I have ...
2
votes
0answers
42 views

Union anti-meridian “multipolygons” after re-centering world map

My goal is to create a world map (using ggplot2) with a Pacific perspective. I have managed to re-center the map, by following this solution. Code below: # world country layer sppolys <-...
2
votes
0answers
270 views

Length of the boundary intersection between two polygons in R

I am trying to find the length of the border shared by two polygons. I have run cleangeo on these shapefiles. There were no flags that came up. I have looked through several other posts on the topic ...
2
votes
0answers
186 views

Maintaining same extents in R?

How can I maintain perfectly equivalent raster and SpatialPointsDataFrame extents when in R? Each time I combine rasters, or raster and point data, the extents are very slightly different (like ...
2
votes
0answers
641 views

Adding a custom color scale for a sp.points layer to levelplot() legend

I'm wondering how I can add a customized color palette that I used to display a sp.points layer in a call to levelplot (lattice plotting) in the rasterVis package in R. I used a function that Dave X ...
2
votes
0answers
392 views

spatialpolygons heatmap in R - NAs in grey?

I have a spatial polygon data-frame and I am trying to plot a heatmap via spplot. It's a map of Europe and the values for the heatmap are in a column of the data-frame. Plotting it works fine but I ...
2
votes
1answer
111 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 ...
1
vote
0answers
69 views

Unknown proj4: how to create custom proj4 from wkt?

I have a shapefile with a .prj file I've never seen before. In fact, it seems that GDAL doesn't even know what it is (see below). Therefore, when I read it into R with raster::shapefile() the CRS isn'...
1
vote
0answers
9 views

DSpat::create.lines and spatstat::rlinegrid: Adding too many lines?

Does anybody know of an issue with either DSpat's create.lines or spatstat's rlinegrid? Whenever I use these functions on my Windows (owins), the output has far too many lines. For example, if I run ...
1
vote
0answers
29 views

Speeding up spatial subsetting in R?

I need to subset a global fishing dataset to just have the fishing in the Pacific. Right now I have a shapefile of the Pacific and I am using the sp method of subsetting (see below) oceans <- ...
1
vote
0answers
63 views

ggplot with island (“Alaska problem”)

The data for this example can be found here: https://github.com/davidbaniadam/maps The problem is essentially the same with Alaska and mainland USA, i.e. I want the size of Alaska to be correct in ...
1
vote
1answer
29 views

Get shortest/fastest path between two points from SpatialLines(DataFrame)

I have a large rivernetwork as a SpatialLines(DataFrame) and want to subset it so I get a SpatialLine with only the shortest/fastest path between two SpatialPoints(DataFrame) which propably need to be ...
1
vote
0answers
55 views

Areas of imported features in Google Earth Engine

I originally wanted to ask the following question: "In the FeaturesCollection r_features, why do the two features have such different areas? They should have the same areas because they are both ...
1
vote
0answers
59 views

Easy way to plot separate groups of SpatialPolygons in R

I have SpatialPolygons grouped by 81 polygons and in each there are some other Polygons I'd like to plot them group by group but have little trouble with it. > rtu_spl class : ...
1
vote
0answers
38 views

Divide irregularly shaped polygon into 3 equal parts

I have a polygon object of a transect line that I would like to divide into 3 equal parts that are one-after-the-other along the transect line. So far I have only been able to slice the polygon ...
1
vote
0answers
36 views

Clipping polygons to existing plotting area

I have an existing plotting area onto which I want to add some polygons. In order to be sure the polygons' labels are displayed within the plotting area, I'd like to clip the polygons to this area so ...
1
vote
0answers
37 views

Swapping raster bands on disk efficiently using R

I have two raster files, each with RGB bands and an alpha layer. I would simply like to swap one of the raster's alpha bands for another, but to do so as efficiently as possible (these are very big ...
1
vote
0answers
858 views

points2grid error: (points,tolerance,round) - grid has empty columns/rows in dimension

I have seen answers to this on R-sig-geo, but I am still unclear on the solutions provided in different forums. Below, I am trying to convert a dataframe to a raster that can later be used in ArcMap (...
1
vote
0answers
42 views

Confirming accuracy of spatial match?

As a follow up to Correctly setting up CRS systems for the NUTS (Eurostat) geographies and Doogal's data? I have spatially matched a set of files, one with lat/long coordinates for postcodes ...
1
vote
0answers
280 views

Spplot SpatialPolygonDataFrame and SpatialGridDataFrame

I have to plot in the same graph something like this: Then, I have elements from SpatialPolygonDataFrame class and others elements from SpatialGridDataFrame class. When I try to plot them in the same ...
0
votes
0answers
14 views

Creating a pattern with certain parameters [R, spatstat, spatial, sf]

Let's say I want to create a pattern, that is based on numerous other patterns with similar shaped areas. Other than an average of the point densities in the rectangles, is there other patterning ...
0
votes
0answers
74 views

Error: trying to get slot “polygons” from an object (class “data.frame”) that is not an S4 object

I am trying to join .csv file data to shape file data using @data slot. I am getting error "trying to get slot "polygons" from an object (class "data.frame") that is not an S4 object " Here is my ...
0
votes
0answers
15 views

Copying polygons from lists of polygons to one SpatialPolygon list in R?

I do not know how to regroup polygons from SpatialPolygons list in the following manner: I have object rtu: > rtu class : SpatialPolygons features : 81 extent : 450685, 458760, ...
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 ...
0
votes
0answers
22 views

Error with over() ´sp ´ package in R

I have a df with spatial points that I've converted into a spatial object (dai18) and I want to select only the points that are inside a polygon (peri_A). I think my coordinate system is incorrect, ...
0
votes
0answers
352 views

plot coordinates as points with spplot in R

I want to do something that I thought should be relatively simple, but it doesn't seem to work... I have a SpatialPointsDataframe and a SpatialPolygonsDataframe. I want to plot all the points I have ...
0
votes
0answers
356 views

spTransform doesn't seem to actually reproject my data

I'm trying to create spatial point data and lay it over a shapefile. I'm starting out with simple LatLons, converting to sp using Coordinates(), changing the CRS to the same as the shapefile, and then ...