Stack Exchange Network

Stack Exchange network consists of 174 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

R Bindings for the Geospatial Data Abstraction Library

0
votes
1answer
32 views

Pattern matching with grepl on SpatialPolygonsDataFrame object in R

I am trying to use grepl as part of an if control statement in R. I want to subset a SpatialPolygonsDataFrame object in my list (i.e. googleProjectedGroundTruth or googleProjectedFallow) only if its ...
0
votes
2answers
43 views

Convert shapefile into lat long points and export it as CSV in R?

I have a shapefile that I extracted form a compilation of species distributions taken from IUCN. > foo Simple feature collection with 1 feature and 27 fields geometry type: MULTIPOLYGON dimension:...
0
votes
1answer
47 views

ReadOGR/read_sf: Can't open shapefile

I am trying to open a shapefile (or the directory of the shapefile) in the same directory as my R file. I open it the following way: x<-c(farm,field,"ec",2017) #farm and field are variables that ...
-1
votes
0answers
29 views

Reproject file geodatabase feature classes in for loop using piping in R

I am trying to automate reproject a file Geodatabase feature classes in R. The problem is that I find is referring to variables created within the for the loop. I've tried piping using %>% and ...
0
votes
1answer
28 views

writeOGR KML attributes blank [closed]

Using the below I output a KML file from a Large SpatialPolygonsDataFrame polygonWGS <- spTransform(Polygon, CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")) writeOGR(polygonWGS, dsn="...
0
votes
1answer
38 views

geom_line() does not plot points from a shapefile in its correct order

I have been trying to load and plot a few shapefile in R using ggplot() and am facing an issue with a line vector shapefile. It seems that the readOGR() command is importing the line vectors ordering ...
0
votes
1answer
36 views

Conditional plotting a geopackage

I have a geopackage for India taken from GADM. I can plot all the districts of India by using layer 1, all states using layer 3, and the whole country using layer 4. Here is the code: > library(...
2
votes
1answer
87 views

Accessing certain column of attribute table of shapefile and renaming it using GeoPandas?

Currently, I am working on converting some R code into python for someone. This person is taking the shapefile and removing all columns except for a select few and renaming them: ec <- readOGR(".",...
0
votes
2answers
43 views

Error with Intersecting Rasters and Lines in R

I'm trying to ''cut'' a spatial lines data frame object by a raster grid using R, raster::intersect(SLDF, grid) However, when I run this code I get, Error in as.vector(x) : no method for coercing ...
0
votes
1answer
25 views

spTransform produces unexpected results

I am struggling to plot points using WGS84 co-ordinates on a map of the UK using the OSGB 1936 / British National Grid CRS. I'm using the rgdal package in R. Here is my reproducible example, using ...
0
votes
1answer
82 views

Use lapply and writeOGR to write multiple shapefiles within a list

I have a nested list with multiple shapefiles and I want to use lapply with writeOGR ('rgdal') in order to export all the shapefiles. Sorry for not giving a reproducible example. # My list shp....
0
votes
1answer
241 views

R cannot read *.shp shapefile with rgdal

I'm trying to open ne_10m_urban_areas.shp with rgdal::readOGR, but it gives me the bellow error library(rgdal) a <- readOGR(dsn = path.expand("C:/.../Desktop/"), layer = "ne_10m_urban_areas.shp") ...
2
votes
1answer
154 views

Any way to extract NUTS-3 shapefile of Germany from Eurostat' shapefile in R (updated)?

I have downloaded shapefile from Eurostat website (download site for downloading Eurostat shapefile and direct download link of Eurostat shapefile that I am interested in). To be short, I need ...
0
votes
1answer
39 views

R does not load coordinate reference when importing a multiband tif raster from Triplesat satellite

I'm trying to read Triplesat imagery into R. However there seems to be a problem with the coordinate reference in the .tif file as the crs, extent and resolution are not loaded. I tried two ways of ...
1
vote
0answers
195 views

rgdal::readOGR - no features found [closed]

Working in R Studio I'm executing the lines: setwd("D:/Perfil_IBGE/4. IBGE") pasta = "1. Shapefiles Brasil" shapefile_brasil = "BRUFE250GC_SIR" shp <- rgdal::readOGR(dsn = pasta, layer = ...
0
votes
1answer
66 views

Fix export to include character strings with accents (French text) in shapefile when using writeOGR in R

I have a SpatialPolygonsDataFrame in R that I want to export to shapefile. I used writeOGR to export but the cells with that contain text values with accents (é, è, à, ê, etc) are blank. When I ...
0
votes
0answers
88 views

Rgdal: writeOGR to SQLServer

I am trying to write geodata to a Microsoft SQLServer 2017 using rgdal. dsn = 'MSSQL:server=XXX;database=XXX;trusted_connection=yes' data=data.frame(lat=c(52.52437), lon=c(13.41053), value=c("v")) ...
2
votes
2answers
332 views

Create a polygon grid from SpatialPoints in R

I read several similar question but I yet have open questions. I am farely new to GIS and I think that another question on this topic will help others as well. I hope we can find a nice answer, that ...
0
votes
0answers
199 views

Adding more columns to the attributes inside SpatialPolygonsDataFrame objects

I want to assign a value from a variable VARNAME_3, contained in another dataset that also contains the variable ID_3, to each value of the variable ID_3 inside a SpatialPolygonsDataFrame object. To ...
0
votes
0answers
394 views

Configure: Error in rgdal

I am currently running some species distribution modelling and richness mapping in R on a linux cluster. In order to run my analyses I need to install rgdal so that the raster function in my modelling ...
1
vote
1answer
849 views

Unable to install ‘sf’ R package on Ubuntu 16.04 LTS

I'm not able to install sf R package on Ubuntu 16.04 LTS. I tried install.packages("sf") as well as devtools::install_github("r-spatial/sf") after running sudo add-apt-repository ppa:ubuntugis/...
2
votes
1answer
213 views

Raster IO error (R)

I have a raster I'm trying to extract, the projections of my shapefile and raster are the same: ext <- raster::extract(ras.tiftest2, single, na.rm=TRUE, fun=sum) I get this error: Error in rgdal:...
1
vote
2answers
310 views

Converting a shapefile from easting/northing to lat/long

I am working with an open data shapefile that uses easting/northing coordinates. My geocoded data set uses lat/long, so I am trying to reproject/transform the shapefile to use lat/long. ```{r} ...
5
votes
1answer
325 views

How to read a feature class in an Esri Personal GeoDatabase using R?

I have feature classes in a personal geodatabase on a Win 8.1 machine (r 3.4.2, rgdal 1.2-15) and, as mentioned here, there is a requirement for Access users to also interact with them. I have ...
0
votes
1answer
280 views

readOGR feature mismatch with KML

I'm trying to read a kml from this kmz I unzipped however, when I try to read a layer from it (as I've done it with previous kmzs) it says: library(rgdal) unzip("EstacionesClimatologicas.kmz") ogr &...
0
votes
1answer
122 views

Identify countries within a bounding box using R

Using R and relevant GIS packages, I would like to determine which countries are within an arbitrary bounding box and extract the corresponding ISO codes. For example... require(maps) require(rgdal) ...
1
vote
1answer
59 views

Kernel Density Map points rejected as outside window

I am trying to make a kernel density plot of a points shapefile like so: library(rgdal) library(spatstat) library(maptools) points <- readOGR(dsn = "C:\\Documents", layer = "...
0
votes
0answers
243 views

readOGR cannot read a GML file

I want to use a function mapunit_geom_by_ll_bbox from soilDB package in R which is supposed to download a GML file containing from the web, and read the GML using readOGR to return me an ...
1
vote
2answers
2k views

How to plot gridded map from lat-lon and fill values in R?

I want to plot a spatial map in which each pixel is of 0.25 degree spatial resolution in R. For this I have fill values at 0.25 degree grid spacing. Below is the data ----------------------- ...
1
vote
1answer
288 views

Using R, why am I unable to select a column from an sp Spatial Lines Dataframe?

With utm_RDS being the spatial lines in question, derived from the following shapefile: library(rgdal) library(sp) RDSYS <- readOGR(dsn = "C:/************") utm_RDS <- ...
1
vote
2answers
617 views

Extract mean for values in a raster above certain threshold in R

How to extract mean from a raster using extract function in R while considering raster cell values above 0? I have multiple rasters with some negative cell values and no-data. I am able to ignore no ...
1
vote
0answers
479 views

readOGR: all features NULL

Getting an error when trying to load a shapefile via readOGR. readOGR works fine on my personal computer (mac) but I am running into issues on my work computer (windows). When loading a shapefile ...
1
vote
1answer
151 views

Write time stamp for .gpx in R

I am in the process of editing gpx files and need to write the files back to .gpx in order to put them in a GPS unit. Basically, I am cleaning up some data and removing some track points. However, ...
2
votes
0answers
369 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
122 views

Assigning a new coordinate system and projection to a shapefile in R [duplicate]

I have a shapefile with no spatial reference nor projection, and a GEOTIFF that has the spatial reference and projection data. The shapefile was created from a segmentation analysis of the GEOTIFF, ...
0
votes
1answer
292 views

Loading library (rgdal) on windows? [closed]

I just started in the R field. I installed R project and then R studio. I want to execute a process with library (water) and I need before calling RGDAL and I get the following error: library("rgdal"...
0
votes
2answers
184 views

projectRaster() brick from NetCDF changes all values to NA

I have loaded a NetCDF brick like so... library(raster) library(rgdal) library(ncdf4) nctemp <- brick("C:/nco/out.nc") Which has the following dimensions... class : RasterBrick dimensions ...
3
votes
0answers
1k views

Error in compareRaster(c(x, rasters)) : different extent

I have a RasterStack that I want to add two rasters to. I am using this code library(rgdal) library(raster) #original rasterstack rasterfiles <- list.files("C:\\path_to_rasters", "*.tif$", ...
4
votes
1answer
1k views

Set the minimum and maximum values for an elevation raster in R

I have a raster that displays elevational values at a global scale. I would like to set the minimum and maximum values based on the values I would like to choose. > elev class : RasterLayer ...
3
votes
1answer
40 views

issues with projection Rgdal versus Manifold [closed]

I am pretty new to the topic and OK with R, but spatial data is still terra incognita I got a Mapinfo file and i had to convert it to ESRI shp and then within r into spatial lines data frame and use ...
1
vote
1answer
241 views

What is the most efficient way to do a spatial join of all raster points within a polygon layer area?

I have a raster GeoTIFF of a digital elevation model and a polygon shapefile with spatial boundaries of the raster. Here is a snapshot of raster and polygon layer: The shapefile has one attribute ...
1
vote
1answer
79 views

Understanding unit of area sizes calculated via rgeos::gArea?

I'm interested in finding the unit for the obtained area size of the polygons without refererring to the externally available documentation. Example A suite of shapefiles is imported as follows: ...
1
vote
1answer
417 views

Reading in a single polygon from a shapefile

I have a shapefile/GML file with many thousands of polygons insides a specific layer. I know the set of IDs that reference the set of polygons that I want to get the coordinates data from. Is there a ...
1
vote
0answers
31 views

How to add habitat information from shapefile to an existing DF dependant upon grid reference?

I'm currently building a dataframe (DF) using R and I'm wanting to add habitat type as a variable. Within DF I have grid reference points as variables. I've imported a shapefile containing habitat ...
2
votes
1answer
238 views

rgdal loads PROJ.4 version 4.9.1 when the updated 4.9.2 is installed

I have been having problems with vectorial spatial data for some time, mostly important to plot SpatialPolygonDataFrames (I asked here: Slow plotting SpatialPolygonDataFrames on some systems). This ...
1
vote
1answer
113 views

Slow plotting SpatialPolygonDataFrames on some systems

I have noticed that my personal computer is very very slow plotting SpatialPolygonDataFrames. I made a question about this issue on the general Stack Overflow, and with the answer I got I ended up ...
2
votes
1answer
344 views

Error in GDAL for MODIS library in R

An answer was provided to this question previously, however it did not solve the question. I am analyzing MODIS data, and would like to download and process the data. Here's what I have done so far: ...
1
vote
0answers
110 views

Missing PostgreSQL driver in rgdal: a long and sad story

This issue has been discussed few times and any of the read posts have not been the ultimate answer for my case: I'm trying to load data from a PostGIS database into the R Console. While many ...
1
vote
2answers
2k views

Simplifying and plotting polygons in Leaflet package in R?

I was finding the plotting of shapefiles very slow in R. After reading this (How to speed up the plotting of polygons in R?) I found all the tips were helpful for plotting in base R. The second one (...
1
vote
2answers
690 views

Calculate Proportion of Land Cover Classes with a moving window around a point in R

I am currently using a raster that is a land cover class raster (with 50 different land cover classes at a resolution of 30m). I would like to obtain 50 different rasters (essentially predictors for a ...