User`s guide

R2007b
16-2
Exporting Vector Geodata to Earth Browsers
kmlwrite is a new function for exporting vector point data to a file in KML format. KML
stands for Keyhole Markup Language; it is an XML dialect used to structure geographic
data for display in an Earth browser, such as Google Earth™, Google Maps™, and Maps
for Google Mobile™. KML has a hierarchical structure of nested elements and attributes.
kmlwrite has a simple API that lets Mapping Toolbox users write vector data to a KML
file in order to subsequently display the data onto an Earth browser.
When used with Google Earth, files output from kmlwrite can be seen immediately
in Google Earth, if that application is available to the user. If the files are uploaded
to a publicly accessible Web server, they can be viewed by anyone on the Internet via
Google Maps or other Web sites and browser utilities that can read and display KML
files. Google Maps and Google Maps for mobile do not support the range of KML markup
that Google Earth supports (for example, placemark locations must be specified to
them as coordinates, not as addresses). See the Google KML documentation at http://
code.google.com/apis/kml/documentation/mapsSupport.html for more information.
kmlwrite accepts latitude and longitude point vectors, passed either in geostructs or as
column arrays. It also accepts addresses, which can be as general as a country's name
or as specific as a street address. When geostructs are the input, the attribute data in
the geostruct can be formatted as HTML tables and included in the KML output. When
latitude-longitude arrays are input, you can pass attributes to kmlwrite with strings.
When addresses are the input, geostructs are not used.
To customize placemarks, you can control formatting of geostruct attributes in the KML
file with an attribute specification, a struct used to format them (for example, to add
units to length attributes or to control the number of decimal places for numeric values).
A new support function, makeattribspec lets you change the names used as labels in
placemarks (geostruct field names are used by default), omit fields from placemarks, and
add HTML markup to the attributes displayed in placemark tables.
See Exporting Vector Geodata in the Mapping Toolbox User's Guide and the
mapexkmlexport demo, “Exporting Vector Point Data to KML” for more information.
Improved Conversion Between Angle Units
The angledim function has been replaced by four, more specific, functions:
fromRadians, fromDegrees, toRadians, and toDegrees (described below in “Four
New Angle-Unit Conversion Functions” on page 16-4). However, angledim has been