Please give me feedback via @rakugojon

jQGeoSearch

Info

This jQuery plugin provides an easy way to add geo search elements to your site. Simply type a postcode, address, city name, anything in the box below. If there are more than one matches you'll be able to hand pick the correct one. When paired with a proxy server you can make requests to multiple sources. For demo purposes as this server doesn't have a proxy nominatim is used.

Download

Demo

Type a city name:

Sample Code

		$("#test").geoSearch({
			service: "nominatim",
			handler: function(r) {
				alert("lat: " + r.lngLat.lat + " lng: " + r.lngLat.lng + " ("+ r.humanReadable + ")");
			}
		});
	

Options

handler
function
This function defines what should be run on retrieving the longitude and latitude. The function takes one parameter which is the object returned by the service. In all objects no matter what the service, the values lngLat and humanReadable keys are available.
sample code:
				function(r) {
					var lng = r.lngLat.lat;
					var lat = r.lngLat.lng;
					var name = r.humanReadable;
					// do something
				}
			
service
string (google, opengeocoding, openaddresses or nominatim)
name of the service to use for looking up longitude and latitude
proxy
string (url)
address of proxy server to send uri parameter to
method
string
method to use when addressing the proxy server
data
object
additional parameters to send to the proxy server
useTopResult
boolean
if this is set to true, on obtaining multiple results the first result will be chosen
dataType
string
jsonp or json

Developers

add services

It's made to work with multiple services defined in
$._geoSearch.service
Adding this dictionary allows you to add a new service.