To add a search bar

2,457 views
Skip to first unread message

Bready

unread,
Nov 22, 2011, 7:18:22 PM11/22/11
to Google Maps JavaScript API v3
I wonder if i can add a search bar on my own google map application.

Masashi.K

unread,
Nov 22, 2011, 8:59:59 PM11/22/11
to Google Maps JavaScript API v3

Lin Wan

unread,
Nov 23, 2011, 2:41:26 PM11/23/11
to google-map...@googlegroups.com
OMG Thats super useful man

Thank you very much!!!!!!

--
You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
To post to this group, send email to google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


Lin Wan

unread,
Nov 23, 2011, 6:43:43 PM11/23/11
to google-map...@googlegroups.com
Hey,

This method just scan through the library online, what if i want to scan through the kml i added onto the map.

On Tue, Nov 22, 2011 at 5:59 PM, Masashi.K <wf9a...@gmail.com> wrote:

xinyu...@126.com

unread,
Nov 23, 2011, 8:19:38 PM11/23/11
to Google Maps JavaScript API v3

Hi Masashi.K
We know we can make a custom control on the google maps,So how we can
put the search bar in the custom control?Do you have any idea?

On 11月23日, 上午9时59分, "Masashi.K" <wf9a5...@gmail.com> wrote:
> Hi.
>
> How about this example?http://code.google.com/apis/maps/documentation/javascript/examples/pl...
>
> http://code.google.com/apis/maps/documentation/javascript/places.html...

Masashi.K

unread,
Nov 27, 2011, 6:59:31 PM11/27/11
to Google Maps JavaScript API v3
It's easy like this:
----------------------------------
var input = document.getElementById('search');
mapCanvas.controls[google.maps.ControlPosition.TOP_LEFT].push(input);

var options = {
types: ['establishment']
};

var autocomplete = new google.maps.places.Autocomplete(input,
options);
google.maps.event.addListener(autocomplete, "place_changed", function()
{
var place = autocomplete.getPlace();
mapCanvas.panTo(place.geometry.location);
});

----------------------------------

Reply all
Reply to author
Forward
0 new messages