Restrict Search Scope with Search Widget/Geocoder - javascript

I've implemented an autocomplete searchbox on the map via the Geocoder. It's working fine. However, I would want to limit the returned results via the Geocoder to city limits.
For example: When a user types in "305 Quincy St", I want it to search for this address only within a city, let's say Florida.
At present, it is looking for this address from all around the world.
Can this be done?
Is it possible to make the autocomplete widget search within a
boundary extent on the map?
The closest I've come across is using the sourceCountry option of the Geocoder options and set it to USA. But it would be awesome if there was a way to have a sourceCity too.

Yes, you have a searchExtent parameter that can be used like this:
searchExtent=-104,35.6,-94.32,41
More info about searchExtent parameter

Related

Make infoWindow like Google map's default infoWindow that shows info from Google Places

We have a Google Local profile (or Google Places) for our business and we have added multiple locations for each store. The requirement is to embed a map in each store page of our website with the accurate location of the store and to display an infoWindow just like it's been displayed from Google's map. Example below:
I have read the API's documentation but I can't seem to find a clear answer as to the way of referencing a store that already exists in the map. If I add the address of the store, I usually have a 2nd marker that is not on the exact location of the store. Example below:
If I add longitude and latitude I get 2 markers again (one on top of the other) but then again these markers do not relate to each other as they have different infoWindows. And one major issue is that by using the Places API I can't get the info just like Google does (I get undefined). Example:
Questions:
How can I really relate (or reference) to the store's location and the Google's Place location and have just one marker with the Google's info in it?
How can I reference to a specific store based on Google's Place profile, which has a business with multiple store locations and link it to the "Store" marker that already exists in the map?
Attempts:
I tried locating the store based on PlacesService and nearbySearch with a keyword of the store name. Example here. The problem is that I have 2 markers on the map if I zoom in at maximum level.
One more issue is that I have 81 stores and it's hard to hard-code the coordinates for each store in each webpage. So, since I have the address in each page I tried geocoding to get longlat. This wasn't very accurate way because it seems that geocode snaps to a nearby area and not exactly on the store. Example here.
I tried PlacesService with the reference string for identifying the store's location based on Google's Place profile. Example here. However, there's not an easy way to retrieve the reference string for each store and another issue is that I need hardcoded coordinates to center the map in the area of the store (too much work for 81 stores).
Expected solutions/suggestions:
I would like to fully utilize our Google's Places profile that includes all the stores info. BTW, each store now has a Google+ page created automatically by Google. I would like a suggestion on how to utilize the automatically created Store marker (like in 1st picture) and have the exact same infoWindow like Google's default (1st picture) with some sort of a reference ID from our Google's Places profile.
I apologize for this long question but I had to further explain all my attempts.

Any Javascript API for maps with country-specific display?

Is there any Javascript API that does not display the entire world map and later allows to zoom and click to individual countries, but instead just displays the country we are interested and allows region-level clicks? In other words, I am looking for an API similar to JVectorMap but this does not have comprehensive support for all countries and it does not show street-level view when zooming further deep into state/city level. I hope my requirements are clear. If I am interested only in let's say England's map, I want the map to show just England but allow state and city-level clicks with street-level or near street-level views at the lowest level as an optional feature (not too many details at the lowest-level). Google Maps, jHERE etc. seem to show the entire world map and allow to zoom-in, which is not something I want.
thanks,
Paddy
If you only want the street maps for one country to be visible, you could download the Open Street Map data into a PostGIS database for that country and that country only, and generate tiles. There are several tutorials on how to download data and make tiles, e.g. http://switch2osm.org/serving-tiles/manually-building-a-tile-server/

Implementing googlemaps in asp.net

I need to solution for this.
I have a textbox(id="location") in which a city is entered, which need to be shown on the map, then the user should be able to place markers on the location of his wish(specific place within the entered city) and that location(Longitude and Latitude) should be shown in a label(id="showselected").
Is there any easy way to accomplish this, I don't want to learn the google API. Its for my school project.
Thanks

postcode and kilometer on google map

I am new to working with google maps. I want to display a map when the user enters a post code and then selects "km". The map should display shops in the selected area, within a kilometer. How can I do this?
See this example.
If you select option 2 from the radio buttons, I want the same behavior. First post code and then select kilometer then search in Google Maps.
I would recommend using the Places API. First, you could use the autocomplete widget with the geocode option on.
And then you could use the places search widget with the location parameter being the result of the autocomplete, and the radius being the number of meters you're interested in having results for.

How to prompt user for place using Google Maps in javascript?

I am new to Google Maps and still new to Javascript. I need to have a user select a location on a map (using Google Map) and retrieve the corresponding town, country, latitude and longitude. If timezone is available too, that would be great.
I can't find an operational code example. Does anyone have one to share? Thanks.
The sample code provided by Google at http://code.google.com/apis/maps/documentation/javascript/examples/event-arguments.html gets a LatLng from a mouse click and puts a marker on a map. (Just view the source code to see the sample code.)
The sample code provided by Google at http://code.google.com/apis/maps/documentation/javascript/examples/geocoding-reverse.html takes a latitude and longitude and determines the location via reverse geocoding. (Again, view source code to see the sample.)
Sounds like your functionality is basically parts of each of those samples and fusing them.
You might want to check out the Events documentation and the Reverse Geocoding documentation if you run into any problems (or even if you don't).

Categories

Resources