诺基亚这里javascript地址解析不返回英文地址

问题描述:

我开始使用诺基亚地图API,并注意到地址解析(获取地址的纬度/经度)时出现一些奇怪的地方。诺基亚这里javascript地址解析不返回英文地址

我正在寻找“1348鲁汶-LA-Neuve的,比利时,比利时

其返回我一个结果与地址和位置阵列中;不幸的是,返回的地址似乎是用法语,而不是我自然的英语语言环境。

返回的地址部分,回到我“比利时”的国家值,而不是预期的“比利时”。有没有一种方法可以强制我的英语语言环境,而不是似乎是搜索国家的语言环境。

(我也意识到,这可能不是一个语言环境的问题,而是官方名称的国家,这仍然是我的问题,因为我用英语处理)

+0

诺基亚吗?喜欢,整个公司? – 2013-03-27 12:02:27

+0

诺基亚有一个地图平台,这样称为“这里”http://developer.here.com/en_GB – Jarede 2013-03-27 12:09:51

+0

确定:)不知道,谢谢...变成了一个有趣的双关语。 – 2013-03-27 12:10:56

这是一个错误(票号:JSLA -3608)。应该是这样的,添加nokia.Settings.set("defaultLanguage", "en-GB");会更改地理编码请求的语言环境,但在我看来,地理编码功能并未将语言环境传递给地理编码服务。有趣的是,该reverseGeocoding服务确实正确传递的区域设置,因此它能够使用一种解决方法,以获得最佳的区域设置:

searchManager.geoCode({ 
     searchTerm: "1348 Louvain-la-Neuve,Belgium,Belgium", 
     onComplete: function (data, requestStatus, requestId) { 
      processResults(data, requestStatus, requestId); 
      map.zoomTo(addressesContainer.getBoundingBox()); 
      } 
    }); 

返回“比利时”

而:

searchManager.geoCode({ 
     searchTerm: "1348 Louvain-la-Neuve,Belgium,Belgium", 
     onComplete: function (data, requestStatus, requestId) { 
        nokia.places.search.manager.reverseGeoCode({ 
        latitude: data.location.position.latitude, 
        longitude: data.location.position.longitude, 
        onComplete: function (data, status) { 
         processResults(data, requestStatus, requestId); 
         map.zoomTo(addressesContainer.getBoundingBox()); 
        } 
       });    
      } 
    }); 

返回“比利时”。

这里是充满为例(使用自己的app id and token

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"> 
     <head> 
      <meta http-equiv="X-UA-Compatible" content="IE=7; IE=EmulateIE9; IE=EmulateIE10;"/> 
      <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> 
      <title>Nokia Maps API for JavaScript Example: Addresses</title> 
      <meta name="description" content="Geocode multiple addresses and display them using standard markers and infobubbles"/> 
      <meta name="keywords" content="addresses, services, geocode, reverse, geocode"/> 
      <!-- For scaling content for mobile devices, setting the viewport to the width of the device--> 
      <meta name=viewport content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/> 
      <!-- Styling for example container (NoteContainer & Logger) --> 
      <link rel="stylesheet" type="text/css" href="http://developer.here.com/apiexplorer/examples/templates/js/exampleHelpers.css"/> 
      <!-- By default we add ?with=all to load every package available, it's better to change this parameter to your use case. Options ?with=maps|positioning|places|placesdata|directions|datarendering|all --> 
      <script type="text/javascript" charset="UTF-8" src="http://api.maps.nokia.com/2.2.4/jsl.js?with=all"></script> 
      <!-- JavaScript for example container (NoteContainer & Logger) --> 

      <style type="text/css"> 
       html { 
        overflow:hidden; 
       } 

       body { 
        margin: 0; 
        padding: 0; 
        overflow: hidden; 
        width: 100%; 
        height: 100%; 
        position: absolute; 
       } 

       #mapContainer { 
        width: 100%; 
        height: 100%; 
        left: 0; 
        top: 0; 
        position: absolute; 
       } 
      </style> 
     </head> 
     <body> 
      <div id="mapContainer"></div> 
      <div id="uiContainer"></div> 
      <script type="text/javascript" id="exampleJsSource"> 
    /* Set authentication token and appid 
    * WARNING: this is a demo-only key 
    * please register on http://api.developer.nokia.com/ 
    * and obtain your own developer's API key 
    */ 
    nokia.Settings.set("appId", "APP ID); 
    nokia.Settings.set("authenticationToken", "TOKEN"); 
    nokia.Settings.set("defaultLanguage", "en-GB"); 

    // Get the DOM node to which we will append the map 
    var mapContainer = document.getElementById("mapContainer"); 

    // We create a new instance of InfoBubbles bound to a variable so we can call it later on 
    var infoBubbles = new nokia.maps.map.component.InfoBubbles(); 

    // Create a map inside the map container DOM node 
    var map = new nokia.maps.map.Display(mapContainer, { 
     // initial center and zoom level of the map 
     center: [52.51, 13.4], 
     zoomLevel: 10, 
     components:[ 
      // We add the behavior component to allow panning/zooming of the map 
      new nokia.maps.map.component.Behavior(), 
      infoBubbles 
     ] 
    }); 

    var location2, 

     // We will put our address markers into this container zo we can zoom in to the markers 
     addressesContainer = new nokia.maps.map.Container(), 
     marker, 
     searchCenter = new nokia.maps.geo.Coordinate(52.51, 13.4), 
     searchManager = nokia.places.search.manager; 

    map.objects.add(addressesContainer); 

    var processResults = function (data, requestStatus, requestId) { 
     // Data is instance of nokia.places.objects.Place 
     var location = data.location; 
     // Ensure that we our request came back with valid result 
     if (requestStatus == "OK") { 
      // Create a new marker on the found location 
      marker = new nokia.maps.map.StandardMarker(location.position); 
      // Add marker to its container so it will be render 
      addressesContainer.objects.add(marker); 
      marker.$address = location.address; 
      marker.$label = data.name; 
     } 
    }; 

    /* 
     searchManager.geoCode({ 
      searchTerm: "1348 Louvain-la-Neuve,Belgium,Belgium", 
      onComplete: function (data, requestStatus, requestId) { 
       processResults(data, requestStatus, requestId); 
       map.zoomTo(addressesContainer.getBoundingBox()); 
       } 
     }); */ 


     searchManager.geoCode({ 
      searchTerm: "1348 Louvain-la-Neuve,Belgium,Belgium", 
      onComplete: function (data, requestStatus, requestId) { 
         nokia.places.search.manager.reverseGeoCode({ 
         latitude: data.location.position.latitude, 
         longitude: data.location.position.longitude, 
         onComplete: function (data, status) { 
          processResults(data, requestStatus, requestId); 
          map.zoomTo(addressesContainer.getBoundingBox()); 
         } 
        });    
       } 
     }); 


    addressesContainer.addListener("click", function (evt) { 
     var marker = evt.target, 
      address = marker.$address, 
      label = marker.$label; 
     if (marker instanceof nokia.maps.map.Marker) { 
      infoBubbles.openBubble(label, marker.coordinate); 
     } 

    }); 




      </script> 
     </body> 
    </html> 
+1

目前的HERE Maps版本(2.5.3)似乎有同样的错误,可能吗? – Flea777 2013-10-15 13:06:18