Comments (5)
Reminder that EY is running 0.3.79
from gw.
yes, I know. 0.3.79 was based on choral's distance calculation. Found the problem. Will be test driving later.
from gw.
I was thinking we could do this really nicely, and add distance between two measurements as well as total travelled distance, if you feel like it.
From the dataset I handed you earlier, these are two 't' points taken near Kassel this morning:
{"_type":"location","t":"t","lon":"9.502427","lat":"51.240769","vel":"134.620028"}
{"_type":"location","t":"t","lon":"9.48138","lat":"51.226019","vel":"129.940024"}
According to this page I covered a distance of 2199 meters (see screenshot)
Using a haversine formula, I get the result: 2.19802314367 km
which is close enough.
#!/usr/bin/env python
# from http://stackoverflow.com/questions/4913349/
from math import radians, cos, sin, asin, sqrt
def haversine(lon1, lat1, lon2, lat2):
"""
Calculate the great circle distance between two points
on the earth (specified in decimal degrees)
"""
# convert decimal degrees to radians
lon1, lat1, lon2, lat2 = map(radians, [lon1, lat1, lon2, lat2])
# haversine formula
dlon = lon2 - lon1
dlat = lat2 - lat1
a = sin(dlat/2)**2 + cos(lat1) * cos(lat2) * sin(dlon/2)**2
c = 2 * asin(sqrt(a))
# 6367 km is the radius of the Earth
km = 6367 * c
return km
lon1 = 9.502427
lat1 = 51.240769
lon2 = 9.48138
lat2 = 51.226019
distance = haversine(lon1, lat1, lon2, lat2)
print distance, " km"
We could add something like this to the JSON payload:
{ "mov" : "2198", "dist" : <total since reboot> }
from gw.
The problem is not the haversine calculation (although there is no arcsin in javame), but the elimination of movements while stationary, e.g. my gw sitting on my desk moved 23 km in 3 hours.
Will do
{ "dist" : "<distance since last location published>", "trip" : "<incremental distance since reboot>" }
and treat both as optional fields.
from gw.
solved using the correct haversine formula and calculation between GPS messages / mqtt messages.
from gw.
Related Issues (20)
- Seems to hangup when queue gets full HOT 3
- Restart when no connection possible HOT 1
- Restart App if GPRS, MQTT or FIX times out
- Persist last location to calculate trip distance to first fix
- Log triggers before performing reboot
- A message may get lost when gw looses connection to broker HOT 1
- NullPointerException - MQTTHandler problem or $reconnect artefact? HOT 2
- Implement persistent trip counter HOT 1
- change defaults
- Omit login via MQTT? HOT 1
- Disconnect cleanly on $upgrade and $reboot HOT 1
- Multiple versionchecks being performed HOT 4
- GPIO3 fires without reason HOT 2
- RecordStore operations very slow - sometimes HOT 3
- Avoid versioncheck on low battery? HOT 1
- Reduce CSV payload size by using Mapcode HOT 5
- offUntil must cause device to go silent HOT 6
- Is offUntil preventing setting date? HOT 3
- Possible overflow in trip HOT 1
- $log del does not delete log file HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gw.