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,
Related
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.
I'm trying to implement a Google Map.
Part one is centering the map to a specific address, which works quite nice.
My next problem is that I have to place a marker for a store on the map, based on a search on the store name. The marker should probably be connected to a search result in order to display a info bubble when clicked. How to get about and do this, I'm totally qlueless about.
Your steps seem ok to me, I assume that the search for store name goes to your server and you return some result with store names and addresses, then you look that up using Google Geocoding API and fetch the lat/lng coordinates and place the markers on the map, here are the steps that I would probably use:
Create a map
Center on a specific address
Search for a store
If the result has geocode associated with it then just use that to place a marker.
If the result does not have lat/lng then make a request to Google Geocoding API to get the lat/lng coordinates. After that place the marker, store the received geocode to your database (by using some background Ajax request).
The Google Geocoding API best practices suggest that you should store the geocodes so that you don't have to query each time to Google's servers. In order to do that you will need to modify your backend so that it also stores Geocode along with the store details, and in search result you can return the geocodes if available.
On a side note, you can use GMaps JavaScript library for easy map manipulation.
Update
The above solution works perfectly in your revised scenario. Let me rephrase the flow again:
The backend would return a list of stores when searched by a store name (this should be pretty easy I guess)
If results are not empty then loop through the list and see if all of them has a lat/lng value associated with.
If you do not find a lat/lng value for a record then make a Geocode request to Google's server passing the address of the store (you need to have at least the address of the store else you can't get the lat/lng value from Google) as a parameter. If the record has a lat/lng value then just go ahead and place a marker on the map.
Once you receive the response from Geocode API then go ahead and place a marker on the map using the maps library API as provided. For GMaps it is map.addMarker({...}).
Once all the the requests are complete then you can consider optimizing a bit which was suggested earlier where you can store the received geocodes in your own server, so that you don't have to fetch them again and again.
To implement the above steps you need to have familiarity with the Maps JS library as well as JavaScript and Ajax/JSONP. Remember that all your Geocode requests(JSONP I think) are asynchronous and you should invoke the marker placement code only when the response is available to you (typically inside a callback). The GMaps library examples are very easy and simple to start with. I hope this explanation should be enough to solve your problem and if it helps you then you can consider marking this an answer.
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.
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.
My client has a list of store locations. Now what he wants is to let users search for any of these locations, based on the address the user submitted. The search results will be based on the proximity of the locations.
So basically what I am looking for is Google Maps functionality, but based only on the set of (geographical) data I provide.
Do any of you know if this is even possible, and if so, what can be a good starting point to learn more about it?
Thanks in advance.
Sure it is possible. I guess you have in you database set of the latitude and longitude entries for each store. You can get users current location with geocoder and measure distance with distanceFrom call to find the nearest store.
You're welcome to copy the code directly from here, it does exactly what you request.
You'll need offices.htm, offices.js and logo.png.
To prepare your list of offices, you might find this Excel addin useful