Namespaces
Variants
Actions
(Difference between revisions)

HERE Maps API - How to show a Place on a web page

Jump to: navigation, search
m (Hamishwillee - Bot fixing redirect link.)
m (Jasfox - Corrected Category)
Line 1: Line 1:
[[Category:Web]][[Category:Location]]
+
[[Category:Nokia Maps]][[Category:JavaScript]][[Category:Code Snippet]]
 
==Introduction==     
 
==Introduction==     
  

Revision as of 11:10, 27 January 2012

Contents

Introduction

In this example we will use the Nokia Places API to get information of a specific place and to render that date on the web page with the use of the default template. There are a set of templates you can use for your purposes.

The information displayed consists of the name of the place next to a POI category icon, the address and contact details on a map centered to the POI icon.

To the results it is possible to add a list of reviews, ratings, accepted payment methods, photos taken.

The HTML page has a div element on which the information will be displayed.

In this simple example, we will only call the Place constructor using two parameters:

targetNode - indicates where to display the place data. placeId - the id of the location for which data is to be fetched and displayed.


Implementation

This is a fully working example code in HTML and JavaScript.

Example code

<html> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src='http://api.maps.ovi.com/places/beta1/jsPlacesAPI.js'></script>
</head>
<body>
<style>
.nokia-places-general-bubble a.nokia-share
{ color: #0099BB;
font-weight: normal;
font-size: 12px;
font-family: Arial;
text-decoration: none;
}
</style>
<div id="Place"></div>
<script>
var basicPlace = new nokia.places.Place({
placeId: '250u0ts2-78a011f821684d489e709ad6a3329fac',
targetNode: 'Place',
template: 'nokia.blue.extended' });
 
/* * There are 3 predefined templates you can use:
* 'nokia.blue.place'
* 'nokia.blue.extended'
* 'nokia.general.place'
* 'nokia.general.placesmall'
* 'nokia.general.bubble'
 
*/
</script>
</body>
</html>

For more on Nokia Places API

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

http://api.maps.nokia.com/places/

Tested with

Google Chrome 14.0.835.202 m Mozilla Firefox 8.0

401 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved