Questions tagged [rgdal]
R Bindings for the Geospatial Data Abstraction Library
36
questions with no upvoted or accepted answers
3
votes
0
answers
270
views
Installing rgdal - cannot solve dependencies
I am trying to build a docker image based on osgeo/gdal:ubuntu-XXXXX. However it keeps failing when trying to install rgdal. I've tried this on gdal-3.1.1/proj-7.1.0 and gdal-3.0.3/proj-6.3.0, as well ...
3
votes
0
answers
1k
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&...
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, ...
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$", ...
2
votes
0
answers
313
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 -...
2
votes
0
answers
148
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 ...
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 ...
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) ...
2
votes
0
answers
533
views
Filtering Small Areas of Shapefiles Using R
I'm trying to use the method proposed by the @ialm in the Question "How to speed up the plotting of polygons in R?"
There, he loads the maps using getData from the raster package, I tested and it ...
2
votes
0
answers
258
views
rgdal with multiple Feature Datasets in R
I am trying to read shapefiles contained within a geodatabase file (.gdb) into R. The .gdb contains two Feature Datasets with multiple Feature Classes within each.
The problem is only one of the two ...
1
vote
1
answer
33
views
Plotting CALIPSO data in R
I am trying to plot one subdataset of CALIPSO which is in hdf format using R. The data is totally new to me as it's LiDAR data. I am not able to understand how to plot a graph between backscatter ...
1
vote
0
answers
27
views
What (if any) coordinate systems can be used so that distances can be calculated from coordinates?
I am trying to do some work that involves spatiotemporal latent surface modeling, but an issue that I am worried about is that calculating distance between two coordinates is quite a bit more ...
1
vote
0
answers
220
views
Getting a rasterized object from irregular lat and long data
I have a dataframe (I've named it ozone2raster) with latitude and longitude points, and values for ozone concentration that I want to use for making a rasterized map. The dimensions of this dataframe ...
1
vote
0
answers
91
views
Is it better to calculate area of a global raster using long/lat or using an equal area projection (e.g. Galls-Peters)?
I am trying to calculate the area of values in a global spanning raster with values of NA, 1, 2 or 3. I would like to know the total area of each category, however, the map is currently in lat long (...
1
vote
0
answers
790
views
Using rdgal on R- error- No GDAL installation found
I trying to map burnt area using hdf data. For this i have all the neccessary packages, including the rdgal pacakge.
However when i type in my burnt area code, i get the response
I have downloaded ...
1
vote
0
answers
600
views
R can't work with ecw while gdal/qgis does. Ubuntu 20.04 config
I'm an Ubuntu 20.04 user with all configured to use .ecw raster format. I can read these files in QGIS (3.10) and work with them without a problem. This is what I get in console:
$ gdalinfo --...
1
vote
0
answers
584
views
Updating PROJ GEOS and GDAL in R
I have been having trouble linking to GEOS 3.8.1, GDAL 3.0.4, PROJ 6.3.0. I have tried reinstalling sf, rgdal, raster, and rgeos packages. I still couldn't link to GEOS 3.8.1, GDAL 3.0.4, PROJ 6.3.0. ...
1
vote
0
answers
329
views
Attributes encoding problem with rgdal::writeOGR
I performed an intersection of two SpatialPolygonsDataFrame on R (3.5.1) using raster::intersect.
Here's the structure of the resulting SPDF attributes table
> str(shp@data)
'data.frame': 944 ...
1
vote
0
answers
883
views
Convert DXF file to RasterLayer
I am an R user and have a .dwg file of city buildings that I wish to transform into a RasterLayer using the heights as elevation data.
The metadata for the DXF file states:
DXF File Metadata: ...
1
vote
0
answers
61
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 ...
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 ...
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 ...
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, ...
1
vote
0
answers
2k
views
Providing path to proj4 to rgdal in R
I have proj4 version 4.9.2 installed in a non-standard location within a Linux environment (/p/bin/proj4). I know that proj_def.dat did not go out with version 4.9.1, but was of the understanding that ...
1
vote
0
answers
211
views
Crop raster files when importing with readGDAL from DB
I have quite a lot of raster files stored in a PostgreSQL DB. Each of them has around 200MB and is representing EU-wide data. However I only need the the rasters to cover the area of Germany. I'm ...
0
votes
0
answers
51
views
How to intersect shapefile with polygons in R properly?
I have a WI shapefile (https://data-wi-dnr.opendata.arcgis.com/datasets/wi-dnr::wisconsin-state-boundary-24k/explore?location=44.747223%2C-89.836300%2C8.20) and a grid that I want to intersect so that ...
0
votes
0
answers
526
views
Cannot open TIFF due to missing codec in R w/ raster library
Title explains my predicament. I cannot open a tiff file using the raster package and receive an error that tells me it is due to a missing codec:
Code:
library(rgdal)
library(raster)
file_name &...
0
votes
0
answers
379
views
projectRaster() error messages
This code worked perfectly fine for me a few months ago, but now I am receiving error messages. I've tried it two different ways. Has the projectRaster() function been deprecated or syntax changed?
...
0
votes
0
answers
62
views
Gdalwarp for terrain correction in SAR image
I am new to the gdal utility. Using DEM data of the Moon, I am trying to perform terrain correction on SAR images.
Here is gdal commandline code ```
!gdalwarp -multi -wo NUM_THREADS=ALL_CPUS -co ...
0
votes
0
answers
166
views
Overlapping two maps and extracting the mean value from overlapped range in R
I want to overlap a species distribution range on the world map which has values, and extract the mean value within the species range.
I have 1500+ species distribution range in a gdb file so I try ...
0
votes
0
answers
76
views
Are these sp files equal in terms of proj4string? Can I do some transformation of the proj4string?
summary(SCat_sp_E6)
Object of class SpatialPolygonsDataFrame
Coordinates:
min max
x -74.095072 -74.018988
y 4.647323 4.832934
Is projected: FALSE
proj4string :
[+proj=longlat +...
0
votes
0
answers
4k
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 ...
0
votes
0
answers
1k
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
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"))
...
0
votes
0
answers
191
views
Why does R(gdal) mangle data when converting to geojson?
I've encountered issues with projections in .geojson files created by rgdal, but I never thought it would destroy my data, until I tried this (reproducible example):
downloader::download("http://...
-1
votes
1
answer
251
views
".shp" extension missing in R while other layers are present
I am trying to read a shapefile in R using the command:
rivnet <- readOGR(dsn = 'sa_riv_30s',layer = 'sa_riv_30s')
However, the '.shp' layer does not seem to be recognized by R. The layers present ...