I am using the HERE Geocoder Autocomplete API. It works perfectly well but I would like to know :
How can I specify a minimum matching level like "street" or "city" so it won't return me the result with a matchLevel of "state" or "county" ?
Geocoder Autocomplete API currently doesn't support restriction at matchLevel. You can explain your usecase in detail so that we can suggest alternatives if possible.
Related
I am not getting the Unit Number in response structure as mentioned in the API Documentation,
"For addresses from Australia, New Zealand and Canada a unit number can be included in the result if it was part of the query."
I am using autocomplete geocoder for NZ.
I tried to change the requestType but no help. API is not so clear on how to request Unit Number.
Got it. Actually, when we type the unit/housenumber in the query it actully brings the Unit number.
If I use Google Place Autocomplete for "Alpha Loft Elm" I get an address that includes only level 1 (state) in the administrative areas. But if I autocomplete for the same place using the returned formatted_address, "844 Elm St, Manchester, NH 03101, United States", I get level 2 (county) as well, with a different place-id.
I see the same behavior for other places as well. I see the same behavior from the Place Details API, when I give it the place-id returned in each case.
I need the county, and need to support autocomplete by place name.
The only workaround I've found for this is to use Place Search (textsearch) on the returned formatted_address, then use Place Details on the placeId returned for the address to get the county.
Is there a better approach?
(Also posted as a bug report on gmaps-api-issues.)
So far I am not aware of any other solution then after using Autocomplete to get the accurate address and place_id to use something like the following code to retrieve the "political" structure behind that address.
if (place.place_id) {
var service = new google.maps.places.PlacesService(map);
service.getDetails({placeId: place.place_id}, function (PlaceResult, PlacesServiceStatus) {
console.log(PlaceResult);
});
}
I am creating a route using google.maps.DirectionsService.
What would be the best method to get the list of countries the route goes through?
I can't find this info in the DirectionsResult https://developers.google.com/maps/documentation/javascript/reference#DirectionsResult
Each route from the routes array have a overview_path array with all the coordinates. You can geocode each of this coordinates and get the country of it (remember the limitation of geocoding calls!). Isn't the best solution but....
I have seen that it is possible with the "static" to limit the scope of the search to a certain area (with components restrictions), I have also seen that in release 3.exp (will be 3.14) of the JavaScript API, a new class google.maps.GeocoderComponentRestrictions has appeared. I have not seen anywhere how this class is supposed to be used though.
Does anyone have more information about this?
It looks like this was answered over at Google Maps Geocoding API, feature from the API missing in their JS api (?), with formatting like:
geocoder.geocode(
{ 'address': address, 'componentRestrictions':{'country':'GB'}},
function(results, status){
...
});
The GeocoderComponentRestrictions parameters get passed with the componentRestrictions key.
In my Flex project, can I add markers by its address instead of this:
var myGeographicCoordinates:LatLng = new LatLng(myLatitude, myLongitude);
for example add marker by "Paris, France"
I don't think you can do so directly. Instead you need to geocode the address and then use a LatLng to store the result.
Check out google's geocoding api here:
http://code.google.com/apis/maps/documentation/geocoding/
You should read Google's developer manual on Geocoding. It explains how to convert an address to a geolocation. I recommend you try looking at the Dev manual/API/Google before posting here.