All Projects → bmoren → P5.geolocation

bmoren / P5.geolocation

Licence: lgpl-2.1
a geolocation and geofencing library for p5.js

Programming Languages

javascript
184084 projects - #8 most used programming language
p5js
31 projects

Projects that are alternatives of or similar to P5.geolocation

Coregpx
A library for parsing and creation of GPX location files. Purely Swift.
Stars: ✭ 132 (+76%)
Mutual labels:  gps, location, geolocation
Geolocation
Flutter geolocation plugin for Android and iOS.
Stars: ✭ 205 (+173.33%)
Mutual labels:  gps, location, geolocation
orange3-geo
🍊 🌍 Orange add-on for dealing with geography and geo-location
Stars: ✭ 22 (-70.67%)
Mutual labels:  gps, location, geolocation
kirby-locator
A simple map & geolocation field, built on top of open-source services and Mapbox. Kirby 3 only.
Stars: ✭ 83 (+10.67%)
Mutual labels:  location, geolocation
android-amap-track-collect
这阵子由于项目需要,需要从手机上采集用户的运动轨迹数据,这样的功能大家都见到的很多了,比如咕咚、悦动圈,对跑步运动轨迹数据进行采集,再如,微信运动、钉钉运动,对于每一天你走步进行计数,如果要记录轨迹就离不开的手机定位,如果要记录步数那就离不开陀螺仪(角速度传感器),花了一天多的时间实现了一个定位数据实时采集的功能。
Stars: ✭ 50 (-33.33%)
Mutual labels:  gps, location
simple-location
Adds Basic Location Support to Wordpress
Stars: ✭ 26 (-65.33%)
Mutual labels:  location, geolocation
gps-share
Utility to share your GPS device on local network
Stars: ✭ 49 (-34.67%)
Mutual labels:  gps, location
Rxgps
Finding current location cannot be easier on Android !
Stars: ✭ 307 (+309.33%)
Mutual labels:  gps, location
EasyWayLocation
This library contain all utils related to google location. like, getting lat or long, Address and Location Setting dialog, many more...
Stars: ✭ 142 (+89.33%)
Mutual labels:  gps, location
React Native Baidumap Sdk
React Native BaiduMap SDK for Android + iOS
Stars: ✭ 309 (+312%)
Mutual labels:  location, geolocation
Leku
🌍 Map location picker component for Android. Based on Google Maps. An alternative to Google Place Picker.
Stars: ✭ 612 (+716%)
Mutual labels:  location, geolocation
react-native-device-country
Get device location by telephony (SIM card) or settings without using GPS tracker.
Stars: ✭ 33 (-56%)
Mutual labels:  gps, location
discourse-locations
Tools for handling locations in Discourse
Stars: ✭ 31 (-58.67%)
Mutual labels:  location, geolocation
Indoorgps
Position Calculating with Trilateration via Bluetooth Beacons(Estimote)
Stars: ✭ 59 (-21.33%)
Mutual labels:  gps, location
telegram-nearby-map
Discover the location of nearby Telegram users 📡🌍
Stars: ✭ 329 (+338.67%)
Mutual labels:  gps, location
React Native Amap Geolocation
React Native geolocation module for Android + iOS
Stars: ✭ 289 (+285.33%)
Mutual labels:  location, geolocation
Googleapi
C# .NET Core Google Api (Maps, Places, Roads, Search, Translate). Supports all endpoints and requests / responses.
Stars: ✭ 346 (+361.33%)
Mutual labels:  location, geolocation
React Native Geolocation
Geolocation APIs for React Native
Stars: ✭ 640 (+753.33%)
Mutual labels:  location, geolocation
React Native Geolocation Service
React native geolocation service for iOS and android
Stars: ✭ 934 (+1145.33%)
Mutual labels:  location, geolocation
gpx-builder
Builder of GPX files
Stars: ✭ 25 (-66.67%)
Mutual labels:  gps, location

p5.geolocation

p5.geolocation

p5.geolocation provides techniques for acquiring, watching, calculating, and geofencing user locations for p5.js.

This activity is made possible by a research & planning grant from Forecast Public Art and the Jerome Foundation. Special thanks to Derek Anderson.

Useful Tips
License

p5.geolocaiton is licensed under the GNU LGPL 2.1.

p5.geolocation:

p5.geolocation examples


geoCheck()

geoCheck()

geoCheck() checks the availability of geolocation. Returns true if geolocation is available or false if geolocation is not available.

setup(){
	if(geoCheck() == true){
		//geolocation is available
	}else{
		//error getting geolocaion
	}
}

getCurrentPosition() used in preload()

getCurrentPosition(callback, errorCallback)

getCurrentPosition() can be used in preload() or with a callback (see below). When used in preload it will return an object containing position elements, latitude, longitude, altitude, etc..

var locationData;
function preload(){
    locationData =  getCurrentPosition();
}

function setup() {
    print(locationData.latitude)
    print(locationData.longitude)
    print(locationData.accuracy)
    print(locationData.altitude)
    print(locationData.altitudeAccuracy)
    print(locationData.heading)
    print(locationData.speed)
}

getCurrentPosition() used with a callback

getCurrentPosition(callback, errorCallback)

getCurrentPosition() can also be used with a callback. The callback fires once when the position data becomes available.

function setup(){
    getCurrentPosition(doThisOnLocation)
}

function doThisOnLocation(position){
    print("lat: " + position.latitude);
    print("long: " + position.longitude);
}

watchPosition() used with a callback

watchPosition(callback, errorCallback, options)

watchPosition() is very similar to getCurrentPosition(), except that it will fire it's callback each time the users position makes a noticable change. Takes an optional object containing options for accuracy, timeout and age.

//optional options for watchPosition()
//watchPosition(positionChanged, watchOptions)

// watchOptions = {
//   enableHighAccuracy: true,
//   timeout: 5000,
//   maximumAge: 0
// };

function setup(){
    watchPosition(positionChanged)
}

function positionChanged(position){
    print("lat: " + position.latitude);
    print("long: " + position.longitude);
}

clearWatch()

clearWatch()

clearWatch() cancels the watchPosition()

function mousePressed(){
	clearWatch();
	print("watchPosition() cleared")
}

intervalCurrentPosition() used with a callback

intervalCurrentPosition(callback, interval, errorCallback)

intervalCurrentPosition() is a hybrid of watchPosition() and getCurrentPosition(). It executes the getCurrentPosition() function on a interval in Milliseconds via an optional second parameter, default is 5000ms. This is useful when you need more nuanced changed location detection than watchPosition() can provide.

function setup(){
    intervalCurrentPosition(positionPing, 5000)
}

function positionPing(position){
    print("lat: " + position.latitude);
    print("long: " + position.longitude);
}

clearIntervalPos()

clearIntervalPos()

clearIntervalPos() cancels the intervalCurrentPosition()

function mousePressed(){
	clearIntervalPos();
	print("intervalCurrentPosition() cleared!")
}

calcGeoDistance()

calcGeoDistance(lat1, lon1, lat2, lon2, units)

calcGeoDistance() calculates the distance between two points in the provided units (default is 'mi', 'km' is also available).

var distance;
function setup(){
	distance = calcGeoDistance(46.785844, -92.015965, 44.940834, -93.311287, 'mi')
	print(distance);
}

geoFenceCircle()

geoFenceCircle(latitude, longitude, fenceDistance, insideCallback, outsideCallback, units, options)

geoFenceCircle() is class which creates a geoFenceCircle around the provided lat/long point with a provided radius in provided units('mi' is default). It will fire a callback with an object containing position data when the user is inside of the geoFenceCircle each time the location updates. It will fire a second callback each time the position updates and the user is outside of the geoFenceCircle. Takes an optional object containing options for accuracy, timeout and age.

var fence;
function setup(){

	//optional options object for geoFenceCircle
	//fence = new geoFenceCircle(44.979779, -93.325499, .05, insideTheFence, 'mi', fenceOptions)
    // fenceOptions = {
    //   enableHighAccuracy: false,
    //   timeout: 5000,
    //   maximumAge: 0
    // };

    fence = new geoFenceCircle(44.979779, -93.325499, 0.05, insideTheFence, outsideTheFence, 'mi')
}

function insideTheFence(position){
    print("INlat: " + position.latitude);
    print("INlong: " + position.longitude);
    print("user is inside of the fence")
}

function outsideTheFence(position){
    print("OUTlat: " + position.latitude);
    print("OUTlong: " + position.longitude);
    print("user is outside of the fence")
}

geoFenceCircle can be cleared using .clear()

var fence;
function setup(){
    fence = new geoFenceCircle(44.979779, -93.325499, 0.05, insideTheFence, outsideTheFence, 'mi')
}

function mousePressed(){
	fence.clear();
}

geoFenceCircle() insideFence boolean

geoFenceCircle(latitude, longitude, fenceDistance, insideCallback, outsideCallback, units, options)

geoFenceCircle has a useful parameter for checking the fence status. .insideFence when called on your geoFenceCircle object will return true or false depending on the users relationship to the fence.

var fence;
function setup(){
 	fence = new geoFenceCircle(44.979779, -93.325499, 0.05)
}

function draw(){
	print(fence.insideFence);
}

geoFencePolygon()

geoFencePolygon(ArrayOfObjectsWithLatLong, insideCallback, outsideCallback, units, options)

geoFencePolygon() is class which creates a geoFencePolygon around the provided array of object that contain lat/long points. It will fire a callback with an object containing position data when the user is inside of the geoFencePolygon each time the location updates. It will fire a second callback each time the position updates and the user is outside of the geoFencePolygon. Takes an optional object containing options for accuracy, timeout and age.

** Things to note about order of lat long points in polygon array. The order of the points are very important. They should be entered in the order you would you would draw them. Think about it like a connect the dots drawing, you need to start with a specific point and end with a specific point if you want the polygon to be correct. *** Even though the example only has 4 points you can have as many as you would like.

var fence;
var polygon = [
    {lat: 34.045303, lon: -118.334650},  // top left  
    {lat: 34.045252, lon: -118.334462},  // top right
    {lat: 34.045131, lon: -118.334498},  // bottom right
    {lat: 34.045185, lon: -118.334684},  // bottom left
];
function setup(){

    //optional options object for geoFencegeoFencePolygon
    //fence = new geoFenceCircle(polygon, insideTheFence, 'mi', fenceOptions)
    // fenceOptions = {
    //   enableHighAccuracy: false,
    //   timeout: 5000,
    //   maximumAge: 0
    // };

    fence = new geoFencePolygon(polygon, insideTheFence, outsideTheFence, 'mi')
}

function insideTheFence(position){
    print("INlat: " + position.latitude);
    print("INlong: " + position.longitude);
    print("user is inside of the fence")
}

function outsideTheFence(position){
    print("OUTlat: " + position.latitude);
    print("OUTlong: " + position.longitude);
    print("user is outside of the fence")
}

geoFencePolygon can be cleared using .clear()

var fence;
function setup(){
    fence = new geoFenceCircle(44.979779, -93.325499, 0.05, insideTheFence, outsideTheFence, 'mi')
}

function mousePressed(){
	fence.clear();
}

geoFencePolygon() insideFence boolean

geoFencePolygon(ArrayOfObjectsWithLatLong, insideCallback, outsideCallback, units, options)

geoFencePolygon also has a useful parameter for checking the fence status. .insideFence when called on your geoFencePolygon object will return true or false depending on the users relationship to the fence.

var fence;
var polygon = [
    {lat: 34.045303, lon: -118.334650},  // top left  
    {lat: 34.045252, lon: -118.334462},  // top right
    {lat: 34.045131, lon: -118.334498},  // bottom right
    {lat: 34.045185, lon: -118.334684},  // bottom left
];
function setup(){
    fence = new geoFencePolygon(polygon)
}

function draw(){
    print(fence.insideFence);
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].