kml and its applications
DESCRIPTION
Keyhole Markup Language (KML) is an XML notation for expressing geographic annotation and visualization within Internet-based, two-dimensional maps and three-dimensional Earth browsers.TRANSCRIPT
![Page 1: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/1.jpg)
KMLASHOK BASNET (066BCT505)
BIKRAM THAPA (066BCT508)
SUPRITAM RAJ SHRESTHA (066BCT542)
![Page 2: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/2.jpg)
What is KML?
KML is type of markup language based off of XML.
Stands for Keyhole Markup Language
Developed by Keyhole Inc. Google
KML files are very often distributed in KMZ files, which are zipped KML files with a .kmz extension
![Page 3: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/3.jpg)
Origin of KML
KML was first known as Keyhole.
KML originally developed for use with Google Earth.
Its development was engineered by Keyhole, Inc which Google acquired in 2004.
![Page 4: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/4.jpg)
Definition
Keyhole Markup Language (KML) is an XML notation for expressing geographic annotation and visualization within Internet-based, two-dimensional maps and three-dimensional Earth browsers
![Page 5: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/5.jpg)
In Other Words
KML is a way of displaying geographical data in an Earth Browser such as,
![Page 6: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/6.jpg)
KML Functions
KML includes features that allow it to display:
place marks
Images
Polygons
3D models
Textual descriptions
![Page 7: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/7.jpg)
Example
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Placemark>
<description>New York City</description>
<name>New York City</name>
<Point>
<coordinates>-74.006393,40.714172,0</coordinates>
</Point>
</Placemark>
</kml>
![Page 8: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/8.jpg)
This is the previous script:
![Page 9: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/9.jpg)
KML Applications:
KML file types are used by programs such as: ArcGIS Explorer Flickr Google Earth Google Maps Google Mobile Live Search Maps Microsoft Virtual Earth Marble (KDE) World Wind Yahoo Pipes
![Page 10: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/10.jpg)
Google Maps and KML
![Page 11: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/11.jpg)
KML Elements
Everything is an “Object”. (Everything inherits from the abstract “Object” KML element).
There are abstract elements Everything is a tag:
<Point>…</Point> The more advanced tags are (usually) for
Google Earth.
![Page 12: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/12.jpg)
Google Maps supports a subset of KML…
Google Maps supports… Placemarks Icons Folders Descriptive HTML KMZ (compressed KML, including attached images) Polylines and polygons Styles for polylines and polygons, including color, fill, and opacity Network links to import data dynamically Ground overlays and screen overlays
![Page 13: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/13.jpg)
Structure
KML is in XML format Usually everything contained in
Document tag Can have multiple Folder tags to
separate different kinds of data. For example, one folder containing KML to show locations of pictures and another folder containing KML to show your path through the day.
![Page 14: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/14.jpg)
Placemarks/Points/Coordinates
The easiest element in KML. A simple point on the map. It only needs a name and a location. You can
give it a description too. Placemark tag defines the place mark A Point tag within it defines where the Placemark will be. A “type” called coordinate defines the Point. Coordinates in KML are given long,lat. When typing in coordinates
directly into Google Maps, they are given lat,long. Be careful!
![Page 16: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/16.jpg)
Descriptive HTML
You’ll probably want to do HTML within the description tag. You need to use the CDATA tag for this. If you don’t, your HTML’s tags
need to use entity references:
![Page 17: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/17.jpg)
Paths
Can define a path using the Placemark tag and the LineString tag instead of the Point tag.
Multiple coordinates. Again by long,lat,alt. “extrude” tag makes the line go down to the ground “tessellate” breaks each line into multiple pieces.
Good for long lines so they don’t end up underground.
0 = false, 1 = true
![Page 19: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/19.jpg)
Advanced KML
![Page 20: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/20.jpg)
Advanced KML
MIME Types
Styles
Screen Overlays
Network Links
![Page 21: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/21.jpg)
MIME Type
KML Servers must follow certain rules
Must return response code of HTTP 200
The type itself is:application/vnd.google-earth.kml+xml
Can set the type in PHP with: header('Content-type: application/vnd.google-earth.kml+xml');
Body must contain valid KML data and the XML declaration:<?xml version="1.0" encoding="UTF-8"?>
![Page 22: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/22.jpg)
Styles
Similar to CSS/HTML styles. In a Style tag. Each style tag can have multiple styles within it:
LineStyle, PolyStyle, ColorStyle, etc. The tag has an “id” so it can be referenced within a file or from another.
(A Global KML Style file perhaps?) Add a styleUrl element to use a style. HW2 could have different icons based on content? A site that grabs all
the Google Map icons:http://www.visual-case.it/cgi-bin/vc/GMapsIcons.pl
![Page 24: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/24.jpg)
Screen Overlays
Add an image to the Google Maps/Earth window. Could be used for whatever purpose you like. ScreenOverlay tag. overlayXY and screenXY line up the image to the actual map In this example, (0,1) (in fractions) means 0% of x (all the way to the
left) and 100% of y (all the way to the top). The upper-left of the image is lined up with the upper-left of the map. The unit can also be determined by pixels.
Size tag (obviously) controls size of the image. 0 means to maintain aspect ratio, -1 indicate to use native dimension. Using some other value makes the image that value. For example 0.2 with units on fraction makes the image take up 20% of that dimension.
![Page 25: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/25.jpg)
Contd.
![Page 26: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/26.jpg)
Network Links
Allows importing of KML, KMZ, and image files for ground/screen overlays.
Local or remote file Uses a Link tag Good way to split up large KML file into much smaller KML files. More
manageable. More interesting feature: can use scripts to generate KML data on the
fly. (PHP, Perl, etc.) Usually uni-direction data flow (server to map) but when using
“viewRefreshMode”, the map can pass the script information on what is being viewed (the LatLon box). Google Maps/Earth will call the script with a BBOX parameter. Look at the KML Tutorial for more information.
![Page 28: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/28.jpg)
Sources
http://en.wikipedia.org/wiki/Keyhole_Markup_Language
http://code.google.com/apis/kml/documentation/kml_tut.html#placemarks
![Page 29: Kml and Its Applications](https://reader034.vdocuments.mx/reader034/viewer/2022042518/5562d4d6d8b42a6c498b4e8f/html5/thumbnails/29.jpg)
THANK YOU