Where In The World is Titty Ho?
You are making a web application that requires users to enter location in lng, lat. Your users don't usually know the correct location, are guessing, or worse, are flipping lng and lat, so a location in Wisconsin ends up being in Antarctica.
It would be nice to have a little widget like on the left. Type a place name in the text box, or alternatively, first, pan and zoom to your general area of interest to narrow the search to that area, and locate your place of interest. Go ahead… type Titty Ho in the text box above and find out for yourself.
Well, here is help. Add the following line in your application where you want the widget to appear:
Put line 1 with the div wherever you want in your web page. You can position it using CSS. Note the id of the div. Now, add the following lines to the bottom of the page, just above the
NOTE: The plugin is hard-coded to fire when 6 characters are typed in the search field. This works well mostly. You can still search for a place name shorter than 6 characters by typing a period '.'. For example, no query will be triggered for 'elgin', however, 'elgin**.**' will trigger a query.
Acknowledgment: This code utilizes a couple of excellent plugins modified for my use, namely the autocomplete plugin from Devbridge, and the tipsy plugin from Jason Frame.