You are previewing The KML Handbook: Geographic Visualization for the Web.
O'Reilly logo
The KML Handbook: Geographic Visualization for the Web

Book Description

“The way the information is presented appeals to teachers, hobbyists, web designers—anyone looking for a way to enhance their content by using customized maps.”
—Warren Kelly, Pastor

“It could become the de-facto tutorial volume for the subject, as well as the classic reference guide.”
—Thomas Duff, Lead Developer

“This book is written so well and is so easy to follow it’s a joy to go through.”
— Daniel McKinnon, Software Engineer

KML began as the file format for Google Earth, but it has evolved into a full-fledged international standard for describing any geographic content—the “HTML of geography.” It’s already supported by applications ranging from Microsoft Virtual Earth and NASA WorldWind to Photoshop and AutoCAD. You can do amazing things with KML, and this book will show you how, using practical examples drawn from today’s best online mapping applications.

Drawing on her extensive experience with the creators of KML, Wernecke teaches techniques that can be used by everyone from programmers to real estate agents, scientists, students, architects, virtual explorers, and more.

Highlights include

  • Incorporating rich content in Placemark balloons

  • Creating overlays that superimpose your images on standard Earth browsers

  • Generating animations that move through Placemarks, Overlays, and Models

  • Controlling and updating map content across the Web

  • Managing large data sets using regions and custom data types

  • Complete KML language reference: elements, types, syntax, file structure, and conventions

  • Table of Contents

    1. Copyright
      1. Dedication
    2. Foreword
    3. Preface
      1. Audience
      2. What You Should Know Before Reading This Book
      3. What This Book Contains
      4. Trying the Examples
      5. Formatting Conventions
      6. Acknowledgments
    4. 1. A Quick Tour
      1. KML: An International Standard
      2. Is the KML Specification Complete?
      3. A Wealth of Resources
      4. Creating and Sharing KML
      5. Tell Your Story with KML
      6. Sky in KML
      7. “Hello, Earth”
        1. Viewing the Examples in This Book
        2. Experiment!
        3. Structure of a KML File
          1. Definition of Simple/Complex Elements
          2. General Rules in KML
      8. The Copy-and-Paste Trick
      9. What’s Next?
    5. 2. Placemarks and Balloons
      1. X Marks the Spot
      2. Customizing Your KML Presentation
      3. Placemarks with Points
      4. Default Balloon
      5. Modifying the Balloon
        1. Adding Text
          1. Adding Space Between Paragraphs
          2. Adding Italic Type
          3. Adding Boldface Type
        2. Adding Hyperlinks
        3. Adding Images
        4. Example
        5. Simple Balloon Template
        6. Changing the Background Color
          1. Specifying Color Values
          2. Using the Google Earth Color Selector
          3. Inline Styles
        7. Changing the Text Color
        8. Omitting Driving Directions
        9. Adding a Custom Icon
        10. Advanced Balloon Template
      6. Specifying a Viewpoint
        1. LookAt Element
        2. Troubleshooting
      7. Flying to a Placemark in Google Earth
        1. Flying to a New Placemark
        2. Feature Anchors
      8. Other Children of Placemark
      9. Syntax for <Placemark>
      10. Related Feature Elements
      11. Packaging Up KML Files into KMZ Archives
        1. Recommended File Structure
        2. Examples
      12. What’s Next?
    6. 3. Geometry
      1. Chapter Overview
      2. Coordinates: A Closer Look
        1. Longitude
        2. Latitude
        3. Altitude and Altitude Mode
      3. Line Strings
        1. Tessellating a Line String
        2. Extruding a Line String
        3. Experimenting with AltitudeMode
        4. Google Maps
        5. LineStyle
      4. Polygons
        1. Simple Polygon
        2. PolyStyle
        3. Polygons with Holes
          1. Example
      5. MultiGeometry
      6. Models
        1. Location
        2. Orientation
          1. Rotating in 3D
        3. Scale
        4. Resource Map
      7. Including Author and Source Information
      8. What’s Next?
    7. 4. Styles and Icons
      1. Chapter Overview
      2. Travels through Literature
      3. Building Blocks for Styles
        1. Element Tree for Styles
        2. LineStyle
          1. Random Color
          2. Example
        3. PolyStyle
          1. A Note about Boolean Values
          2. Default Values
          3. Example
        4. IconStyle
          1. Icon HotSpot
          2. Example
        5. LabelStyle
        6. BalloonStyle
        7. ListStyle
      4. Shared versus Inline Styles
        1. Documents
        2. How to Specify a Style URL
        3. Caveat
        4. Overriding Style Values
      5. Style Maps for Rollover Behavior
        1. Syntax for <StyleMap>
        2. The Power of the Point
        3. Simple Example
        4. Advanced Example: Additional Ways to Use a Style Map
        5. Using a Style Map to Simplify the Display
        6. Defining Styles Externally
      6. What’s Next?
    8. 5. Overlays
      1. Chapter Overview
      2. What Is an Overlay?
      3. Tools for Creating Overlays
      4. Basic Concepts
        1. Syntax for <Overlay>
        2. Color and Transparency for Overlays
        3. Draw Order
        4. Icons: Specifying and Refreshing the Overlay Image
      5. Another Way to Specify the Viewpoint: Camera
        1. Differences between <Camera> and <LookAt>
        2. Syntax for <Camera>
        3. Initial Position of the Camera
      6. Ground Overlay
        1. Syntax for <GroundOverlay>
        2. LatLonBox
        3. Altitude and Altitude Mode
        4. Example of a GroundOverlay
      7. Screen Overlay
        1. Syntax for <ScreenOverlay>
        2. Specifying X/Y Units for Image Overlays and Icons
        3. Child Elements for <ScreenOverlay>
        4. Example of a Simple Screen Overlay
        5. Example of a Screen Overlay with <ListStyle>
      8. PhotoOverlay
        1. Gigapixel Photos
        2. Syntax for <PhotoOverlay>
        3. Basics: Shape and Point
        4. Field of View
          1. Field of View for a Rectangle
          2. Field of View for a Cylinder
          3. Field of View for a Sphere
          4. Adjusting the View with the Rotation Element
        5. Advanced: Image Pyramids for Gigapixel Images
          1. How Image Pyramids Work
          2. Syntax for <ImagePyramid>
          3. Creating the Image Pyramid
          4. Adding Fill to the Image
          5. Example
          6. Numbering the Tiles
          7. Specifying the URL of a Gigapixel Image
          8. Transparency
        6. Example of a PhotoOverlay
      9. What’s Next?
    9. 6. Network Links
      1. Chapter Overview
      2. What Is a Network Link?
        1. The Network Link as a Grouping Mechanism
        2. Network Links: Local and Remote
      3. Why Use Network Links?
      4. Client/Server Basics
        1. Setting Up a Server
          1. Configuring the Server for the KML/KMZ MIME Type
          2. Install and Configure the Server for Desired Language and Database Support
          3. Strategies for Testing Network Links
        2. Absolute versus Relative File References
      5. Syntax for <NetworkLink>
      6. Simple Network Link Example
      7. Refreshing Network Links
        1. Refresh Based on Time or Change
        2. Refresh Based on the User’s View
      8. Advanced Example: Puff Volcanic Ash Tracking Model
      9. Sending Information from Client-Side to Server-Side
        1. Sending Information about the Current View
          1. Format of the Query String
          2. Bounding Box Information (and More)
          3. Additional Parameters for <ViewFormat>
        2. Sending Additional Data to the Server with <httpQuery>
        3. Example of View-Based Refresh
      10. Network Link Controls
        1. Syntax for <NetworkLinkControl>
        2. Example of Server Overrides
      11. What’s Next?
    10. 7. Dynamic KML
      1. Chapter Overview
      2. Key Concepts
        1. Identifiers
        2. Fragment URIs
      3. Updating KML
        1. General Outline of the Update Mechanism
        2. Syntax for <Update> Child of <NetworkLinkControl>
        3. Creating an Element Using <Update>
          1. Example of Update Create
        4. Changing an Element Using <Update>
          1. Example of Update Change
        5. Deleting an Element Using <Update>
          1. Example of Update Delete
        6. Advanced Update Example with Script
      4. Time and Animation in KML
        1. Specifying the Time
        2. UTC (Coordinated Universal Time)
        3. Examples of Specifying Time
        4. Syntax for <TimeStamp>
        5. Syntax for <TimeSpan>
        6. Time Stamps and GPS Data
        7. Example of Time Stamp with GPS Data
        8. Example of Time Stamp with Animated Placemark Data
        9. Time Spans and Ground Overlays
        10. Example of Time Span with Ground Overlay
      5. What’s Next?
    11. 8. Dealing with Large Data Sets
      1. Chapter Overview
      2. Key Concepts
        1. Bounding Box for Regions
        2. Level of Detail (LOD) Range
        3. Fade Range
        4. Detailed Description of the <Lod> Element
        5. How Regions Relate to View Refresh Mode
        6. Cascading Regions
        7. Super-Overlays
      3. Regions
        1. Syntax for <Region>
        2. Example of GroundOverlay with Region
        3. Region for a 3D Model
        4. Region for a 2D Overlay at Altitude
        5. Case Study: Simplifying a Data Set
          1. Step 1: Creating a Few Major Placemarks
          2. Step 2: Dividing Placemarks into a Set of Regions
          3. Step 3: Adding Another Layer: Labels for the Regions
          4. Step 4: Adding a Fade Effect to the Labels
      4. Super-Overlays
        1. Simple Example of a Region-Based NetworkLink
        2. Example of a Super-Overlay
        3. Preparing Your Data for a Super-Overlay
          1. Step 1: Prepare the Imagery
          2. Step 2: Prepare the KML Files
        4. Swiss Transit Example
      5. Extended Data
        1. Which Approach Should You Use?
        2. Adding Arbitrary XML Data to a Feature
        3. Adding Untyped Name/Value Pairs
          1. Syntax for <Data>
        4. Using the <BalloonStyle> Element as a Template
        5. Entity Replacement for Extended Data Elements
        6. Adding Typed Data to a Feature
          1. Syntax for <Schema>
          2. Syntax for <SchemaData>
          3. Example of Typed Custom Data
        7. Example Using Entity Replacement
      6. What’s Next?
    12. A. KML Reference
      1. Abstract Elements
      2. Complex Versus Simple Elements
      3. Basic Syntax Rules for KML
      4. Header
      5. Default Values
      6. How to Use This Reference
      7. KML Schema File
      8. Don’t Forget to Test Different Earth Browsers
      9. KML Types
      10. AbstractView Sec. 14.1 of OGC KML Specification 07-147
        1. Description
      11. <BalloonStyle>
        1. Description
        2. Elements Specific to BalloonStyle
        3. Contained By
      12. <Camera>
        1. Description
        2. Elements Specific to Camera
        3. Contained By
      13. ColorStyle
        1. Description
        2. Elements Specific to ColorStyle
      14. Container
        1. Description
      15. <Document>
        1. Description
        2. Contained By
        3. Contains
      16. <ExtendedData>
        1. Description
        2. Elements Specific to <ExtendedData>
        3. Contained By
        4. See Also
      17. Feature: Section 9.1 of OGC KML Specification 07-147
        1. Description
        2. Elements Specific to Feature
        3. Contained By
      18. <Folder>
        1. Description
        2. Contained By
        3. Contains
      19. Geometry: Section 10.1 of OGC KML Specification 07-147
        1. Description
      20. <GroundOverlay>
        1. Description
        2. Elements Specific to <GroundOverlay>
        3. Contained By
      21. <Icon>
        1. Description
        2. Elements Specific to <Icon>
        3. Contained By
      22. <IconStyle>
        1. Description
        2. Elements Specific to <IconStyle>
        3. Contained By
      23. <kml>: Section 7.1 of OGC KML Specification 07-147
        1. Description
        2. Contains
      24. <LabelStyle>
        1. Description
        2. Element Specific to <LabelStyle>
        3. Contained By
      25. <LinearRing>
        1. Description
        2. Elements Specific to <LinearRing>
        3. Contained By
      26. <LineString>
        1. Description
        2. Elements Specific to <LineString>
        3. Contained By
      27. <LineStyle>
        1. Description
        2. Element Specific to <LineStyle>
        3. Contained By
      28. <Link>: Section 13.1 of OGC KML Specification 07-147
        1. Description
        2. Elements Specific to <Link> (and also <Icon>)
        3. Contained By
        4. See Also
      29. <ListStyle>
        1. Description
        2. Elements Specific to <ListStyle>
        3. Contained By
      30. <LookAt>
        1. Description
        2. Elements Specific to <LookAt>
        3. Contained By
      31. <Model>
        1. Description
        2. Elements Specific to <Model>
        3. Contained By
      32. <MultiGeometry>
        1. Description
        2. Contained By
        3. Contains
      33. <NetworkLink>
        1. Description
        2. Elements Specific to <NetworkLink>
        3. Contained By
      34. <NetworkLinkControl>
        1. Description
        2. Elements Specific to <NetworkLinkControl>
        3. Contained By
        4. See Also
      35. Object: Section 8.1 of OGC KML Specification 07-147
        1. Description
      36. Overlay: Section 11.1 of OGC KML Specification 07-147
        1. Description
        2. Elements Specific to Overlay
      37. <PhotoOverlay>
        1. Description
        2. Elements Specific to <PhotoOverlay>
        3. Contained By
      38. <Placemark>
        1. Description
        2. Contained By
        3. Contains
      39. <Point>
        1. Description
        2. Elements Specific to <Point>
        3. Contained By
      40. <Polygon>
        1. Description
        2. Elements Specific to <Polygon>
        3. Contained By
      41. <PolyStyle>
        1. Description
        2. Elements Specific to <PolyStyle>
        3. Contained By
      42. <Region>
        1. Description
        2. Elements Specific to <Region>
        3. Contained By
      43. <Schema>
        1. Description
        2. Elements Specific to <Schema>
        3. Contained By
        4. See Also
      44. <ScreenOverlay>
        1. Description
        2. Elements Specific to <ScreenOverlay>
        3. Contained By
      45. <Style>
        1. Description
        2. Contained By
        3. Contains
      46. <StyleMap>
        1. Description
        2. Elements Specific to <StyleMap>
        3. Contained By
      47. StyleSelector: Section 12.1 of OGC KML Specification 07-147
        1. Description
        2. See Also
      48. TimePrimitive: Section 15.1 of OGC KML Specification 07-147
        1. Description
        2. See Also
      49. <TimeSpan>
        1. Description
        2. Elements Specific to <TimeSpan>
        3. Contained By
      50. <TimeStamp>
        1. Description
        2. Elements Specific to <TimeStamp>
        3. Contained By
    13. B. Sky Data in KML
      1. Sky Mode
        1. Coordinates
        2. Supported Elements
      2. The “hint” Attribute
      3. Converting Celestial Coordinates for Display in Google Earth
        1. Convert Right Ascension Coordinates
        2. Convert Declination Coordinates
      4. Calculating Range for the LookAt Element
      5. Placemark Example
      6. Adding an Overlay to Sky in KML