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

Questions tagged [rgdal]

R Bindings for the Geospatial Data Abstraction Library

0
votes
0answers
9 views

Overlaying points sampled from polylines with original polylines, null set returned, why?

I am using R to create sample points along a SpatialLines using spsample(), then I want to know which line feature each point lies on. When I use the over() to overlay the two layers, I get a null ...
0
votes
2answers
63 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
22 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
0answers
23 views

RGDAL: gdal_translate -tr parameter for projected output raster file

I use gdal_translate to extract data from a GeoServer ImageMosaic in WGS84. During the extraction, I would like to reproject the resulting raster into a Mollweide projection at 30m resolution. For ...
0
votes
0answers
26 views

Obtaining different linear entities?

I’m trying to get a shapefile with several feature lines, after export I have the shapefile with its attribute table, it seems to be 56 features. But actually, there is just one, I cannot do selection ...
0
votes
1answer
31 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 ...
0
votes
0answers
57 views

Extracting WMS raster values into R

I'm trying to use R to extract values from an ImageMosaic I created in a local GeoServer instance and published as a WMS. The ImageMosaic is made from many GeoTIFF raster files initially in WGS84. ...
2
votes
0answers
20 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
37 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
60 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
129 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
35 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
62 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
50 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
167 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
59 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
30 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
151 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
440 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
231 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
48 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
283 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
84 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
111 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
487 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 ...
0
votes
0answers
487 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 ...
3
votes
1answer
1k 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
296 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
386 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
349 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
347 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
152 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
62 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
269 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
315 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
737 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
516 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
175 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
424 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
123 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
332 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
206 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
2k 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
262 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
92 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
443 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 ...