language parameter with here geocoding - here-api

i am using the here geocoding and map tiles services.
geocoding search for oran, algeria returns address information in arabic. map tiles for oran, algeria show address information in french. here.com map site for oran, algeria also shows address information in french. i would prefer geocoding information in english. when making my geocoding request i have added "&language=en". information returned in arabic. i have also tried a request but with "&language=fr". information returned in arabic. is it possible to have geocoding information returned in english? and, out of curiosity, since here seems to have the information in french when generating its tiles, is it possible to have geocoding information returned in french?
i notice that for, eg, tokyo, japan, the information is returned in english (or a sort of trans-literated englsh), not japanese. the same is true for, eg, moscow, russia. map information is in english, not cyrillic characters.
the only rule or guidance that i have found in the here documentation regarding language parameters concerns using a language list (&languages= ...)
thanks for any help.
- george ott

When geocoding an address, the language parameter will only alter the exonym for the city and country. Take for example the Grote Markt/Grand Place in the center of Brussels.
If you search for Grand Place - the address is in French
If you search for Grand Place with language=en - the address is in French, the city and country are in English
If you search for Grote Markt - the address is in Dutch
If you search for Grote Markt with language=en - the address is in Dutch, the city and country are in English
If you want to obtain the Dutch name for the French street, you will need to make two requests - firstly a geocoding request to find out the longitude/latitude and then a reverse-geocoding request to find out the local name of a location in the language of your choice.
For example Rue Bouzerki Mohamed/ نهج بوزركي محمد, وهران, الجزائر is a street in Oran:
Geocode the Arabic text to a location like this
Reverse Geocode to get the French name like this
It appears that as a general rule, the primary language is returned by default (for Algeria this is Arabic), but in the cases where a separate script is used an alternative may be returned. For an English language request, the road names in Algeria are returned in French (i.e. the standard 26 letter Roman Alphabet) rather than Arabic script.
The Map Tiler can display bilingual maps as shown below:
lg=FRE&lg2=DUT Map of Brussels at zoom 10
However the roads are only displayed in the primary language
lg=FRE&lg2=DUT Map of Brussels at zoom 17
Presumably this is due to the optimization of the label placements.
For languages with different scripts, both labels are shown
lg=ARA&lg2=FRE Map of Oran at zoom 11
This includes the roads displayed in the secondary language at high zoom
lg=ARA&lg2=FRE Map of Oran at zoom 17
The list of languages available to the lg and lg2 parameters can be found in the Map Tile API Reference. Examples of monolingual and bilingual maps tile can be found in the API Explorer
The lg and lg2 can also be passed to the Maps API For JavaScript as shown:
var mapTileService = platform.getMapTileService({
type: 'base'
}),
bilingualMapLayer = mapTileService.createTileLayer(
'maptile',
'normal.day',
256,
'png8',
{lg: 'ARA', lg2: 'FRE'}
);
map.setBaseLayer(bilingualMapLayer);
Where map is an instance of an H.Map and platform is the
H.service.Platform stub.

Related

Empty Results from Here API for the sample zipcodes

When I do the GET Request to the here API with the below zip codes I am getting an empty list. But When I google these zip codes, I can see that they are valid.
Here is the GET Request URL: https://geocode.search.hereapi.com/v1/geocode?qq=postalCode=[Insert-zip-code];country=USA&apiKey=[Insert-API-Key]
Below are the fallowing Zip Codes:
75046
34988
68902
45258
19486
88102
32245
28603
68501
93403
68602
91365
Try with https://geocode.search.hereapi.com/v1/geocode?q=postalCode=zip_code+USA&apiKey=your_api_key
Notice that there is only one q.
The above will work, but in some cases it will give you results not only from the United States.
Keep in mind what the API documentation says for this service:
Address lookup by postal code (SGP, IRL)
(...) This feature is available for these two countries only.
It's only for Ireland and Singapore.
There is an alternative for the United States (and Netherlands), but it requires the zip+4 code.
What is a Zip+4 Code?
A ZIP+4 code uses the basic five-digit code plus four additional
digits to identify a geographic segment within the five-digit delivery
area, such as a city block, a group of apartments, an individual
high-volume receiver of mail, a post office box, or a specific
delivery route
Example: https://geocode.search.hereapi.com/v1/geocode?qq=postalCode=60606-1506&apiKey=your_api_key
Notice that there are two q's.

What are address26 and address29 in Nominatim?

Occasionally - rarely - a Nominatim search will return a hit with a key "address29" or "address26". There is no mention of such a key in osm, and I can't find any explanation in Nominatim.
Here's an example. Search nominatim for bamako (the capital city of Mali). Among others you'll see:
{"place_id":"104544188","licence":"Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright",
"osm_type":"way","osm_id":"197528638","boundingbox":["47.4519905","47.4523668","-0.5565341","-0.5561207"],"lat":"47.4519905","lon":"-0.5565341",
"display_name":"Bamako, Angers, Maine-et-Loire, Pays de la Loire, Metropolitan France, 49000;49100, France",
"class":"highway","type":"platform","importance":0.2,
"address":{"address26":"Bamako","city":"Angers","county":"Angers","state":"Pays de la Loire","country":"France","postcode":"49000;49100","country_code":"fr"},"namedetails":{"name":"Bamako"}},
In the address field/object you see "address26":"Bamako". What does that mean? the other keys all make sense.
If you access the osm id: (eg, http://nominatim.openstreetmap.org/details?osmtype=W&osmid=197528638), there is no mention of address26.
At the website: https://thefive.sabic.uberspace.de/ they have a number of address26 entries pointing to Nominatim. I don't know what their database represents.
I have come across other Nominatim search results with address29 instead of address26.
If you look at http://taginfo.openstreetmap.org/, you won't find address26 or address29 as keys or tags...
Once in a while you will see a city named "fixme" on an osm map, but at least you have an idea of what's going on there, address2[69] stumps me. Does anyone know why?

Google Map API v3 not accurately returning Japanese addresses

I have a site implementing "Google Map API v3" to create a map with pushpins of the yoga studios in our DB. Unfortunately, the locations are all in Japan. We have the addresses in English and Japanese, however, Google Maps is not so flexible with Japanese addresses in English and our DB of addresses is not the cleanest, so sometimes addresses do not display properly. Our addresses in Japanese characters (kanji) are probably fine and I would like to use them, so here is the problem...
When using addresses in kanji with the Google Map API, the maps shows completely wrong locations. But when I input the same address manually in Google Maps, it accurately delivers.
Is there a language setting or something?
Thank you.
Update and another question...
I figured out how to get the correct locations onto the map by editing the 'GoogleMapAPIv3.class.php' file here:
public function geocoding($address)
{
$encodeAddress = urlencode($this->withoutSpecialChars($address));
$url = "http://maps.google.com/maps/geo?q=".$encodeAddress."&output=csv";
...etc...
Changed the '$url...' line to:
$url = "http://maps.google.com/maps/geo?q='".$address."'&output=csv";
To make the function just use the inputted address as is. My question is, will that cause any problems with anything else?
Keep in mind this map function is only used to map locations residing in our DB, so the addresses are only limited to what is there. i.e. no random user input.
Thanks again.
change $url = "http://maps.google.com/maps/ to $url = "https://google.co.jp/maps/ and if you want you can add language=ja at the end so that the language is japanese for example:
https://google.co.jp/maps/api/js?language=ja
https://developers.google.com/maps/documentation/javascript/examples/map-language
and https://google.co.jp/maps/ is google maps on Japan

Google Maps API: Bring up address selections as you type

I'm looking to create a web application that starts to suggest home addresses as you type. For instance, imagine a pizza delivery company, where you start typing in your address, "1279", and beneath the box it brings up 1279's in the US for people to choose from, like:
1279 Main Street, St. Louis, MO
1279 Tree Street, Baltimore, MD
In this way, it would really mirror maps.google.com in bringing up suggestions as you type.
I've looked through the Google Places and Maps APIs without much success. The GeoCoding one works OK by passing an address parameter through, but often returns no results or really bad ones... nothing like maps.google.com. Plus they're difficult to parse. (The address parts parameters aren't always consistent, meaning that I have to send the formatted address through another parser... not a deal-breaker though.)
Anyone else have any suggestions out there? Thanks! Jeremy
You can improve the Places autocomplete results by passing bounds option when creating it. The example binds it to the map viewport:
autocomplete.bindTo('bounds', map);
In this demo I hardcoded the continental US bounds (plus some of Mexico and Canada)
var input = document.getElementById('searchTextField');
var autocomplete = new google.maps.places.Autocomplete(input,
{bounds: new google.maps.LatLngBounds(
new google.maps.LatLng(23.730197707069532, -126.14240169525146),
new google.maps.LatLng(50.1805258484942, -65.32208919525146)) }
);

Correct address format to get the most accurate results from google GeoCoding API

Is there any standard format to supply the address string to Google GeoCoding API to get the most accurate results on map.
For Eg. following query not giving correct result.
http://maps.googleapis.com/maps/api/geocode/xml?address=bloom,Bloomfield,CT,06002,USA&sensor=false
Thanks
Mandeep
I believe the suggested format is:
House Number, Street Direction, Street Name, Street Suffix, City, State, Zip, Country
The results get less specific the less information you can supply, obviously.
In your sample, the geocoder is searching for a street named 'bloom', of which there are similar matches in OH instead of CT. Removing 'bloom' from the query and then searching returns Bloomfield, CT.
Definition of Google address search:
address - The street address that you want to geocode, in the format used by the national postal service of the country concerned. Additional address elements such as business names and unit, suite or floor numbers should be avoided.
https://developers.google.com/maps/documentation/geocoding/#geocoding
How should I format my geocoder queries to maximise the number of successful requests?
The geocoder is designed to map street addresses to geographical coordinates. We therefore recommend that you format geocoder requests in accordance with the following guidelines to maximise the likelihood of a successful query:
Specify addresses in accordance with the format used by the national postal service of the country concerned.
Do not specify additional address elements such as business names, unit numbers, floor numbers, or suite numbers that are not included in the address as defined by the postal service of the country concerned.
Use the street number of a premise in preference to the building name where possible.
Use street number addressing in preference to specifying cross streets where possible.
Do not provide 'hints' such as nearby landmarks.
https://developers.google.com/maps/faq#geocoder_queryformat
I found the answer incomplete and it lacked a source.
Look here: https://developers.google.com/places/documentation/autocomplete#place_autocomplete_responses
The maps autocompletion API from google returns a much simpler format: "Street address, City, Country"
Now you can use a string like that to search for an address and it should lead to one exact result.
In addition if you use the autocompletion API you will get a unique identifier too which can be used for further detail requests.
The format of the street address greatly depends on the location where you actually are.
In the US "House number, street direction, street name, street suffix" might make sense, in most of Europe it will not lead to successful query.
Addresses in most of EU are different (often "Streetname number suffix") like "Kumpelstraat 25A","Psolevcu 331/26b") and I guess we'd be surprised if we look at some eastern countries.
So if you bind your code to a single area (US, most of EU) you might be good hardcoding the format.
If you want to have a more flexible system you either need to find out propper formating for your target audience or query one of googles APIs to automatically get a proper string.
The one I linked is very good but requires an API key with a free request limit per day.
I stumbled upon this question and found a solution that worked for me:
I think the answer can be found by using component filtering, look at:
https://developers.google.com/maps/documentation/geocoding/#ComponentFiltering
An example in Javascript:
var request = require('request');
var url = "https://maps.googleapis.com/maps/api/geocode/json?" +
"address=Herengracht 180" +
"&components=postal_code:1016 BR|country:NL" +
"&sensor=false";
request(url, function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
else {
console.log('error', error);
}
});
No need to avoid apartment units. This works:
https://maps.googleapis.com/maps/api/geocode/xml?address=14202+N+42nd+St+Unit+301+33613
"Apt", "Room", and "Suite" work as well
They all return 301 as subpremise and are shown in "formatted_address" as "#301."
Paul sends...
I found that official country codes like "US", "DE", "FR" do not work well. Replacing them with the full country name gives much better results for me.
I did not find a source where that is stated.

Resources