2013-03-27 3 views
1

Я начинаю использовать API Карт Nokia и заметил некоторые странности при адресах геокодирования (получение Lat/Long адреса).Nokia Здесь javascript geocoding не возвращает английский адрес

Я искал «1348 Левен-ла-Нев, Бельгия, Бельгия»

который вернулся мне один результат в массиве с адресом и положением; К сожалению, возвращаемый адрес кажется на французском, а не на моем естественном языке английского языка.

адресная часть возвращения, возвращается мне значение страны «Belgique» вместо ожидаемой «Бельгии». Есть ли способ форсировать через мой английский язык, а не то, что, по-видимому, является языком искомой страны.

(я также понимаю, что это не может быть языковой вопрос, а официальное название страны, которая по-прежнему является проблемой для меня, как я заниматься на английском языке)

+0

Nokia здесь? Как, вся компания? –

+0

Nokia имеет платформу для карт и называется «ЗДЕСЬ» http://developer.here.com/en_GB – Jarede

+0

OK :) не знал, что, спасибо ... оказался забавным каламбуром. –

ответ

0

Это является ошибкой (билет №: 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()); 
      } 
    }); 

возвращает «Belgique»

тогда:

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

Нынешняя ЗДЕСЬ Карт версия (2.5.3), похоже, такая же ошибка, возможно ли это? – Flea777

Смежные вопросы