Advertisement
Guest User

Example

a guest
Mar 14th, 2013
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 5 1.89 KB | None | 0 0
  1. <html>
  2. <head>
  3. <script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.2.4/jsl.js?with=all"></script>
  4. <script>
  5. //Minimal Settings of the Nokia Maps this are the codes for MyMaps
  6. nokia.Settings.set("appId", "mKxkNlWcmcRsAsT4n279");
  7. nokia.Settings.set("authenticationToken", "bScqDUhLaTjaTI5gEFfh0w");
  8.  
  9. </script>
  10. </head>
  11. <body>
  12.  
  13.     <div id="map" style="position: relative; width: 90%; height: 400px; margin: auto;"></div>
  14.  
  15. <script>
  16.                     display = new nokia.maps.map.Display(document.getElementById("map"),
  17.                     {
  18.                         "components": [
  19.                                               new nokia.maps.map.component.ZoomBar(),
  20.                                               new nokia.maps.map.component.Behavior(),
  21.                                               new nokia.maps.map.component.TypeSelector()
  22.                         ]
  23.                     });
  24.  
  25. var zoomTo = function (data, status) {
  26.  
  27.     if (status == "OK") {
  28.         var locations = data.results.items;
  29.         for (var i = 0, len = locations.length ;  i < len ; i++) {
  30.  
  31.            if ( "administrative-region"  == locations[i].category.categoryId){                            
  32.                map.zoomTo(nokia.maps.geo.BoundingBox.coverAll
  33.                        ([locations[i].boundingBox.topLeft,
  34.                         locations[i].boundingBox.bottomRight ]), false);
  35.                break;
  36.            }
  37.        }
  38.    } else {
  39.        alert("The search request failed");
  40.    }
  41. };
  42.  
  43. var term = "El Salvador";      
  44. nokia.places.search.manager.findPlaces({
  45.    searchTerm: term,
  46.    onComplete: zoomTo ,
  47.    boundingBox: {
  48.        topLeft: {
  49.            latitude: 85,
  50.            longitude: -179.99
  51.        },
  52.        bottomRight: {
  53.            latitude: -85,
  54.            longitude: 179.99
  55.        }
  56.    }
  57. });                
  58. </script>
  59. </body>
  60. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement