Stack Exchange Network

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

Questions tagged [rgdal]

R Bindings for the Geospatial Data Abstraction Library

0
votes
1answer
21 views

Unable to plot in R some locations over a shapefile

I have a shapefile of polygons that I got from here, and a CSV file with longitude, latitude data (i.e. lon= -71.4; lat=42.5). The shapefile has the following CRS information: "+proj=lcc +lat_1=41....
1
vote
0answers
20 views

Split raster to many irregular polygons [closed]

I'm splitting a national soils raster file into regional (county) rasters, and organizing the soils classifications into a database keyed by region, eventually plot- or farm-level detail. At the ...
1
vote
1answer
21 views

How to access GDAL utilities from command line using Rgdal installation? [closed]

I have just installed rgdal from within R install.packages("rgdal"). I can now successfully do library(rgdal) with the following message: Loading required package: sp rgdal: version: 1.3-9, (SVN ...
3
votes
1answer
39 views

Reading shapefile in R with shapefile function?

I want to read a shapefile(polyline) into R, using rgdal and raster packages. The code looks like: d<-file("/Volumes/Environment_layers/original/WaterRoad/Road.shp") o<-shapefile(d) but I got ...
1
vote
0answers
30 views

Warning message in raster::rotate(): “this does not look like an appropriate object for this function”

I'm attempting to rotate a stacked raster using the raster package in R. The raw stacked raster looks like this: When I attempt to rotate the raster to change the longitudinal scale from 0-360 to -...
0
votes
0answers
77 views

Get Google Maps driving directions between points in a KML file?

I'm trying to improve a workflow that currently involves manually composing a multi-destination driving route in Google Maps. I have the ability to export a KML file containing the points we want via ...
1
vote
0answers
18 views

Resolving topology errors after merging polygons

I have two SpatialPolygonDataFrames, and I have two merge them. SPDF1 contains watershed are falling within the country, SPDF2 has watershed are falling outside the country, so the both should match ...
0
votes
0answers
69 views

Extract raster cell values by polygon field

I have a raster as a RasterLayer (raster) and a polygon layer (bound) with 38 individual polygons as a SpatialPolygonsDataFrame. I used the polygon to mask from a larger raster. Each polygon contains ...
0
votes
0answers
55 views

Possible to drop NA geomType in readOGR?

I have a gdb file which is giving me trouble. f = '/path/to/folder.gdb' layers = ogrListLayers(f) geom_list = lapply(layers, readOGR, dsn = f) Gives an error on one of the layers: Source: "f", ...
0
votes
1answer
48 views

batch merge error: Error in match.arg(method) : 'arg' must be of length 1

I am attempting to read in a series of polygon shapefiles from a directory and batch merge them into a single shapefile. They all have the exact same field names. I am using this code: all_data <-...
2
votes
1answer
48 views

Binding multiple polygons in R

I have a directory that contains around 700 .shp files. I want to create a map in R that displays all of them. The easiest way i could think to do this was to bind them all together and then use ...
0
votes
2answers
112 views

Extracting non-spatial data from imported KML file using R?

I have a KML file which was created using Google's My Maps. The original file can be downloaded here: Google My Maps Using R, I can import this using the "readOGR" function of the rgdal library ...
1
vote
1answer
61 views

Parallel rasterizing with GetCover option? [closed]

I'm trying to rasterize a shapefile in parallel using the solution from this post: Processing vector to raster faster with R However, this fails to give the correct answer when the GetCover = T in ...
0
votes
1answer
37 views

manipulate ASCII grid

I have an ASCII grid (Data information in this box link https://app.box.com/s/jpdalfjnyfhqbvrghd8csu3pz5b2fl2j) with the following projection information Projection POLAR Units METERS ...
2
votes
0answers
40 views

Points and bioclim layers plot correctly in R, but not in Maxent.jar

I am trying to use Maxent.jar. This program uses a CSV file of points and ascii bioclim layers (basically, a map of the Americas with climate data) and overlays them on top of one another. I find ...
0
votes
1answer
64 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
218 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
269 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 ...
0
votes
1answer
56 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
160 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
112 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
377 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
109 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
44 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
334 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
895 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
417 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
62 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
458 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
161 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
156 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")) ...
1
vote
2answers
671 views

Creating polygon grid from SpatialPoints in R?

I read several similar question but I yet have open questions. I am fairly 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 ...
-1
votes
0answers
643 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 ...
5
votes
1answer
2k 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
467 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
523 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
418 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
432 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
193 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
79 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
351 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 ...
2
votes
2answers
3k 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
364 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
925 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
584 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
225 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
542 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
124 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
369 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"...
1
vote
2answers
307 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 ...