×
Namespaces

Variants
Actions
(Difference between revisions)

HERE Maps API - Converting any data file to KML

From Nokia Developer Wiki
Jump to: navigation, search
jasfox (Talk | contribs)
(Jasfox - Add Stub)
 
jasfox (Talk | contribs)
m (Jasfox - Added intro)
Line 1: Line 1:
 
[[Category:Draft]]
 
[[Category:Draft]]
 
{{UnderConstruction|timestamp=20120118141431 }}
 
{{UnderConstruction|timestamp=20120118141431 }}
{{Abstract|This article explains how to read address data from an abitrary file format, and create a KML file for display on a map.}}  
+
{{Abstract|This article explains how to read address data from an arbitrary file format, and create a KML file for display on a map.}}  
 
{{SeeAlso|[[Nokia Maps API - How to create a KML data file]]<br />
 
{{SeeAlso|[[Nokia Maps API - How to create a KML data file]]<br />
  
 
[[Nokia Maps API - How to display KML file data on the map]]
 
[[Nokia Maps API - How to display KML file data on the map]]
 +
}}
 +
{{Note| in order to load a KML file successfully, the generated KML file should be hosted on the same domain as the JavaScript or the results may be unpredictable. Some browsers will automatically prohibit cross-domain access.
 +
For example, if you are hosting at  ''example.com'', the final line of the JavaScript to load the KML will need to be:
 +
<code javascript>
 +
kml.parseKML("http://example.com/" + "generated_kml_data_file.kml")
 +
</code>
 +
and both the KML loading HTML and the  generated_kml_data_file.kml should be placed on  ''http://example.com/''
 
}}
 
}}
 
{{ArticleMetaData
 
{{ArticleMetaData
Line 32: Line 39:
 
== Introduction ==
 
== Introduction ==
  
 +
Keyhole Markup Language (KML) is an XML notation for geographic applications. The advantages of using KML are numerous, and have been listed in a [[Nokia_Maps_:_Converting_from_JavaScript_to_KML| previous article]].  A typical enterprise may wish to add some markers representing addresses onto a map for their website, but  without necessarily learning too much about geocoding or KML. It is likely that the address data they have is already held in a file or spreadsheet somewhere.
  
 +
This example aims to take the pain out of creating a KML dataset. It aims to take any data format and attempt to  the locate addresses given by specified fields from the file. The addresses are then transformed into KML <Placemarks> with associated <name> and <description> elements taken from other fields from the same record. The generated KML data can be inspected and edited using the editor example given [[Nokia Maps API - How to create a KML data file|here]] and then displayed using the code from the [[Nokia Maps API - How to display KML file data on the map|How to display KML data]] example. In summary, this article demonstrates a real world use of the geocoding service and is an example of making sequential asynchronous JavaScript calls  to obtain longitude and latitude.
  
 
== Summary ==
 
== Summary ==

Revision as of 18:56, 18 January 2012

Underconstruction.pngUnder Construction: (20120118141431) This article is under construction and it may have outstanding issues. If you have any comments please use the comments tab.

This article explains how to read address data from an arbitrary file format, and create a KML file for display on a map.

Note.pngNote: in order to load a KML file successfully, the generated KML file should be hosted on the same domain as the JavaScript or the results may be unpredictable. Some browsers will automatically prohibit cross-domain access.

For example, if you are hosting at example.com, the final line of the JavaScript to load the KML will need to be:

kml.parseKML("http://example.com/" + "generated_kml_data_file.kml")
and both the KML loading HTML and the generated_kml_data_file.kml should be placed on http://example.com/

Article Metadata
Code ExampleTested with
Devices(s): Firefox 9.0.1
Compatibility
Platform(s): Web Browser
Article
Keywords: Nokia Maps, JavaScript, KML
Created: jasfox (18 Jan 2012)
Last edited: jasfox (18 Jan 2012)

Introduction

Keyhole Markup Language (KML) is an XML notation for geographic applications. The advantages of using KML are numerous, and have been listed in a previous article. A typical enterprise may wish to add some markers representing addresses onto a map for their website, but without necessarily learning too much about geocoding or KML. It is likely that the address data they have is already held in a file or spreadsheet somewhere.

This example aims to take the pain out of creating a KML dataset. It aims to take any data format and attempt to the locate addresses given by specified fields from the file. The addresses are then transformed into KML <Placemarks> with associated <name> and <description> elements taken from other fields from the same record. The generated KML data can be inspected and edited using the editor example given here and then displayed using the code from the How to display KML data example. In summary, this article demonstrates a real world use of the geocoding service and is an example of making sequential asynchronous JavaScript calls to obtain longitude and latitude.

Summary

Add categories below. Remove Category:Draft when the page is complete or near complete

156 page views in the last 30 days.
×