Keyhole Markup Language (KML) - PowerPoint PPT Presentation

About This Presentation
Title:

Keyhole Markup Language (KML)

Description:

Keyhole Markup Language (KML) Eric Bohn Keith Krupp * * * * * * * * * * * * * What is KML? How Is KML Used? Where Did KML Come From? Where Is It Heading? – PowerPoint PPT presentation

Number of Views:400
Avg rating:3.0/5.0
Slides: 22
Provided by: csWinona
Learn more at: https://cs.winona.edu
Category:
Tags: kml | keyhole | language | markup

less

Transcript and Presenter's Notes

Title: Keyhole Markup Language (KML)


1
Keyhole Markup Language(KML)
  • Eric Bohn
  • Keith Krupp

2
  • What is KML? How Is KML Used?
  • Where Did KML Come From? Where Is It Heading?
  • KML is a XML-based language schema describing a
    geographic vocabulary used by geobrowser
    applications on two or three dimensional Earth
    maps.
  • KML was developed by Keyhole, Inc. along with the
    Earth Viewer application in 2001. Keyhole, Inc.
    was acquired by Google in 2004 and KML was
    converted for use for the Google Earth, Google
    Maps and Google Mobile applications.
  • The word Keyhole comes from an American military
    reconnaissance satellite program developed in the
    1970's.
  • The Google Earth program both produces and
    consumes KML files.
  • KML uses the three-dimensional geographic
    reference system of longitude, latitude, and
    altitude to describe a basic point of view in
    space over or on the surface of the Earth then
    adds more specific control over that view with
    heading, tilt, and roll factors.
  • KML also offers the ability to add text
    information, graphic overlays, 3-D polygons,
    paths, icons and add embedded files (images or
    auditory) to enhance the experience of the
    geobrowser applications.
  • In April 2008 the 2.2 KML language specification
    was accepted by the Open Geospatial Consortium as
    the official standard for geobrowser
    applications.
  • KML shares same structural grammar as the
    Geography Mark Up Language (GML) but provides
    more 3-dimensional graphical functionality.
  • Like all XML, KML must begin with the XML header
    information followed by the KML root element
    tags. The kml 2.2 namepace specification must be
    present in all KML files, and the gx namespace
    for Touring elements.
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltkml xmlns"http//www.opengis.net/kml/2.2"
  • xmlnsgx"http//www.google.com/kml/ext/2.2"gt
  • .
  • .
  • .

3
Basic Placemark
  • ltlt?xml version"1.0" encoding"UTF-8"?gt
  • ltkml xmlns"http//www.opengis.net/kml/2.2"gt
  • ltPlacemarkgt
  • ltnamegtGonda Building Rochester MNlt/namegt
  • ltdescriptiongtAn example of a simple placemark
    on known terrain.lt/descriptiongt
  • ltPointgt
  • ltcoordinatesgt-92.46651823514594,44.023035213
    47328,0lt/coordinatesgt
  • lt/Pointgt
  • lt/Placemarkgt
  • lt/kmlgt

A Placemark object contains the following
elements Name - the label for the Placemark
Description - appears in the "balloon"
attached to the Placemark Point- the position
of the Placemark on the Earth's surface
(longitude, latitude, and optional altitude)
Auto-markup automatically converts text such as
www.test.com into active hyperlinks in the
description. A CDATA tag or and HTML characters
can be used to enhance the description (ltgt)
4
Import Features
  • A coordinate element consists of three floating
    point values (longitude, latitude, and altitude).
  • Latitude is degrees north or south of the Equator
    (0 degrees). Values range from -90 degrees to 90
    degrees.
  • Longitude is the angular distance in degrees,
    relative to the Prime Meridian. Values west range
    from -180 to 0 degrees and east o range from 0 to
    180 degrees.
  • Altitude is the distance of the camera from the
    earth's surface in meters interpreted according
    to the altitudeMode element.
  • altitudeMode values include
  • relativeToGround (default) meters above the
    ground or level of water body.
  • clampToGround - exactly terrain or sea level
    height.
  • absolute - meters above sea level
  • Heading is the direction (azimuth) in degrees
    from due North 0 to 360 degrees.
  • Tilt is the rotation in degrees around the X
    axis. A value of 0 indicates that the view is
    aimed straight down toward the earth (default), a
    value for 90 indicates that the view is aimed
    toward the horizon, values greater than 90
    indicate that the view is pointed up into the
    sky. Values for are clamped at 180 degrees.
  • Roll is the rotation, in degrees around the Z
    axis. Values range from -180 to 180 degrees

5
LookAt Element
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltkml xmlns"http//www.opengis.net/kml/2.2"
    xmlnsgx"http//www.google.com/kml/ext/2.2"gt
  • ltPlacemarkgt
  • ltnamegtMachu Picchu, Perult/namegt
  • ltLookAtgt
  • ltlongitudegt-72.503364lt/longitudegt
  • ltlatitudegt-13.209676lt/latitudegt
  • ltaltitudegt0lt/altitudegt
  • ltrangegt14794.882995lt/rangegt
  • lttiltgt66.768762lt/tiltgt
  • ltheadinggt71.131493lt/headinggt
  • lt/LookAtgt
  • ltstyleUrlgtmsn_icon12lt/styleUrlgt
  • ltPointgt
  • ltcoordinatesgt-72.516244,-13.162806,0lt/coordi
    natesgt
  • lt/Pointgt
  • lt/Placemarkgt
  • lt/kmlgt

LookAt specifies the view of a virtual camera in
terms of the point of interest that is being
viewed. Heading is the direction from due North
in degrees.
6
Camera Element
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltkml xmlns"http//www.opengis.net/kml/2.2"gt
  • ltDocumentgt
  • ltnamegtGolden Gate tourlt/namegt
  • ltopengt1lt/opengt
  • ltCameragt
  • ltlongitudegt-122.4790lt/longitudegt
  • ltlatitudegt37.8110lt/latitudegt
  • ltaltitudegt127lt/altitudegt
  • ltheadinggt18.0lt/headinggt
  • lttiltgt85lt/tiltgt
  • ltaltitudeModegtabsolutelt/altitudeModegt
  • lt/Cameragt
  • lt/Documentgt
  • lt/kmlgt

Camera specifies the view in terms of the
viewer's position and orientation.
7
Overlays
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltkml xmlns"http//www.opengis.net/kml/2.2"gt
  • ltFoldergt
  • ltnamegtGround Overlayslt/namegt
  • ltdescriptiongtExample of a ground
    overlaylt/descriptiongt
  • ltGroundOverlaygt
  • ltnamegtPicture over Previous Locationlt/namegt
  • ltdescriptiongtOverlay a picture of Rochester
    MN.lt/descriptiongt
  • ltIcongt
  • lthrefgthttp//www.soldiersfield.com/images/
    hotelmayo07website_001.jpglt/hrefgt
  • lt/Icongt
  • ltLatLonBoxgt
  • ltnorthgt44.02378751187333lt/northgt
  • ltsouthgt44.0222828739314lt/southgt
  • lteastgt-92.46506916608553lt/eastgt
  • ltwestgt-92.46796737309303lt/westgt
  • lt/LatLonBoxgt
  • lt/GroundOverlaygt
  • lt/Foldergt

The The ltIcongt element contains the link to the
.jpg file with the overlay image. The
positioning of a ground overlay is controlled by
the ltLatLonBoxgt tag. Bounding values are given
for the north and south latitudes, and east and
west longitudes. Image formats supported are
JPG, BMP, GIF, TIFF, TGA, and PNG.
8
Paths Styles
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltkml xmlns"http//www.opengis.net/kml/2.2"gt
  • ltDocumentgt
  • ltnamegtTest Pathlt/namegt
  • ltStyle id"yellowLineGreenPoly"gt
  • ltLineStylegt
  • ltcolorgt7f00fffflt/colorgt
  • ltwidthgt4lt/widthgt
  • lt/LineStylegt
  • ltPolyStylegt
  • ltcolorgt7f00ff00lt/colorgt
  • lt/PolyStylegt
  • lt/Stylegt
  • ltPlacemarkgt
  • ltnamegtTest Pathlt/namegt
  • ltstyleUrlgt"yellowLineGreenPoly"lt/styleUrlgt
  • ltLineStringgt
  • ltextrudegt1lt/extrudegt
  • lttessellategt1lt/tessellategt

A path is created by a ltLineStringgt element. The
lttessellategt tag breaks the line up into smaller
chunks, and the ltextrudegt tag extends the line
down to the ground. When a Style and an ID is
defined it can be used by Geometry, Placemarks,
and Overlays, referred to as shared styles. The
Style can be referenced multiple times, using the
ltstyleUrlgt element preceding the Style ID with a
sign. If the Style definition is in an external
file, include the complete URL in the ltstyleUrlgt
element. A Document is a container for features
and styles. This element is required if your KML
file uses shared styles.
9
Highlighted Icons
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltkml xmlns"http//www.opengis.net/kml/2.2"gt
  • ltDocumentgt
  • ltnamegtHighlighted Iconlt/namegt
  • ltdescriptiongtPlace your mouse over the icon
    to see it display the new iconlt/descriptiongt
  • ltStyle id"highlightPlacemark"gt
  • ltIconStylegt
  • ltIcongt
  • lthrefgthttp//maps.google.com/mapfiles/km
    l/paddle/red-stars.pnglt/hrefgt
  • lt/Icongt
  • lt/IconStylegt
  • lt/Stylegt
  • ltStyle id"normalPlacemark"gt
  • ltIconStylegt
  • ltIcongt
  • lthrefgthttp//maps.google.com/mapfiles/km
    l/paddle/wht-blank.pnglt/hrefgt
  • lt/Icongt
  • lt/IconStylegt
  • lt/Stylegt

Define a ltStylegt for the Placemark's normal icon
including an ltIcongt with an lthrefgt to the actual
image to use. Define a ltStylegt for the
Placemark's highlight icon and assign an ID to
it. Create the ltStyleMapgt element and assign an
ID to it. The Placemark will refer to this ID.
In the ltStyleMapgt element, specify "normalicon"
for the normal state. In the ltStyleMapgt element,
specify "highlightincon" for the highlight
state. In the Placemark, add a ltstyleUrlgt
element that refers to the stylmap.
10
Polygons
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltkml xmlns"http//www.opengis.net/kml/2.2"gt
  • ltPlacemarkgt
  • ltnamegtThe Pentagonlt/namegt
  • ltPolygongt
  • ltextrudegt1lt/extrudegt
  • ltaltitudeModegtrelativeToGroundlt/altitudeMode
    gt
  • ltouterBoundaryIsgt
  • ltLinearRinggt
  • ltcoordinatesgt
  • -77.05788457660967,38.87253259892824,1
    00
  • -77.05465973756702,38.87291016281703,1
    00
  • -77.05315536854791,38.87053267794386,1
    00
  • -77.05552622493516,38.868757801256,100
  • -77.05844056290393,38.86996206506943,1
    00
  • -77.05788457660967,38.87253259892824,1
    00
  • lt/coordinatesgt
  • lt/LinearRinggt
  • lt/outerBoundaryIsgt

The polygon is made of simple inner and outer
rings extruded down to the ground, then adding
fill.
11
Screen Overlays
  • lt?xml version"1.0" encoding"UTF-8"?gt
  • ltkml xmlns"http//www.opengis.net/kml/2.2"gt
  • ltScreenOverlaygt
  • ltnamegtAbsolute Positioning Top leftlt/namegt
  • ltIcongt
  • lthrefgthttp//code.google.com/apis/kml/docume
    ntation/top_left.jpglt/hrefgt
  • lt/Icongt
  • ltoverlayXY x"0" y"1" xunits"fraction"
    yunits"fraction"/gt
  • ltscreenXY x"0" y"1" xunits"fraction"
    yunits"fraction"/gt
  • ltrotationXY x"0" y"0" xunits"fraction"
    yunits"fraction"/gt
  • ltsize x"0" y"0" xunits"fraction"
    yunits"fraction"/gt
  • lt/ScreenOverlaygt
  • lt/kmlgt

Screen overlays cannot be authored directly
within Google Earth. Positioning is controlled by
mapping a point in the image specified by
ltoverlayXYgt to a point on the screen specified by
ltscreenXYgt. In this case, the top-left corner of
the image (0,1) has been made coincident with the
same point on the screen.
12
KMZ File
  • A KMZ file consists of a main KML file and zero
    or more supporting files that are compressed and
    packaged with a zip application into an archive
    file with a .kmz suffix. The KMZ file can be
    stored, emailed and loaded from a web server.
    When the KMZ file is unzipped, the main .kml file
    and its supporting files are separated into their
    original formats and directory structure, with
    their original filenames and extensions. The kml
    file can then be run with Google Earth.

13
XML Schema For KML
  • To validate a KML XML document download the KML
    XML Schema document at http//schemas.opengis.ne
    t/kml/2.2.0/ogckml22.xsd
  • Change the following code in the ogckml22.xsd
    from a hard coded file location to a web link
    URL
  • lt!-- import atomauthor and atomlink --gt
  • ltimport namespace"http//www.w3.org/2005/Atom"
  • schemaLocation"http//schemas.opengis.net/kml
    /2.2.0/atom-author-link.xsd"/gt
  • Add the xsi namespace and schemaLocation to the
    KML XML document you want to validate
  • ltkml xmlns"http//www.opengis.net/kml/2.2"
  • xmlnsxsi"http//www.w3.org/2001/XMLSchema-in
    stance"
  • xsischemaLocation"http//www.opengis.net/kml
    /2.2 ogckml22.xsd"gt

14
Google Earth
  • KML was originally developed for Google Earth
  • Originally called Keyhole Earth Viewer
  • Originally created by Keyhole, Inc
  • Acquired by Google in 2004
  • First program to view and graphically edit KML
    files.
  • Maps the Earth by superimposing images obtained
    from satellite imagery,
  • aerial photography, and GIS 3D globe.
  • Easy navigation using mouse and control button.
  • Most of Earth is available in 2D imagery only,
    but some places have 3D available.
  • 3D images of buildings and terrain are made
    available through digital elevation
  • model imagery collected by NASAs Shuttle
    Radar Topography Mission.
  • Able to overlay images for comparing different
    types of information
  • Scale must be accurate, but image conforms to
    topography.
  • Capability to build 3D models of cities
  • Irish town of Westport first to do so.
  • Helpful in promoting cities, and using for
    navigating city.

- Flight simulator (ctrl alt a)
15
Google Earth 5.0, Touring
  • Allows controlled flights through geospatial
    data
  • Specific flight druations between locations
  • Smooth flight past locations without stopping
  • Play sound files at predetermined times during
    the tour
  • KML elements that define tours are containted
    within a set of extensions, using the
  • gx prefix.
  • - ltkml xmlns"http//www.opengis.net/kml/2.2"
  • xmlnsgx"http//www.google.com/kml/ext/
    2.2"gt
  • Tours are constructed by placing specific
    elements, in order, into a KML file.
  • The KML file can contain any other legal KML
    elements together with the tour.
  • Tours are made up of a series of tour
    primitives 
  • FlyTos, Waits, TourControls, AnimatedUpdates, and
    SoundCues.
  • Tours move from location to location, each of
    which specified with a ltgxflyTogt
  • Updates to KML can take place during the tour

16
Google Earth 5.0, Touring
  • Some of these primitives are played one after the
    other, waiting for one primitive to
  • complete before beginning the next. Others
    run parallel to other primitives, so that
  • multiple actions can occur simultaneously.

17
Comparable Products
  • Marble
  • NASA World Wind
  • Xplanet
  • Earth 3D
  • ESRI ArcGIS Explorer

18
Marble
  • Virtual globe and world atlas you can use to
    learn more about Earth
  • Mouse click on a place will bring up a wikipedia
    article
  • Can measure distances between locations, and/or
    view weather
  • Different thematic maps
  • Topographic view
  • Satellite view
  • Night view
  • Street map
  • Free Open source software that promotes the use
    of free maps
  • Can be used in C/Qt 4.x applications
  • Compatible with KML

19
NASA World Wind
  • - Developed by NASA staff and open source
    community members
  • Uses satellite imagery and elevation data to
    create a 3D view of Earth
  • Can be used with other planets
  • Compatible with KML/KMZ with KML/KMZ plug in
  • Differences between Google Earth and NASA World
    Wind
  • Google Earth commercially produced, World Wind is
    not entirely.
  • Google Earth uses commercial satellite imagery
    which allows it to have more data than world
    wind.
  • Google Earth cant be extended with user with
    user-authored add-ins or plug-ins like world wind
    can
  • Add-ons and plug-ins for Google Earth created in
    KML can now be used in world wind
  • World Wind covers more planets
  • World wind comes with more views out of the box

20
Conclusion
  • With KML recognized as the standard for
    geographic visualization it will continue to
  • evolve and grow as more and more geographic
    browsers continue to be developed,
  • And as the current geographic browsers grow it
    will be used more.
  • - KML is the international standard.
  • The OGC and Google have agreed to harmonize KML
    and GML further
  • GML is Geography Markup Language
  •  an XML based encoding standard for geographic
    information. The language
  • allows Internet browsers the ability to view
    web-based mapping without
  • additional components or viewers
  • This will allow for smoother interoperability
    between geographic browsers.

21
References
http//code.google.com/apis/kml/documentation/kml_
tut.html http//code.google.com/apis/kml/documenta
tion/kmlreference.html http//code.google.com/apis
/kml/documentation/touring.html http//code.google
.com/apis/kml/documentation/whatiskml.html http//
en.wikipedia.org/wiki/Keyhole_Markup_Language http
//en.wikipedia.org/wiki/CityGML http//www.earth3
d.org/ http//create.landprint.com/index.html http
//worldwind.arc.nasa.gov/java/index.html http//e
du.kde.org/marble/ http//www.opengeospatial.org/s
tandards/kml
Write a Comment
User Comments (0)
About PowerShow.com