We are using Geocoder API from Nokia Here maps and we are trying to search an address from a partial postalcode (we'd like using 'begins with' partial postalcode).
We are using this:
http://geocoder.cit.api.here.com/6.2/geocode.xml?postalcode=0400&country=ES&gen=5&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg
With 4 digit postalcode search we are obtaining results but if we search by 3 digits, we are getting no results:
http://geocoder.cit.api.here.com/6.2/geocode.xml?postalcode=040&country=ES&gen=5&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg
Is there any other way to do this?
Any help would be great!
Thanks in advance,
Antonio Sanchez
You are correct in that 3 digits is considered to be insufficient infromation to obtain a result.
I guess that If Spanish Postal Codes are purely numeric, you could make ten requests and amalgmate the results:
http://geocoder.cit.api.here.com/6.2/geocode.xml?postalcode=0400&country=ES&gen=5&app_id=XXX&app_code=XXX
http://geocoder.cit.api.here.com/6.2/geocode.xml?postalcode=0401&country=ES&gen=5&app_id=XXX&app_code=XXX
etc.
Related
I have implemented both the suggest+autocomplete a listing page who use the search api but I cannot have consistent results between what is suggested and what I have in the listing.
So my query in suggest mode is:
https://xxx/indexes/my-index/docs/suggest?suggesterName=generalSearchSuggester&top=3&fuzzy=true&$select=sys_Id,Name,Url&search=nin&api-version=2020-06-30
This return 3 results:
Nina
Nina25
Nick
And with the search api my query is:
https://xxx/indexes/my-index/docs?api-version=2020-06-30&&count=true&queryType=full&searchMode=any&%24skip=0&%24top=16&search=nin*~1&%24select=Name
This return 2 results:
Nina
Nina25
In this page: https://learn.microsoft.com/en-us/rest/api/searchservice/suggestions I see "The edit distance is 1 per query string" so I guess that this correspond to ~1 but I don't understand how to make it consistent.
Regards,
In your search example you are using a combination of a wildcard search with fuzzy search. To use fuzzy search as documented, remove the * from your query and specify the edit distance with the tilde character directly.
https://xxx/indexes/my-index/docs?api-version=2020-06-30&&count=true&queryType=full&searchMode=any&%24skip=0&%24top=16&search=nin~1&%24select=Name
This will match tokens with a spelling distance of 1.
nin~1 (matches nina)
nin~2 (matches nick)
nin~3 (matches nina25)
Fuzzy search matches on terms that are similar, including misspelled
words. To do a fuzzy search, append the tilde ~ symbol at the end of a
single word with an optional parameter, a value between 0 and 2, that
specifies the edit distance. For example, blue~ or blue~1 would return
blue, blues, and glue.
Autocomplete vs Search
The intent of the autocomplete suggester is to give you fuzzy suggestions on what to search for. It's telling you that you can search for either nina, nina25 or nick. When searching for these terms you will get all the results containing the token nina (or nina25 or nick).
I am using google map api to get address information by Postal code around the world [ not specific country].
https://maps.googleapis.com/maps/api/geocode/json?address=610&key=[apiKey]
I expected zip code is 610, but google response result for street number 610.
Is there any ways to get address by zip code only?
Thank you guys in advance for supporting.
How about something along with this query
https://maps.googleapis.com/maps/api/geocode/json?components=postal_code:1441|country:PH&key=YOUR_API_KEY
This will get you the address kind of this format
http://prntscr.com/ouwlq5
Key note here is the country. You need both of the postal_code and the country to make this work. Without country you'll get zero results.
On the google places api site, they have an example query that returns a load of detail:
site:
https://developers.google.com/places/web-service/details
query:
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJN1t_tDeuEmsRUsoyG83frY4&key=My-API-Key
Place_id appears to be the key here. So I'm trying to reverse-engineer this example, starting from information that a human being would actually have, to end up with this place_id.
Address from the example:
48 Pirrama Rd, Pyrmont NSW 2009, Australia
Places API query from the address:
https://maps.googleapis.com/maps/api/place/textsearch/json?query=48+Pirrama+Rd,+Pyrmont+NSW+2009,+Australia&key=My_API_Key
The result contains a different place_id:
ChIJ8UadyjeuEmsRDt5QbiDg720
And the place details with that place_id are much poorer than the original example:
https://maps.googleapis.com/maps/api/place/details/json?placeid=ChIJ8UadyjeuEmsRDt5QbiDg720&key=My-API-Key
So what am I missing here? How do I start from human-place information and get to the place_id that has the great place details?
EDIT: why the down votes? Am I trying to do something that isn't allowed?
Thanks,
sff
I think your text search is returning the office building, whereas your first search is returning the Google office within the office building. You can fix your text search by adding the name of the company and removing some of the search terms.
I'm not sure why just adding 'google' to the search term doesn't return the result you want though.
Hello i am using simple google map places api to get near by atms for users. My client lives around new york and for some strange reason api shows zero results for that place, but works fine near me (pakistan) . I searched for it a little and found out it was google's issue and some other places were also experiencing the same problem. But i never quite found any solution for this.
This is the get call i use
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.7128,74.1059&radius=10000000&keyword=atm&key=MY_KEY
I would really appreciate the help. Thank you :)
Google place nearby search maximum 50,000 meters (31 miles) . if you try enter more than 50,000 it not work proper.
There is another way for find all ATM in a city. google provide Text Search Requests
https://maps.googleapis.com/maps/api/place/textsearch/json?query=atm+in+Reno,NV,89501,USA&key={API_KEY}
query = keyword + in + city Name
for get city name using latitude longitude
http://maps.googleapis.com/maps/api/geocode/json?latlng=39.52963,-119.81380&sensor=true
For more information how to get city name using latitude longitude
https://developers.google.com/maps/documentation/geocoding/start?csw=1#ReverseGeocoding
for more information about how to use Text Search Requests
https://developers.google.com/places/web-service/search
OR (second way)
There is another way for find all ATM in a city.
Open Google Maps .
create 10-12 or more points latitude , longitude value to trigger
request.
Then use a loop to find all places within these points.
If you want more appropriate results, increase first trigger points
for your requests.
- It is just a logic i created in php.
$triggerPoints = array("lat1,long1", "lat2,long2", "lat3,long3",....);
foreeach(triggerPoints as $tP){
$requestUrl = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=$tP&radius=[YOUR_RADIUS_VALUE]&type=[YOUR_TYPE]&name=panera&key=[YOUR_KEY_HERE";
$results = file_get_contents($requestUrl);
//Do what you want with response JSON data
}
SHORT ANSWER: Use logical types with your needs.
In my case i used food types instead of supermarket. In some cases, my local market named A101 wasnt found under supermarkets. To find which keywords is best for you, you can search below url with your location and map_key and find most common keywords under types for each query and use it.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=40.986527896166244,%2029.24326049097467&rankby=distance&keyword=a101&key=YOUR_MAP_KEY
Although similar but not exactly the same problem as How to return results for incomplete strings on Nokia Here Maps API? because I am not doing incomplete strings but rather a complete word but not the whole street address. Specifically, in Barcelona, if I search for the word Fortuny, 3 it finds Carrer de Fortuna but I search for Pintor Fortuny, 3 then it correctly finds me Carrer del Pintor Fortuny
Is there a way for the API to return me Pintor Fortuny, 3 if my search keyword is Fortuny? Or at least give them both so that the user can choose?
In this case your request a complete string but still a minor part of the complete street name. This is not enough information for the Geocoder to find the street which you are looking for.
During the string comparison for 'Fortuny' the shorter street name 'Carrer Fortuny' matches better than 'Carrer del Pintor Fortuny'. You need to provide minimum 'Pintor Fortunity' for a better match.