-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trigger readings only upon geolocation change instead of time interval #13
Comments
A question that just arose: is a similar configuration for I can imagine for certain use cases one isn't interested in |
fyi @anssiko |
I believe most geolocation use cases would be served with a one threshold (expressed in meters). When a change exceeding the defined threshold is observed in latitude, longitude, (or altitude?) compared to the previous reading, a new reading is be triggered. @martijnthe would that satisfy the requirements you have in mind? I think use cases that involve tracking heading changes would be better served by the Orientation Sensor. I'd like us to understand the use cases better to make an informed design decision. |
Right, I agree. But the
Right. I think the total delta in meters is probably most interesting in our use case. (So not a separate threshold for latitude, longitude, or altitude -- or would you? Perhaps for aviation use cases...?) |
Correct. I was thinking we might want to default to a similar (but not the same) behavior as in the legacy Geolocation API, allow passing If no
I think the legacy spec's new position differs significantly from the previous position definition has led to not so great interoperability across implementations since it does not explicitly define threshold (only an abstract high accuracy flag). We want to learn from the earlier API and make improvements both in terms of developer ergonomics and interoperability. Suggestions welcome!
Based on the use cases I'm aware of single threshold that applies globally across latitude, longitude, and altitude would be a good tradeoff. Let me know if you have use cases in mind that'd warrant more detailed control over thresholds, or if you have other ideas. |
We need to take into account accuracy with this. Obviously a lot of this depends on use-case, and if you are doing big-distance geofencing-style applications, this all makes sense (e.g., my threshold is > 100m). But, if someone wants a threshold of, say, 10m, in many cases the relative error associated with the location estimate (especially inside) will exceed this. I'm not sure how to express this. |
I would like to understand from an implementor, e.g., @reillyeon, how A common initial pattern is to What I am unclear about is then how the watch loop continues, especially if the developer specifies an unreasonably high update frequency (I would expect, for example, that the user agent may decide to autonomously limit the frequency if the battery is low). Eventually, this seems to mostly touch upon things that would need to be discussed in the context of #22. We might be able to merge this issue into #22. |
@tomayac Note that as mentioned in #21 the polling occurs very differently depending on whether we are using a true GPS receiver or Wi-Fi triangulation. The former is a push-based model where the GPS receiver typically produces a new result at a fixed frequency once a lock has been established. The latter is a pull-based model where the device must decide when it believes that it has moved sufficiently to request a new location estimate from a network service based on Wi-Fi beacons it has received. The true GPS receiver will produce frequent updates after a long initial delay whereas the network service can be queried very quickly after performing a Wi-Fi scan but further requests are rate-limited to avoid exhausting API quota and so updates will be infrequent. In addition there are hybrid models which will produce a course result very quickly (using cell tower location or Wi-Fi triangulation) that is then refined using GPS once a lock has been established. |
Adding to this: on AR/VR devices with precision motion tracking (e.g., handhelds running ARKit/ARCore, or HMDs like Hololens or Magic Leap), either sort of geolocation estimation can be combined with the motion tracking to produce high frequency updates relative to a geolocation estimate. We are doing a simple proof of concept of this; one thing I've wondered, though, is if the estimation (esp wifi, since so much of GPS is done in hardware) could be improved over time if a precise relative local motion was added in to constrain the results. |
@blairmacintyre Some (native) implementations are using motion co-processors ("fitness sensors") for this, see, for example, Flutter background Geolocation for details. |
The Flutter approach doesn't actually improve geolocation, it just optimizes battery life. Which is a Very Good Thing[tm] but not the same. |
We have a tracking website that is used by many different kinds of businesses. From police, ambulances with dedicated GPS equipment to a single driver with a phone. |
Apperently this is the main reason why this will (hopefully) never come like this. |
The power consumption will not be any lower when you do the filtering logic in JS code. The GPS has to be active for this anyway. Does not matter which piece of software does the filtering. |
Consider merging this issue into #25. |
The core question here is at what level the filtering "do I have a 'new' position?" should be done. I looked at Chrome data for |
I've just been looking at implementing a generic app to workaround that this isn't possible in the browser ATM. I think it would be good to have options like those of @nativescript/geolocation. My use cases are position tracking during surveys (eg litter surveys) and position tracking of responders/first-aiders during events. Having played with watchPosition, this was the logic I implemented in the code. Having the option to pass these options the the sensor constructor would mean the logic could be implemented at a lower level (it must already be implemented[ish] if it is in NativeScript) to save power. |
Is it correct that the current design will trigger reading events at a fixed time interval / frequency?
I can see this is useful for use cases that involve continuous visualization of the current location.
However, in our use case, it would be more useful to be able to configure the instance to only trigger when a certain geolocation delta (distance) has been crossed, compared to the last reading. In other words: "only give me reading events for those locations that compared to the previously emitted reading changed by at least X meters".
We could do this filtering logic in the JS code on top of the time frequency based triggering, but this is less desirable from a power consumption point of view.
The text was updated successfully, but these errors were encountered: