GE_SpatialGrid: Create SpatialGrid for PNG output to GE

Description

The function sets up metadata in the form of a SpatialGrid object for defining the size and placing of a PNG image overlay in Google Earth. The internal function Sobj\_SpatialGrid can also be called to build a grid for arbitrary Spatial* objects.

Usage

1
2

Arguments

obj

a Spatial* object

asp

if NA, will be set to the latitude corrected value

maxPixels

the maximum dimension of the output PNG

maxDim

the maximum dimension of the output grid; ignored if n not NULL

n

if not NULL, the minimum number of cells in the returned grid

Details

The function is used together with kmlOverlay to wrap around the opening of a PNG graphics device, plotting code, and the closing of the device. The computed values take account of the adjustment of the actual data bounding box to an integer number of rows and columns in the image file.

The approach may be used as an alternative to writing PNG files from SpatialGrid and SpatialPixel objects in rgdal using writeGDAL, and to writing KML files using writeOGR for vector data objects. The output PNG files are likely to be very much smaller than large vector data KML files, and hinder the retrieval of exact positional information.

Note that the geometries should be in geographical coordinates with datum WGS84 for export to KML.