Geoscience Reference
In-Depth Information
with 281 features and 17 fields
Feature type: wkbPolygon with 2 dimensions
> class(NY)
[1] "SpatialPolygonsDataFrame"
attr(,"package")
[1] "sp"
> proj4string(NY)
[1] " +proj = utm +zone = 18 +ellps = WGS84 +units = m +no_defs"
> NY_ll <- spTransform(NY, CRS("+init=epsg:4326"))
> proj4string(NY_ll)
[1] " +init = epsg:4326 +proj = longlat +datum = WGS84 +no_defs +ellps = WGS84
+towgs84 = 0,0,0"
> writeOGR(NY_ll, dsn = paste(td, "NY.kml", sep = "/"), layer = "NY",
+ driver = "KML")
To write the tract boundaries as a KML file, we need to transform it to geographical coordinates
using the appropriate s pTransform method for SpatialPolygons objects and employing
lookup in the EPSG table to define the target coordinate reference system. We use writeOGR
to write to file, specifying the required driver. Naturally, without the linked open-source GDAL,
PROJ.4 and Expat libraries, the programming involved would be much more demanding, prob-
ably prohibitively so, should one wish to access many different data formats. For example, GDAL
includes an OGR WFS driver:
> ogrInfo("WFS:http://www2.dmsolutions.ca/cgi-bin/mswfs_gmap",
"popplace")
Source: "WFS:http://www2.dmsolutions.ca/cgi-bin/mswfs_gmap", layer:
"popplace"
Driver: WFS number of rows 497
Feature type: wkbPoint with 2 dimensions
+proj = lcc +lat_1 = 49 +lat_2 = 77 +lat_0 = 49 +lon_0 = -95 +x_0 = 0 +y_0 = 0
+datum = NAD83 +units = m +no_defs
Number of fields: 1
name type length typeName
1 gml_id 4 0 String
The raster package (Hijmans and van Etten 2011) uses rgdal extensively to manage access to tiles of
raster data. It is also used by the new landsat package documented by Goslee (2011), which is intended
to support research into atmospheric and topographic correction methods for multispectral satellite
data. Another interesting package using rgdal is aqp , providing algorithms related to modelling of soil
resources, soil classification, soil profile aggregation and visualisation (Beaudette and Roudier 2011).
14.4.3 g eoMetry e ngine , o Pen S ource : rgeos
Development of the GEOS library interface to R began in late 2009 and made much progress in the
2010 Google Summer of Coding, with Colin Rundel making a large contribution. The rgeos pack-
age was released on CRAN in March 2011 (Bivand and Rundel 2011) and is beginning to be used
in other packages. Windows and OS X binary packages are available on CRAN, thanks to Brian
Ripley, Simon Urbanek and Uwe Ligges. The interface is programmed using the GEOS C API and
uses the thread-safe handle offered by GEOS. One issue uncovered by Colin Rundel in his work on
the interface was the importance of the coordinate precision model, which can now be manipulated
from R using setScale .
Search WWH ::




Custom Search