Questions tagged [rgeo-shapefile]

33 questions
0
votes
1 answer

Dissolving polygons by distance - R

I'm quite new to geospatial analysis in R and need help with dissolving polygons based on their location. I have a shapefile with about 1500 polygons. Each polygon has a property code. There are a total of 4 properties in the shape attribute table.…
0
votes
1 answer

r buffering line feature causes crash

I am try to select points in an area around the former Iron Curtain. So I got the shapefiles and intersected former Eastern and Western Europe to get a line feature library(raster) library(sp) library(rgeos) ### set project…
Gmichael
  • 526
  • 1
  • 5
  • 16
0
votes
1 answer

Can no longer install rgeos and rgdal in R

I cannot install rgeos or rgdal packages in R version 4.1.3. These packages worked fine a month ago before I reformatted my computer and reinstalled R. This is what I have tried: install.packages('rgeos', type="source") install.packages('rgdal',…
BHope
  • 135
  • 9
0
votes
1 answer

extend (buffer) boundary of shape file in R

I need to extend the boundary of a field (only boundary) by x meters. I tried using gBuffer from rgeos R package - output of the transformation gives me only boundary of the field and rest polygons inside the field are lost with data. How I can use…
string
  • 787
  • 10
  • 39
0
votes
1 answer

shapefiles: convert Point (MultiPoint) to Point (PointZ) geometry in R

I have a shapefile (mult_point_example.shp) in a multipoint geometry: # Packages require(sf) # get AOI download.file( "https://github.com/Leprechault/trash/raw/main/mult_point_example.zip", zip_path <- tempfile(fileext =…
Leprechault
  • 1,531
  • 12
  • 28
0
votes
1 answer

Spatial inverse subset using square brackets in R

I have a spatial point data frame -> spatial_points and a polygon -> spatial_poly I can subset all points within the polygon using subset_within <- spatial_points[spatial_poly,] which is nice and intuitive. But if I want to subset all points…
user2175481
  • 147
  • 1
  • 8
0
votes
0 answers

Unable to install any packages on R

I am trying to install packages for a spatial data course however each package I try install to R I get this same error message Warning in install.packages : 'lib = "C:/Users/chris/OneDrive/Documents/R/win-library/3.4"' is not writable I have…
chris1
  • 11
  • 3
0
votes
2 answers

Using gContains and checking if the points is inside the polygon/country. R

The following code checks if a coordinate pair belongs to a specific polygon or not. I need to check more coordinate data using loop or something. Now when it calls the code, it checks every value, but if there is only one coordinate outside the…
Coya
  • 13
  • 3
0
votes
1 answer

raster::erase function - Error in RGEOSBinTopoFunc : TopologyException

I am using raster package erase function as per my previous post solution for clipping and dissolving overlapping polygons - Dissolve Overlapping Polygons using difference and union in R For some of the polygons I am getting below error with erase…
string
  • 787
  • 10
  • 39
0
votes
1 answer

Shapefiles do not overlay raster layer in R

I have hundreds of shapefiles without a coordinate reference system. My goal is the overlay the spatial polygons over the WorldClim raster layer. I used this approach before without any problems. However, this time the coordinates from my shapefiles…
0
votes
1 answer

Receiving Error Message when using command over()

I have two shape files, shp1 and shp2. After calculating the centroid of the former, I'd like to see where the centroid lies in the latter. My setup does: shp1@data$centroid <- gCentroid(shp1, byid = TRUE) foo <- over(shp1$centroid, shp2) Upon…
JBDonges
  • 307
  • 1
  • 9
0
votes
2 answers

How to use function crop(x, y, ...) from raster package so that the output is information about y (raster) contained in x (shapefile, extent object)

I am kind of new to R and especially to working with GIS in R, so I hope I explain this right. I want to get the function crop (x,y...) from package raster to merge/overlay (not sure what's the correct expression to use) a raster file with a…
Nina
  • 1
0
votes
1 answer

How to union 2 intersecting polygons receiving 2 single polygons

How to union intersecting polygons (perfect circles) like in the following picture: So far, I used rgeos and sf, but couldn´t identiy a simple way yet. library(rgeos) library(sp) pts <- SpatialPoints(cbind(c(2,3), c(1,1))) plot(pts) pol <-…
N'ya
  • 347
  • 3
  • 13
0
votes
1 answer

R - Best Way to Perform Geospatial Calculations

I am working on a project where I pull crime data from an API, and essentially calculate the density of crime per predefined grid unit. I do this now by putting lat and lon into a data.frame and then calculating the count of points within a radius…
0
votes
0 answers

R and GIS: having trouble with a loop to save files

The relevant NCDF file is here: https://www.ncdc.noaa.gov/paleo-search/study/19419 I have a NCDF file, and am using the following loop to first save each file as a CSV file, and then as a shapefile: for (m in 1:500){ #First I want to save my CSV…
GIS_newb
  • 21
  • 1
  • 5