我尝试使用 Google map 地理编码器从芬兰地址查询经纬度坐标。目的是在地址指向的 map 上绘制一个标记。到目前为止,它适用于英语字符,但芬兰语(和瑞典语)字符“ä、ö、å”会引起麻烦。我发现了这个:Swedish characters in google geocode request
,但没有帮助。
例如这个地址没有任何问题:
"Mannerheimintie 10, Helsinki, Finland"
但是这个有:
"Läntinen polku 10, Espoo, Finland"
这是我的代码:
geocoder = new google.maps.Geocoder();
geocoder.geocode({
'address': address
}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
...
... // do something
...
我也尝试过使用这些参数,但没有成功:
geocoder = new google.maps.Geocoder();
geocoder.geocode({
'address': address,
'region': 'FI' // I tried also with 'language':'fi'
}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
...
... // do something
...
使用的 API 是 Google Maps JavaScript API v3。 (https://developers.google.com/maps/documentation/javascript/examples/geocoding-simple)
那么我如何告诉此 API 使用芬兰语(或瑞典语)字符?
最佳答案
当您包含 google js 文件时,请尝试添加 &language=fi
进行本地化。
关于javascript - 如何告诉 Google Maps JavaScript API v3 使用芬兰语(或瑞典语)字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25081103/