FAQ Database Discussion Community


Writing compressed netCDF4 files with raster

r,raster,gdal,rgdal
I want to write compressed netCDF4 files using the raster package. ncdf4 and rgdal are installed correctly. The following, however, fails to return a netCDF4 compressed file: library(raster) r <- raster() <- runif(86400) r[] <- <- runif(86400) writeRaster(r, "test.nc", options=c("COMPRESS=DEFLATE", "FORMAT=NC4")) In fact it just returns a standard netCDF file:...

R: Crop GeoTiff Raster using packages “rgdal” and “raster”

r,crop,raster,rgdal,r-raster
I'd like to crop GeoTiff Raster Files using the two mentioned packages, "rgdal" and "raster". Everything works fine, except that the quality of the resulting output tif is very poor and in greyscale rather than colour. The original data are high quality raster maps from the swiss federal office of...

How to transform Longitude/Latitude degree to UTM? R. rgdal, sp

r,rgdal,sp
My data is in latitude and longitude projection in the form of degrees, minutes and seconds. This has been and stored in text form (character-class, Ignore the row.names). > pasaporte Latitud Longitud 4 13°50¨52" sur 73°45¨12" oeste 36 13°01¨ sur 75°05¨ oeste 46 13°09¨26" sur 74°13¨22" oeste By means of...

Missing projection file in R's rgdal package for geospatial analysis

r,rstudio,gdal,rgdal
I'm having a problem I can't solve with rgdal in which the projection file seems to be missing. This is the error I get: proj4string(d) <- CRS("+init=epsg:28992") Error in CRS("+init=epsg:28992") : no system list, errno: 2 It's confusing because when I load the package, it seems to successfully autodetect the...

Add lat/long or URM coordinates to shapefiles in R

r,gis,rgdal,maptools
I am new to GIS in R, and I'm attempting to add either lat/long or UTM coordinates to a shapefile. I downloaded the boundaries of the city of Chicago (City_Boundaries.shp)from here: http://www.cityofchicago.org/city/en/depts/doit/supp_info/gis_data.html I loaded the maptools and rgeos libraries: library(maptools) library(rgeos) library(rgdal) I brought the data into R & attempted...

Convert features of a 'multifeature' GeoJSON into R spatial objects

r,geojson,gdal,rgdal
Normally you can read geojson files into R with trusty readOGR, as illustrated here. However, this fails for multifeature geojsons. Reproducible example: downloader::download("https://github.com/Robinlovelace/Creating-maps-in-R/raw/master/data/test-multifeature.geojson", "test.geojson") test <- rgdal::readOGR("test.geojson", "OGRGeoJSON") # fails with: Error in ogrInfo(dsn = dsn, layer = layer, encoding = encoding, use_iconv = use_iconv, : Multiple incompatible geometries: wkbPoint:...

unable to install rgdal in ubuntu 14.04 (undefined to reference to 'pj_ctx_fclose')

r,gdal,rgdal,proj4
I tried to install rgdal with configure.args but no luck. Installed gdal version: gdal-config --version 1.11.2 ogrinfo --version GDAL 1.11.2, released 2015/02/10 found gdal binary tools: ls /usr/bin | grep gdal gdal2tiles.py gdal2xyz.py gdaladdo gdal_auth.py gdalbuildvrt gdal_calc.py gdalchksum.py gdalcompare.py gdal-config gdal_contour gdaldem gdal_edit.py gdalenhance gdal_fillnodata.py gdal_grid gdalident.py gdalimport.py gdalinfo gdallocationinfo...

R Converting contour lines to elevation plot

r,gis,rgdal,maptools,sp
I would like to be able to create an elevation plot from contour lines in R. I am very new to using shape files At the moment I have downloaded data from here which provides .shp files for all of the UK. It also provides the contour lines, summarising the...

How to transfer longlat format DEM data to utm

r,geospatial,rgdal
I downloaded a digital elevation data set. The file is '.tif' format. I have loaded in R. But when I try to transform the coordinate reference system from long/latitude to local UTM, problems occur. The code and errors are presented as below. dem=raster('srtm_58_04.tif') proj4string(dem)="+proj=longlat +ellps=GRS80 +no_defs" myproj="+proj=utm +zone=48 +north +datum=WGS84...