User Tools

Site Tools


kg2204_4

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
kg2204_4 [2016/04/07 09:51] Stefan Enekg2204_4 [2020/03/26 13:24] (current) Stefan Ene
Line 1: Line 1:
 ====== KG2204 Exercise 3: KML and Google Maps ====== ====== KG2204 Exercise 3: KML and Google Maps ======
  
 +{{tag>SU english laboration presentation english laboration google_earth}}
  
 ''KML'' (Key Markup Language) and the compressed (zipped) version ''KMZ'' is used in for example the program ''Google Earth''. The format is usable for spreading geographical information to persons without professional GIS programs. In this exercise we will export KMZ files from ArcMap, Read and create KMZ and KML files in Google Earth and also read and create KML files using Notepad. ''KML'' (Key Markup Language) and the compressed (zipped) version ''KMZ'' is used in for example the program ''Google Earth''. The format is usable for spreading geographical information to persons without professional GIS programs. In this exercise we will export KMZ files from ArcMap, Read and create KMZ and KML files in Google Earth and also read and create KML files using Notepad.
 +== Export from ArcMap ==
  
-==Export from ArcMap== +Download the file areas.shp (and associated files) (Assistant will inform you from where)
- +
-Download the file areas.shp (and associated files) [[http://gisela.humangeo.su.se:8080/data/lab4_GIB2.zip|here]].+
  
 Save and extract the data on your computer and open it in ArcMap. Save and extract the data on your computer and open it in ArcMap.
Line 17: Line 16:
 (output file name).kmz (output file name).kmz
  
-==Read and Create in Google Earth==+== Read and Create in Google Earth ==
  
 Start Google Earth and open the KMZ file you exported from ArcMap using: Start Google Earth and open the KMZ file you exported from ArcMap using:
  
-File > Open...+File > Open
  
 You can try to click at the polygons and see the associated attribute data. You can try to click at the polygons and see the associated attribute data.
Line 39: Line 38:
 In the sidebar you can put your polygon and other things you add into folders and also change name and properties. In the sidebar you can put your polygon and other things you add into folders and also change name and properties.
  
-When you have created a folder containing some different things in different colors, right click at the folder and click: ''Save Place As...''+When you have created a folder containing some different things in different colors, right click at the folder and click: ''Save Place As''
  
 It is possible to choose if you want to save it as a KML or a KMZ. Save the folder you created using Google Earth both as a KML and a KMZ file. It is possible to choose if you want to save it as a KML or a KMZ. Save the folder you created using Google Earth both as a KML and a KMZ file.
  
-==Read and Create using Code (in Notepad)==+== Read and Create using Code (in Notepad) ==
  
-The data in KML files following the structure of a code language called ''XML'' (eXtensible Markup Language). The structure is not only used for describing geographical data. Below is an example how to the region Scandinavia could be described using XML (not KML). +The data in KML files following the structure of a code language called ''XML'' (eXtensible Markup Language). The structure is not only used for describing geographical data. Below is an example how to the region Scandinavia could be described using XML (not KML).
  
-@@ +@@ <?xml version="1.0" encoding="UTF 8"?> <Region
-<?xml version="1.0" encoding="UTF 8"?> + 
-<Region> +<code
- <Name>Scandinavia</Name> +<Name>Scandinavia</Name> 
- <Country> +<Country> 
- <Name>Sweden</Name> +    <Name>Sweden</Name> 
- <Population>9500000</Population> +    <Population>9500000</Population> 
- </Country> +</Country> 
- <Country> +<Country> 
- <Name>Norway</Name> +    <Name>Norway</Name> 
- <Population>5000000</Population> +    <Population>5000000</Population> 
- </Country> +</Country> 
- <Country> +<Country> 
- <Name>Denmark</Name> +    <Name>Denmark</Name> 
- <Population>5500000</Population> +    <Population>5500000</Population> 
- </Country> +</Country> 
-</Region+ 
-@@+</code
 + 
 +</Region> @@
  
 The first part tells the computer that this is XML code and also define the method (in this case ''UTF 8'') of translating for example 00100100 (the binary code the data is build of): The first part tells the computer that this is XML code and also define the method (in this case ''UTF 8'') of translating for example 00100100 (the binary code the data is build of):
  
-The rest of the XML code is built on a hierarchical structure were parts start with &lt;xx&gt; and end with &lt;/xx&gt;.+The rest of the XML code is built on a hierarchical structure were parts start with <xxand end with </xx>.
  
-===Open in Notepad===+=== Open in Notepad ===
  
 Open Notepad and open your files: Open Notepad and open your files:
  
-File > Open...  +File > Open
  
 Change ''Text Documents'' to ''All Files'' and open both the KML and the KMZ file you created in Google Earth. Change ''Text Documents'' to ''All Files'' and open both the KML and the KMZ file you created in Google Earth.
  
-The content of the KML file should exist of more symbols than the compressed KMZ file, but it is possible to read by a human. +The content of the KML file should exist of more symbols than the compressed KMZ file, but it is possible to read by a human.
  
-===Start with a new KML using Notepad===+=== Start with a new KML using Notepad ===
  
 We will now create a new KML file using Notepad. Start from a empty Notepad document and state that this is a XML document by writing: We will now create a new KML file using Notepad. Start from a empty Notepad document and state that this is a XML document by writing:
  
-@@ +@@ <?xml version="1.0" encoding="UTF 8"?> @@
-<?xml version="1.0" encoding="UTF 8"?> +
-@@+
  
 The second part starts the XML code. Copy this row to your document: The second part starts the XML code. Copy this row to your document:
  
-@@ +@@ <//kml xmlns="http:www.opengis.net/kml/2.2" xmlns:gx="http:www.opengis.net/kml/ext/2.2" xmlns:kml="http:www.opengis.net/kml/2.2" xmlns:atom="http:www.w3.org/2005/Atom"//> @@
-<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom"> +
-@@+
  
 The third part is the actual information that in this case give coordinates for the point ''Subway''. The third part is the actual information that in this case give coordinates for the point ''Subway''.
  
-@@ +@@ <Document
-<Document> + 
- <Placemark> +<code
- <name>Subway</name> +<Placemark> 
- <Point> +    <name>Subway</name> 
- <coordinates>18.0547,59.3652,0</coordinates> +    <Point> 
- </Point> +        <coordinates>18.0547,59.3652,0</coordinates> 
- </Placemark> +    </Point> 
-</Document+</Placemark> 
-@@+ 
 +</code
 + 
 +</Document> @@
  
 The last part end the KML code. The last part end the KML code.
  
-@@ +@@ </kml> @@
-</kml> +
-@@+
  
 Save the file with the file extension ''.kml'' instead of ''.txt'' and open the file in Google Earth. Save the file with the file extension ''.kml'' instead of ''.txt'' and open the file in Google Earth.
Line 118: Line 116:
  
 Also save this file with the file extension ''.kml'' and open the file in Google Earth. Also save this file with the file extension ''.kml'' and open the file in Google Earth.
- +=== Add layers to Google Maps ===
-===Add layers to Google Maps===+
  
 Now we will import a KML/KMZ file into Google Maps and learn how to embed Google Maps into a webpage. Now we will import a KML/KMZ file into Google Maps and learn how to embed Google Maps into a webpage.
Line 125: Line 122:
 We need a Google account for this. [[https://accounts.google.com/|Create a Google account]] if you don't already have one from before. We need a Google account for this. [[https://accounts.google.com/|Create a Google account]] if you don't already have one from before.
  
-Google Maps has the following address: [[http://maps.google.com]]+Google Maps has the following address: [[http://maps.google.com|http://maps.google.com]]
  
 Log in to your account and click on the question mark in the lower right corner, then ''Return to classic Google Maps''. Log in to your account and click on the question mark in the lower right corner, then ''Return to classic Google Maps''.
Line 133: Line 130:
 It is possible to edit the maps in Google Maps. It is possible to edit the maps in Google Maps.
  
-If you want to it is also embed the map into a webpage like below. +If you want to it is also embed the map into a webpage like below.
  
 ('''Submit the code for embedding the map on Mondo!''') ('''Submit the code for embedding the map on Mondo!''')
  
-<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps/ms?t=h&amp;msa=0&amp;msid=212795148531545359520.0004cb1251cc0cf25a112&amp;source=embed&amp;ie=UTF8&amp;ll=59.359424,18.057747&amp;spn=0.015966,0.029655&amp;output=embed"></iframe><br /><small>View <a href="https://maps.google.com/maps/ms?t=h&amp;msa=0&amp;msid=212795148531545359520.0004cb1251cc0cf25a112&amp;source=embed&amp;ie=UTF8&amp;ll=59.359424,18.057747&amp;spn=0.015966,0.029655" style="color:#0000FF;text align:left">Areas</a> in a larger map</small>+<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps/ms?t=h&msa=0&msid=212795148531545359520.0004cb1251cc0cf25a112&source=embed&ie=UTF8&ll=59.359424,18.057747&spn=0.015966,0.029655&output=embed"></iframe><br /><small>View <a href="https://maps.google.com/maps/ms?t=h&msa=0&msid=212795148531545359520.0004cb1251cc0cf25a112&source=embed&ie=UTF8&ll=59.359424,18.057747&spn=0.015966,0.029655" style="color:#0000FF;text align:left">Areas</a> in a larger map</small> 
 + 
 +More about how KML files are built can be found here: [[https://developers.google.com/kml/documentation/|https://developers.google.com/kml/documentation/]] 
 + 
 +And more about XML can be found here: [[http://www.w3schools.com/xml/|http://www.w3schools.com/xml/]]
  
-More about how KML files are built can be found here: [[https://developers.google.com/kml/documentation/]] 
  
-And more about XML can be found here: [[http://www.w3schools.com/xml/]] 
kg2204_4.1460015496.txt.gz · Last modified: 2016/04/07 09:51 (external edit)