×
Namespaces

Variants
Actions

HERE Maps API - How to draw a rectangle

From Nokia Developer Wiki
Jump to: navigation, search

This article explains how to draw a rectangle on HERE Maps.

Article Metadata
Code Example
Source file: rectangle.html
Tested with
Devices(s): Internet Explorer, Google chrome, Firefox, Opera
Compatibility
Platform(s): Web browser
Dependencies: HERE Maps 2.5.3
Article
Keywords: HERE Maps, JavaScript, shapes, rectangle
Created: Maveric (21 Jun 2011)
Updated: avnee.nathani (31 Dec 2011)
Last edited: jasfox (20 Dec 2013)

Contents

Prerequisites

HERE Maps API supported web browser (basically any modern web browser)

Important note about maps credentials

Nokia provides several services options within the Maps API offering. The service is free to use, but you must obtain and use authentication and authorization credentials to use the services. Please read the Terms and Conditions and check the Pricing Plans page to decide which business model best fits your needs. Authentication requires unique Maps API credentials, namely an AppId and a token. You can get these credentials free for free following the instructions here

Implementation

API Definition of Rectangle:

    new nokia.maps.map.Rectangle (bounds, props)

Definition for the BoundingBox, used to form the rectangle:

new nokia.maps.geo.BoundingBox (topLeft, [bottomRight, [skipValidation]])

Example code

The following code will add a rectangle to the map:

function addRectangleToMap(map){
var boundingBox = new nokia.maps.geo.BoundingBox
([53.1, 13.1], [43.1, 40.1]);
map.objects.add(
new nokia.maps.map.Rectangle(boundingBox, {
precision: 36,
simplify: 16,
fillColor: "FFFFCC",
color: "E8FA75",
width: 8
})
);
}

NokiaMapsRectangleReal.png

A working example which displays a rectangle can be found at:

http://heremaps.github.io/examples/examples.html#rectangle

For more on the HERE Maps API

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

You may also access the interactive API explorer

This page was last modified on 20 December 2013, at 18:53.
332 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.

×