Skip to content

dansingerman/jQuery-Geo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 

Repository files navigation

This is a simple jQuery plugin to encapsulate a bunch of geolocation functionality.

Usage

1 - Locate user

$.geo("locate", successFunction, failureFunction);

e.g.

$.geo("locate",function(position){
  // returns object of type Position
  // see http://dev.w3.org/geo/api/spec-source.html#position_interface
  $("#result").html("your location is " + position.coords.latitude + ", " + position.coords.longitude);
},
function(error, message){
  // returns error object of type PositionError
  // see http://dev.w3.org/geo/api/spec-source.html#position_error_interface
  // and human readable message in text
  $("#result").html(message);
});

2 - Measure distance between two locations (in metres)

$.geo("distance", lat1 , lon1 , lat2 , lon2 );

e.g.

var distance = $.geo("distance", 40.748383 , -73.98555 , 40.782374 , -73.96553 );

About

A bunch of GeoStuff wrapped in a jQuery plugin

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published