Kml Basics Chpt 4 Styles & Icons

7,151 views

Published on

Published in: Education, Technology, Spiritual
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
7,151
On SlideShare
0
From Embeds
0
Number of Embeds
389
Actions
Shares
0
Downloads
64
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Kml Basics Chpt 4 Styles & Icons

  1. 1. Keyhole Modeling Language – Chpt. 4 – Styles & Icons Mr. Thomas Cooper Outdoor Technology The Walker School
  2. 2. Styles and Substyles <ul><li><Style id=“ID”> </li></ul><ul><ul><li><IconStyle> </li></ul></ul><ul><ul><li><LabelStyle> </li></ul></ul><ul><ul><li><LineStyle> </li></ul></ul><ul><ul><li><PolyStyle> </li></ul></ul><ul><ul><li><BalloonStyle> </li></ul></ul><ul><ul><li><ListStyle> </li></ul></ul><ul><li></Style> </li></ul>Various style elements are contained within the “Style” tag.
  3. 3. Changing Line Style in Earth <ul><li>Directions </li></ul><ul><li>Right click on the line (path) </li></ul><ul><li>Choose “properties” from the menu </li></ul><ul><li>Click on “style and color” </li></ul><ul><li>Click on the “Icon” Color block and choose your color. </li></ul><ul><li>Adjust “Icon” scale using the arrows or type in the scale you want. </li></ul>
  4. 4. LineStyle in KML <ul><li><LineStyle id=“ID”> </li></ul><ul><li><color>ffffffff</color> </li></ul><ul><li><colorMode>normal</colorMode> </li></ul><ul><li><width>1.0</width> </li></ul><ul><li></LineStyle> </li></ul>
  5. 5. Random Color <ul><li><LineStyle id=“ID”> </li></ul><ul><li><color>ffffffff</color> </li></ul><ul><li><colorMode>random</colorMode> </li></ul><ul><li><width>1.0</width> </li></ul><ul><li></LineStyle> </li></ul>Random allows the path color to change every time the layer is loaded. Set the color to white “FFFFFFFF” in order to get truly opaque colors.
  6. 6. PolyStyle <ul><li><PolyStyle id=“ID”> </li></ul><ul><li><color>ffffffff</color> </li></ul><ul><li><colorMode>normal</colorMode> </li></ul><ul><li><width>1.0</width> </li></ul><ul><li><outline>1</outline> </li></ul><ul><li><fill>1</fill> </li></ul><ul><li></PolyStyle> </li></ul>NOTE: Booleans returns True or False. KML uses a 1 for True and 0 for False.
  7. 7. MulitGeometry Style Idea <ul><li>Create a map that uses polygons to outline the states. </li></ul><ul><li>Use <colorMode>random</colorMode> so that each state is filled with a different color when the US Map is loaded each time. </li></ul><ul><li>Use <Mulitgeometry> to add placemarks for the state capitals or historical monuments. </li></ul>
  8. 8. Changing Icon Color and Scale in Earth <ul><li>Directions </li></ul><ul><li>Right click on icon </li></ul><ul><li>Choose “properties” from the menu </li></ul><ul><li>Click on “style and color” </li></ul><ul><li>Click on the “Icon” Color block and choose your color. </li></ul><ul><li>Adjust “Icon” scale using the arrows or type in the scale you want. </li></ul>
  9. 9. IconStyle Syntax
  10. 10. Icon Style Example
  11. 11. Changing Heading for an Icon <ul><ul><li><IconStyle> </li></ul></ul><ul><ul><li><heading> 0.0 </heading> is due North </li></ul></ul><ul><ul><li><heading> 90.0 </heading> is East </li></ul></ul><ul><ul><li><heading> 180.0 </heading> is South </li></ul></ul><ul><ul><li><heading> 270.0 </heading> is West </li></ul></ul><ul><ul><li></IconStyle> </li></ul></ul>
  12. 12. Icon Link <href> <ul><li>Can be stored on a disk or online. </li></ul><ul><li>Can use an absolute or relative link. </li></ul><ul><li>Most times its better to use a relative link so it can be packaged into a KMZ file. </li></ul>Absolute Reference Relative Reference
  13. 13. Icon Hotspots <hotSpot> <ul><li>Specifies the location on the icon that is to be anchored to the ground. </li></ul><ul><li>By default the center of the icon is pinned. </li></ul>
  14. 14. Changing Label Color and Scale in Earth <ul><li>Directions </li></ul><ul><li>Right click on icon </li></ul><ul><li>Choose “properties” from the menu </li></ul><ul><li>Click on “style and color” </li></ul><ul><li>Click on “Label” Color block and choose your color. </li></ul><ul><li>Adjust “Label” scale using the arrows or type in the scale you want. </li></ul>
  15. 15. LabelStyle Syntax
  16. 16. LabelStyle Example
  17. 17. BalloonStyle Syntax
  18. 18. BalloonStyle Example
  19. 19. Changing List Style in Earth <ul><li>As of GE 5.0 it can’t be done…you need to use KML. </li></ul>
  20. 20. List Style Syntax
  21. 21. Shared Style Examples Contains <IconStyle> <LableStyle> <LineStyle> <BalloonStyle> Main Tag <Style id=“blue_arrow”> Placemarks Contain <styleUrl>#blue_arrow</styleUrl> *Must be defined within <Document>
  22. 22. Research Activity <ul><li>Look through the Google Earth layers in the primary database or search online for other x.kml and x.kmz files and find an interesting use of a style or that you could possible use for your project. Be prepared to explain: </li></ul><ul><ul><li>1. …why you liked it. </li></ul></ul><ul><ul><li>2. …how you will use it to get a point across about your project. </li></ul></ul><ul><ul><li>3. …what code (<parent>, <child> tags) was used to create the style or icon. </li></ul></ul><ul><ul><li>4. ..how you will have to change the code to meet your specifications. </li></ul></ul>Check out “Grapes of Wrath” book mapping layer to see you styles are used. Does the author use an inline or shared style?
  23. 23. How to specify a Style URL <ul><li>If the <Style> is defined in the same file , precede the Style ID with a # sign </li></ul><ul><ul><li><styleUrl>#blue_arrow</styleUrl> </li></ul></ul><ul><li>If the <Style> is defined in an external file , use the full URL along with the # sign </li></ul><ul><ul><li><styleUrl>http://server.com/filename.kml#IDname</styleUrl> </li></ul></ul>
  24. 24. Overriding Style Values *Inline styles override shared styles. Blue Green
  25. 25. Style Maps for Rollover Behavior <ul><li><StyleMap id=“styleMapExample”> </li></ul><ul><li><Pair> </li></ul><ul><li><key> normal </key> </li></ul><ul><li><styleUrl>#normalState</styleUrl> </li></ul><ul><li></Pair> </li></ul><ul><li><Pair> </li></ul><ul><li><key> highlight </key> </li></ul><ul><li><styleUrl>#highlightState</styleUrl> </li></ul><ul><li></Pair> </li></ul><ul><li></StyleMap> </li></ul>
  26. 26. Style Map Mouseover Example Highlighted Style Normal Style My Arrow
  27. 27. Simplifying A Crowded Display <ul><li><StyleMap id=“styleMapExample”> </li></ul><ul><li><Pair> </li></ul><ul><li><key> normal </key> </li></ul><ul><li><styleUrl>#normalState</styleUrl> </li></ul><ul><li><IconStyle>…</IconStyle> </li></ul><ul><li><LableStyle> </li></ul><ul><li><scale>0</scale> </li></ul><ul><li></LableStyle> </li></ul><ul><li></Pair> </li></ul><ul><li><Pair> </li></ul><ul><li><key> highlight </key> </li></ul><ul><li><styleUrl>#highlightState</styleUrl> </li></ul><ul><li><IconStyle>…</IconStyle> </li></ul><ul><li><LableStyle> </li></ul><ul><li><scale>1</scale> </li></ul><ul><li></LableStyle> </li></ul><ul><li></Pair> </li></ul><ul><li></StyleMap> </li></ul>
  28. 28. Defining Styles Externally <ul><li>KML does not support CSS </li></ul><ul><li>Can define a style externally by referencing and external kml file. </li></ul>

×