Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 11:27, 14 March 2013 by jasfox (Talk | contribs)

HERE Maps API - How to check the Date Border Crossing

From Wiki
Jump to: navigation, search

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

Article Metadata
Tested with
Devices(s): FireFox, Internet Explorer, Google Chrome, Opera
Platform(s): Web
Dependencies: Nokia Maps API 2.2.4
Keywords: Nokia Maps, JavaScript, Date Border
Created: Maveric (16 Nov 2011)
Last edited: jasfox (14 Mar 2013)



The isCDB 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:

The International Date Line (IDL) Definition by

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 traveling east results in a day or 24 hours being subtracted, so that the traveler repeats the date to the west of the line. Full description here:

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. Remember to add in your own AppId and Token to get the example to work.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<title>Check for Date Border Crossing</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<script type="text/javascript"
src="" charset="utf-8">
<div id="mapContainer" style="z-index: -1; left:0px; top:0px; width: 100%; height: 80%; position: absolute;"></div>
<script type="text/javascript">
// Don't forget to set your API credentials
// Replace with your appId and token which you can obtain when you
// register on
nokia.Settings.set( "appId", "YOUR APP ID GOES HERE");
nokia.Settings.set( "authenticationToken", "YOUR AUTHENTICATION TOKEN GOES HERE");
var map = new"mapContainer"),
{ components: [ new],
'zoomLevel': 10,
'center':[-1.366667, 176.466667]
var markerContainer = new
[-1.366667, 176.466667],
text: "-1.366667, 176.466667",
draggable: false
[-1.366667, 180.000000],
text: "-1.366667, 180.000000",
draggable: false,
// Check for Date Border Crossing
// Add new Marker randomly
[Math.random() * 180 - 90, -176.000],
{ text: "-176.000, 179.000",
draggable: false,
// Check for Date Border Crossing
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");

For more on Nokia Maps API

Please check out the Nokia Maps API full documentation and API reference here:

You may also access the interactive API explorer

64 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.