×
Namespaces

Variants
Actions
(Difference between revisions)

HERE Maps API - How to check the Date Border Crossing

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot addition of Template:ArticleMetaData)
hamishwillee (Talk | contribs)
m (Hamishwillee - Removed draft category. Added back in metadata)
Line 1: Line 1:
 +
[[Category:Browser]][[Category:Web]][[Category:Location]]
 +
{{Abstract|This article explains how to check the Date Border Crossing using the Nokia Maps API.}}
 
{{ArticleMetaData
 
{{ArticleMetaData
 
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
+
|devices=FireFox 7.0.1
 
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
Line 16: Line 18:
 
|update-by=<!-- After significant update: [[User:username]]-->
 
|update-by=<!-- After significant update: [[User:username]]-->
 
|update-timestamp=<!-- After significant update: YYYYMMDD -->
 
|update-timestamp=<!-- After significant update: YYYYMMDD -->
|creationdate=20111116
 
|author=[[User:Maveric]]
 
}}[[Category:Draft]][[Category:Browser]][[Category:Web]][[Category:Location]]
 
{{ArticleMetaData
 
 
|creationdate=20111116
 
|creationdate=20111116
 
|author=[[User:Maveric]]
 
|author=[[User:Maveric]]
 
}}
 
}}
{{Abstract|This article explains how to check the Date Border Crossing. }}
 
 
  
 
== Introduction ==
 
== Introduction ==
Line 117: Line 113:
  
 
FireFox 7.0.1
 
FireFox 7.0.1
 
 
 
''Add categories below. Remove Category:Draft when the page is complete or near complete''
 

Revision as of 02:40, 22 November 2011

This article explains how to check the Date Border Crossing using the Nokia Maps API.

Article Metadata
Tested with
Devices(s): FireFox 7.0.1
Article
Created: Maveric (16 Nov 2011)
Last edited: hamishwillee (22 Nov 2011)

Contents

Introduction

The isCDBA flag of the BoundingBox in Nokia Maps API has been added since v2 to indicate that the bounding box is crossing the date border. A bounding box which is spanned from -180° (left) to +180° (right) is NOT crossing the date border. Default value is false.

The API reference link: http://api.maps.nokia.com/2.0.0/apireference/symbols/nokia.maps.geo.BoundingBox.html?s=isCDB#isCDB

The International Date Line (IDL) Definition by WikiPedia.org

IDL is a generally north-south imaginary line on the surface of the Earth, passing through the middle of the Pacific Ocean, that designates the place where each calendar day begins. It is roughly along 180° longitude, opposite the Prime Meridian, but it is drawn with diversions to pass around some territories and island groups.Crossing the IDL travelling east results in a day or 24 hours being subtracted, so that the traveller repeats the date to the west of the line. Full description here: http://en.wikipedia.org/wiki/International_Date_Line

Example code

This example first adds two Markers for which the BoundingBox is not crossing the International Date Line. A third Marker is then randomly added to coordinates that will cause the check to produce the BoundingBox to have crossed the IDL.

<html>
<head>
<script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.0.0/jsl.js"></script>
</head>
<body>
<div id="map" style="width:100%; height:100%;"></div>
<script type="text/javascript">
 
var map = new nokia.maps.map.Display(document.getElementById("map"),
{ components: [ new nokia.maps.map.component.Behavior()],
{
'zoomLevel': 10,
'center':[-1.366667, 176.466667]
}
);
 
var markerContainer = new nokia.maps.map.Container()
markerContainer.objects.add(
new nokia.maps.map.StandardMarker
(
[-1.366667, 176.466667],
{
text: "-1.366667, 176.466667",
draggable: false
}));
 
markerContainer.objects.add(
new nokia.maps.map.StandardMarker(
[-1.366667, 180.000000],
{
text: "-1.366667, 180.000000",
draggable: false,
}));
 
map.objects.add(markerContainer);
map.zoomTo(markerContainer.getBoundingBox(),false,true);
 
// Check for Date Border Crossing
checkDateBorder();
 
// Add new Marker randomly
markerContainer.objects.add(
new nokia.maps.map.StandardMarker(
[Math.random() * 180 - 90, -176.000],
{ text: "-176.000, 179.000",
draggable: false,
}));
 
map.zoomTo(markerContainer.getBoundingBox(),false,true);
 
// Check for Date Border Crossing
 
checkDateBorder();
 
function checkDateBorder()
{
var CDB = markerContainer.getBoundingBox().isCDB;
if (CDB == false)
{
alert("False - The Bounding box is not crossing the date border");
} else if(CDB == true)
{
alert("True - The Bounding box crosses the date border");
}
}
 
</script>
</body>
</html>

Tested with

FireFox 7.0.1

242 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×