Tools

Namespaces

Variants

Views

Actions

Search

Contents

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. Thanks for all your past and future contributions.

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

To achieve what we are about to do, we will need to use a method called pixelToGeo(), definition below:

pixelToGeo (coord): nokia.maps.geo.Coordinate-this will translate a projected pixel coordinate into a GEO Coordinate.

We also need to use the EventListener() and addListener() method, which is defined by the Nokia Maps API reference as follows: addListener (type, listener, useCapture) ObjectRegisters an event listener, depending on the useCapture parameter, on the capture phase of the event flow or its target and bubbling phases.

Parameters:
{String} type Specifies the event type associated with the event for which the user is registering.
{Function} listener The function to be called if the event occurs.

Example code

This example will add a new eventListener on the map and register the "click" event to fire the function eventListener(). We will get the position user had clicked and this will be converted from a pixel projection coordinate to a geo.Coordinate. The result is sent to screen with JavaScript Alert() method. Remember to add in your own AppId and Token.