Google Maps Search: Center map on search results markers - google-maps

I have a Google Map (v3) setup with search functionality to search a Fusion Table. The search works fine, but I need for the map to center on the search results marker(s). I have a large field of markers and would like for the user to see all of the search results in one screen.
Thank you!

Use the Fusion Tables v1.0 API or GViz to query the table. Add all the locations to a google.maps.LatLngBounds object (with extend). Call the .fitBounds method of your map object on the resulting bounds. Need more information to give more details than that.
Examples querying tables with various data formats on geocodezip.com

Related

Free geocode API allowing store names and coordinates

My application should allow users to store events and their locations and then perform search on them - so I need those locations in my database with their names and latitudes/longitudes. Google API doesnt allow storing anything else but place IDs so I have to find something else that can autocomplete/suggest places on UI and allow storing it my database.
Does anyone know such a good service?
You can simply add your points in your DB based on each point Lat & Long values. So when user is searching somewhere you have his current location(Lat-Long), Therefore you can search in your DB and get the distance of each saved point with current location and retrieve the results you want to show (i.e in JSON format).
In client-side use some auto-complete jquery library to show the nearby places and somethings like that (with additional information).
Google Map API has a service that you can show some custom marker on the map with your custom configuration like marker icon, description and etc. You can show your additional information in description as HTML format.
You can see some example here:
Customizing a Google Map: Custom Markers
Hope these tips would be helpfull. Regards.
Suddenly I've found an answer that helps me:
https://productforums.google.com/forum/#!topic/maps/hNc1OOU6Zm8
So I can use some Google's data under some conditions.

Real-Time update of markers in google maps?

thats my scenario: I want to load a list of places of interest of a user based on his location (using HTML5 geolocation). But the problem is, I have a very big list of places (I don't want to have to load all places from my database), so the solution I have adopted until now is only to call mysql for the results in a given radius from the user, let's say, 1 km. But I'd like when user is dragging google maps to explore the map, load progressively the places for the area is shown on the map (basically something similar to what foursquare does).
Is there any simple way to achieve that? Hope I was clear with the question, thanks in advance, any help is appreciated.
Jesús.
General approach:
get the bounds of the map and query your data base for markers that are currently in view
optional, add padding to the bounds so some markers are available just out of view if the map is dragged
display the resulting markers
when the map is moved (bounds_changed event), query your database for additional markers
process through the returned markers, only adding those that are new (requires an array of existing markers and a way to determine that the existing marker and a newly downloaded marker are the same)
Searching the Google Maps API v3 group (and the Google Maps API v2 group, the concepts will apply but the code samples may not) should give you some examples.

Google map search using KML

i am using google map kml field (direct iframe code from gmap)
for showing different locations/shops on map:
Google map #my site,
i need to add a search box from where user can search nearest shops to his/her location...
can any body help me in this out..
It is my understanding that the API does not provide support for searching your provided KML:
google maps API geocode finds nearby KML
Google provides a service called placesService ( https://developers.google.com/maps/documentation/javascript/places ) which lets you make requests to their database of content and return results in the form of KML near a location within some bounded area - but to my knowledge you cannot specify the source to search. (You could try testing the placesService, with a KML layer set on your map and see if it includes your data).
Assuming you are generating your KML from a database, can you could regenerate it appropriately filtered or styled based on the user's search terms. This seems the most likely solution without additional details.
I have done google map search with python. But this one searches hospitals
You need to get google place api and place in code and reconfigure for search,
it will print out name, location address, and website
https://github.com/rockcastle/GoogleMap-Scrapping

Googlemaps search with mongodb geospatial best strategy

I have a website where people can view some places on a google map, which are stored with a lat/lng coordinate. The storage is mongodb. Now when the user navigates the map, I need to lookup up which places now are in the visible part of the map.
I'm new to mongo, but have looked at the spatial part. My question is now an effective way to do this lookup.
Do I need to make a ensureIndex each time the user navigates the map, and how do I then query all places within the visible boundaries of the map?
According to the mongo docs, you can query within a bounding box like so
box = [[40.73083, -73.99756], [40.741404, -73.988135]]
db.places.find({"loc" : {"$within" : {"$box" : box}}})
The key point here is the use of within to query within a bounding box.
In order to get the values for your box, just get the bounds of the google map like so
map.getBounds()
Where map is your google maps object. getBounds will return a LatLngBounds object from which you can build your box to query mongo.
As for ensureIndex, you should do that once as far as I know.

Google Maps Store Locator Search field for embedded map

I've embedded a map on a clients site, with their various store locations, using the google saved maps technique: http://passportal.com.au/stockists So basically I don't want store the marker locations in a database, I'm just interested in using the marker positions on the saved map as seen in this demo: http://maps.google.com/help/maps/getmaps/plot-multi.html
I've seen it on plenty of sites and am wondering if there is an easy way to add a search field to find the closest marker to the users address. Something like this: http://www.victoriantextiles.com.au/store-locator
The closest I could find was a google gadget that allows you to type in directions: http://www.google.com/ig/directory?synd=open&hl=en&gl=en&url=http://igwidgets.com/lig/gw/f/islk/89/slkm/ik/s/1329844/87/charles447/google-maps-driving-directions.xml
Any help would be great, thanks!
For this purpose, I use Google Maps API Distance Matrix where I would pass in one origin - user's location and multiple destinations - our dealers. Then I sort the results by distance and take 3 closest to display in a list. Works pretty fast, however, I don't know how you'd achieve this without having some sort of database of your store addresses.