Here JavaScript API 3.x - Autocomplete function - javascript

I'm just wondering if there is a similar functionality in Here JS API 3.x for auto completion as in the google API.
In connection with the google maps API there is an autocomplete class available where you simply pass the UI element that is used for rendering the results of auto completion.
var autocomplete = new google.maps.places.Autocomplete(
(map_searchbox) , {componentRestrictions: countryRestrict });
As far as I have seen there is no such functionality available in the Here JS API 3.x. Did I miss it maybe? However, there is also the places API (H.places.Search) that can be used for searching and the jQuery Autocomplete widget could be used for displaying the results.
I'm just struggling a bit with the usage of the places API. I want to do the following in connection with searching for addresses only:
Pass the center of e.g. Germany in order to search for a specific street in any city inside Germany. As a result, I would expect that all those cities are returned. But it doesn't work like this with the Search entrypoint (https://developer.here.com/rest-apis/documentation/places/topics_api/resource-search.html)
Passing the center of Germany (coordinates 51.163375,10.447683) and searching for "Gotthardstraße" does not return Munich as city. Also, the search entrypoint does not offer the "in" parameter where you could specify a bounding box or polygon.
Could someone maybe give me some hints how to realize a similar auto complete functionality with the Here JS API 3.x? Integration into jQuery does not need to be answered. I'm just wondering about the correct usage of the Here JS API 3.x.
Thanks for your help, Seppal

HERE now also offers a Geocoder Autocomplete API.
The API has been available for licensing for a while, but the documentation was only recently made public: Geocoder Autocomplete API Developer's Guide - Introduction.
That API is an alternative to the Places API "suggest" feature. It provides address results even for short inputs (starting at two characters). Search can be restricted to the current map view or to a specific region for better results.

#hurrassinger,Here Maps API 3.x does provide "suggest" similar to autocomplete.
In Places API -> there is Suggest Entry point. (Instead of search that you are using)
The Suggest Entrypoint represents lists of suggested search terms related to a given (partial) search term and location context. This entrypoint is used to help users to provide suggested search terms to the user while typing.
Please refer https://developer.here.com/rest-apis/documentation/places/topics_api/resource-suggest.html
Now In javascript API , refer PlacesService class. This class implements Places api access (and access to suggest entry point). This class has a method called as suggest. (page 494 in this document )
Hope this helps.

Related

Azure maps Fuzzy search: when I search on azure maps I want postal codes to be autocompleted

I am creating an autocomplete widget using jQuery and ajax, and some queries will be in the form of zip codes. When the user types in less than 5 digits of their postal code, I want azure maps to return a fuzzy search like they would if I types in a partial city name. '5393' should return results with the various Wisconsin cities under those numbers even though it is incomplete.
here is my current key:
https://atlas.microsoft.com/search/fuzzy/json?subscription-key={key}&api-version=1.0&query={query}&typeahead=True&countrySet=US&view=Auto&entityType=PostalCodeArea&limit=20
I have already looked through the documentation extensively, so if you could point my to a parameter or something else I can do to have this happen I would greatly appreciate it
Try using the address service rather than the fuzzy search service. The fuzzy search service favors addresses and full addresses. With the address service you can limit the result entity type. Try adding &entityType=PostalCodeArea. If this doesn't work, try using the V2 search geocoding service, that is a lot more flexible by the looks of things.

Using google autocomplete places Javascript API can you bias results to a 'type' of location?

I am using the following API : https://developers.google.com/maps/documentation/javascript/places-autocomplete
I would like to restrict results as follows:
If a user has selected 'Airplane' - then the results should show only airports near the place typed by the user.
Likewise, if a user has selected 'Train' - then the results should show only train stations near the place typed by the user.
I don't see any documentation on that particular page suggesting this is possible. I have however elsewhere spotted a 'type' parameter which you can use....not sure how to work that here though.
Alternatively, I have thought - if the user selects 'Airport' I could always just append airport to their search query.
Any suggestions on the best way to do this?
According to the documentation, currently the types parameter of places autocomplete supports only following values:
geocode
address
establishment
(regions)
(cities)
https://developers.google.com/maps/documentation/javascript/places-autocomplete#add_autocomplete
There is a feature request in the public issue tracker to allow types mentioned in the http://code.google.com/apis/maps/documentation/places/supported_types.html in the places autocomplete.
Please take a look at this feature request:
https://issuetracker.google.com/issues/35820774
Feel free to star the feature request to add your vote.

jQuery gmap limits

I'm trying to generate a map that shows multiple store locations, perhaps 30-40. Only 10 are displaying. I understand that Google limits that, unless you provide a Google API key. I have one, but when I pass it in, Google complains ("Google has disabled use of the Maps API for this application"). The key is valid. Also, the jQuery gmap2 docs say the API key is not required. Is there a way around this limitation?
Thanks,

map city/zipcode polygons using google maps

I am looking for a javascript library that supports the ability to pass a zipcode or city as a parameter, and get a list of x,y coordinates to draw a polygon using google maps?
Does this exist? Does the google maps API support such queries? I am looking for an array of coordinates similar to those that google uses to draw maps on a google query:
Google Maps API doesn't support that kind of solution. There are a couple other places from which you can get the coordinates, though:
Flickr API
There is a Flickr API based on photos that people tag, but it's only as accurate as the people who tag photos: so it's good enough for bootstrapping but probably not for production: http://karya-blog.blogspot.com/2012/12/fetching-city-polygons-with-flickr-api.html
Natural Earth Data
An accurate alternative is www.naturalearthdata.com. To get that data from there you just need to make two requests: one with the city name and one with their ID to get the parameters:
unlock.edina.ac.uk/ws/search?name=berlin&gazetteer=naturalearth&format=json
and then
unlock.edina.ac.uk/ws/footprintLookup?format=json&identifier=14126951
and you're set :)
Mapzen
If it's possible for you to pre-fetch the data, go for Mapzen, they have a full and pretty accurate database: https://mapzen.com/data/borders/
Short answer: I do not think there is any magical getZipCodeBoundaries method in the Google Maps API. However, what you want to do can and has been done. Please see the implementation, and this thread on Google groups concerning the process. Is the first link similar to what you're hoping to accomplish? Also, there is a neighborhood API offered from Zillow under the CC license. You might want to look into that and see if it breaks neighborhoods down by zipcode.
You can get polygon coordenates in json for using with googlemaps using openstreetmap.
Go to http://nominatim.openstreetmap.org/
search a place like "Partido de Ituzaingó"
Steps:
Click on "details"
Look for the OSM ID and copy it (control+c), example: 2018776
Go to http://polygons.openstreetmap.fr/index.py
Paste the ID in
Download the polygon
Look on this site Twitter geo api You have few modes of search, and it gives You boundary box for cities. I am using it now on My site. Try f.e. this link and U will see the results.

Does Google Maps API offer a way to search for locations by name?

When one visits http://maps.google.com, they are able to type queries into the search field and receive results based on locations or places, and not hard search results, as they would in a normal Google Search query. They're a unique style of result (names of places, locations) suited to the Maps interface for obvious reasons.
I've been digging through both the Maps and standard Google Search API for a couple hours now, and have done multiple searches on this question, and I can't seem to find the answer.
They obviously have the Local Search, but that's been deprecated, and it only yields results if you provide an initial lat/long. I want to be able to find places or locations with no initial lat/long.
Essentially what I want to do is allow a user to type in an address, name of a place or name of a city or state or a zip code, or essentially any other kind of location that is allowable on Maps, and geocode it. I feel stupid because this seems like it has to be there, but nothing I've seen in the API seems to do this.
I don't need the AJAX suggested results, necessarily. Just a way for a user to type in a nice name and geocode from it, though results as a user types would be ideal.
What am I missing here?
What you are looking is Geocoding API from google maps.
Find Documentation here
UPDATE 5/12/2011
Google just opened up public access to their Places API. This is more to the heart of the original question request:
https://developers.google.com/maps/documentation/places/web-service/autocomplete
I think you're looking for the google.maps.Geocoder class:
A service for converting between an address and a LatLng.

Categories