Questions tagged [rgdal]

R Bindings for the Geospatial Data Abstraction Library

Filter by
Sorted by
Tagged with
2 votes
1 answer
2k 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 ...
kim's user avatar
  • 133
0 votes
1 answer
433 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 ...
PythonStudent's user avatar
1 vote
0 answers
1k 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 = ...
Ewerton Silva's user avatar
0 votes
1 answer
2k 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 ...
user3386170's user avatar
  • 1,887
0 votes
0 answers
391 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")) ...
Dennis Guse's user avatar
1 vote
2 answers
3k 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 ...
Martin Schmelzer's user avatar
10 votes
2 answers
11k 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/...
MYaseen208's user avatar
4 votes
1 answer
5k 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:...
Neal Barsch's user avatar
2 votes
2 answers
3k 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} ...
Andrew's user avatar
  • 123
7 votes
1 answer
1k 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 ...
wadlooper's user avatar
  • 141
0 votes
1 answer
662 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 &...
Elio Diaz's user avatar
  • 3,404
0 votes
1 answer
514 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) ...
Thraupidae's user avatar
1 vote
1 answer
402 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 = "...
Stefano Potter's user avatar
3 votes
2 answers
9k 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 ----------------------- ...
dsbisht's user avatar
  • 705
1 vote
1 answer
987 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 <- ...
BayesIsBaye's user avatar
1 vote
2 answers
3k 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 ...
Claudio's user avatar
  • 103
1 vote
0 answers
971 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 ...
Rob Marty's user avatar
  • 369
1 vote
1 answer
630 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, ...
LAD's user avatar
  • 157
3 votes
0 answers
1k 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, ...
Diego-MX's user avatar
  • 151
3 votes
0 answers
136 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, ...
user2507608's user avatar
0 votes
1 answer
627 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"...
MaGregor's user avatar
1 vote
2 answers
1k 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 ...
setophaga's user avatar
  • 199
3 votes
1 answer
12k 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$", ...
Stefano Potter's user avatar
4 votes
1 answer
5k 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 ...
Vijay Ramesh's user avatar
  • 1,332
3 votes
1 answer
61 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 ...
Slav's user avatar
  • 141
2 votes
1 answer
915 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 ...
SinghD's user avatar
  • 127
1 vote
1 answer
795 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: ...
Konrad's user avatar
  • 331
2 votes
1 answer
1k 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 ...
h.l.m's user avatar
  • 121
1 vote
0 answers
39 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 ...
BulletTooth's user avatar
2 votes
1 answer
959 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 ...
Javier Fajardo's user avatar
2 votes
1 answer
423 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 ...
Javier Fajardo's user avatar
2 votes
1 answer
617 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: ...
Vijay Ramesh's user avatar
  • 1,332
2 votes
0 answers
166 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 ...
Migue Lo's user avatar
  • 141
1 vote
2 answers
6k 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 (...
Dex's user avatar
  • 11
2 votes
2 answers
3k views

Calculating Proportion of Land Cover Classes with moving window around 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 ...
Vijay Ramesh's user avatar
  • 1,332
1 vote
0 answers
344 views

Merging csvs to shapefiles and plotting county maps using time series loop in R [closed]

I have eleven county scale shapefiles named "df_1_imid_soy_2004.shp" for all years from 2004 to 2014 containing rows for every county in three states (Dakotas and Minnesota) I also have eleven csv ...
Stefano Potter's user avatar
2 votes
1 answer
2k views

Using the same mask on two rasters, but I get different extents in R

I loaded a shapefile in R, and cropped and masked it with the same mask, but I get different extents. Any suggestions? Code below: library(raster) library(rgdal) library(GISTools) library(sp) ...
Vijay Ramesh's user avatar
  • 1,332
2 votes
0 answers
798 views

Create a georeferenced PDF using a shapefile and add informations in R

I created a georeferenced PDF using a shapefile and OK no problem, but I'd like to know if is possible to insert a title inside a pdf (in top position "My geo PDF"), points of interest (pts.sampling) ...
Leprechault's user avatar
3 votes
1 answer
355 views

How many polygons does a single polygon intersect with?

I currently possess a shapefile that consists of >5000 polygons. I would like to know, for each polygon, how many other polygons it intersects with and the names of each polygon it intersects with? ...
Vijay Ramesh's user avatar
  • 1,332
1 vote
1 answer
121 views

Generate different number of points for multiple features in shapefile using R

I have a shapefile that contains roughly 200,000 features, each with a unique Zone Code. Within each of these features I would like to randomly place n points. A separate dataset contains a list of ...
Chris's user avatar
  • 254
2 votes
3 answers
1k views

How can I determine the area of each block of a SpatialGridDataFrame in R?

I'd like to be able to determine the area of each block inside a grid of (long, lat) coordinates. How can I do this? Alternatively, how can I determine the area of any Spatial Polygon with a long+...
Ben's user avatar
  • 123
1 vote
0 answers
2k views

Importing .shp Files Into R: readOGR error

I'm trying to import shapefiles into R but receiving errors. I'm using rgdal package and doing the following: x <- readOGR(".", "SNP Basefile") Error in ogrInfo(dsn = dsn, layer = layer, ...
Sam's user avatar
  • 21
1 vote
1 answer
41 views

Spatialdataframe from a multipoligon array column

i have a df with a character colum that contains an arrays of wgs84 coordinates. > head(df$Multipoint) [1] "[[11.038156,44.525654],[9.768989,45.620678],[7.923145,45.060564]]" ...
andriatz's user avatar
  • 419
2 votes
1 answer
537 views

Reproject global latlong into UTM slices

I'm working with a global shapefile in R that is latlong projected. I'd like to reproject it into the appropriate UTM projection for individual zones. But, I'd like to chop it up into those zones ...
jebyrnes's user avatar
  • 453
1 vote
1 answer
1k views

Rgdal add column to shapefile

I open a shapefile with the rgdal lib: foo <- readOGR(dsn="myfolder",layer="myshapefileWithoutEnding") foo.df <- as(foo, "data.frame") Then I add a column to the data frame with foo.df$...
JoergP's user avatar
  • 141
5 votes
2 answers
2k views

Parse .geojson file in R

I am new to R and geospatial data analysis. I would like to extract the coordinates from a .geojson file in R. For example, a line from the .geojson file is as follows: { "type": "Feature", "...
jeyaj's user avatar
  • 51
1 vote
0 answers
75 views

Import Sentinel2 (jpeg2000) in R [duplicate]

I'm trying to import a Sentienl 2 image into RStudio (Version 1.0.136) using rgdal (v. 1.2-5) package. However, it seems something is wrong. My OS is macOS Sierra v. 10.12.1 S2<- readGDAL("...
mcg's user avatar
  • 31
1 vote
0 answers
53 views

Finding repeating polygons in multiple geodatabases (.gdb)? [closed]

I'm working with a database of land parcels and their corresponding crops per year (source) My end goal is to create a predictive model for crop type, given land parcel. For example, if in the past 4 ...
Md Oliya's user avatar
  • 141
5 votes
1 answer
2k views

Raster - Error NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files

I am brand new to using geographic data in R and I keep running into an error: NOTE: rgdal::checkCRSArgs: no proj_defs.dat in PROJ.4 shared files I believe that this is due to an old version of ...
user65148's user avatar
  • 171
13 votes
1 answer
5k views

Writing multiple layers to GeoPackage using writeOGR() in R?

I'm trying to write multiple layers to the same GeoPackage in R, but I get an error, Creation of output file failed. I have tried to search for documentation of reading and writing to .gpkg files with ...
eivindhammers's user avatar