# Geofence resolution

**URL:** https://discourse.nodered.org/t/geofence-resolution/45748
**Category:** General
**Created:** [17 May 2021 03:51 UTC](https://discourse.nodered.org/t/geofence-resolution/45748 "2021-05-17T03:51:19Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)
#### Post date: [17 May 2021 03:51 UTC](https://discourse.nodered.org/t/geofence-resolution/45748/1 "2021-05-17T03:51:19Z")

</div>

I don't see a resolution number stated for the built-in geofence node but it seems to be too large. I'm trying to use a polygon around my home that includes all the area from which I can see what's happening there but it always reports "inarea: false". If I instead use a circle it has to be about 1/4 mile in diameter to report "inarea: true" and that is useless to me. Is there a way to control/adjust the resolution?

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [17 May 2021 05:45 UTC](https://discourse.nodered.org/t/geofence-resolution/45748/2 "2021-05-17T05:45:04Z")

</div>

Which "built-in geofence node" ? Where do you see this ?

---

<div class="post-metadata">

### Author: ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)
#### Post date: [17 May 2021 11:54 UTC](https://discourse.nodered.org/t/geofence-resolution/45748/3 "2021-05-17T11:54:11Z")

</div>

> [@bakman2](#):
>
> Which "built-in geofence node"

node-red-node-geofence

Sorry, since it doesn't have "contrib" in the name I thought it meant it's part of the standard set of nodes.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [17 May 2021 14:35 UTC](https://discourse.nodered.org/t/geofence-resolution/45748/4 "2021-05-17T14:35:16Z")

</div>

Well it uses the [geolib - npm (npmjs.com)](https://www.npmjs.com/package/geolib) library. So apart from understanding how many decimal places you've used on your inputs, you should note the estimations that it uses for calculations.

If you are feeding data from a mobile device, it is likely that the device is not giving the level of accuracy that you were expecting. For example, mobile phones will have greatly varying accuracy and will usually have lowered accuracy in rain, forests, indoors and urban areas (because the GPS signals are really low and easily blocked). In urban areas, accuracy can often be greatly increased by allowing access to WiFi.

---

<div class="post-metadata">

### Author: ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)
#### Post date: [17 May 2021 17:32 UTC](https://discourse.nodered.org/t/geofence-resolution/45748/5 "2021-05-17T17:32:25Z")

</div>

Thank you for providing a link to geolib. The documentation says by default the accuracy is 1 meter so I don't understand why I'm having this issue. I'll dig through the node source and see if overrides the default.

> [@TotallyInformation](#):
>
> how many decimal places you've used on your inputs

7

> [@TotallyInformation](#):
>
> feeding data from a mobile device

Yes, I have the OwnTracks app on my phone which has "Regions" and it is accurate to a few meters with that. I have a region for Home that has a radius of 50m and it works well. The region in OwnTracks has to be a circle and I want it to be a polygon and that is the reason I want to do the presence determination in NR.

---

<div class="post-metadata">

### Author: ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)
#### Post date: [17 May 2021 17:40 UTC](https://discourse.nodered.org/t/geofence-resolution/45748/6 "2021-05-17T17:40:50Z")

</div>

> [@LosinIt](#):
>
> I'll dig through the node source and see if overrides the default.

It does not so I'm at a loss to explain what I'm seeing.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [17 May 2021 18:53 UTC](https://discourse.nodered.org/t/geofence-resolution/45748/7 "2021-05-17T18:53:29Z")

</div>

> [@LosinIt](#):
>
> I have a region for Home that has a radius of 50m and it works well.

I've always found that anything less than 100m for geofences around my house to be very unreliable. But it very much depends on where you are and the devices you are using. I just checked on Apple "Find My" and it took a couple of minutes for it to get more accurate than 10m and at least a minute to get better than 50 and I've not left the house in the last 7 hours. A check of my Android device shows that my Google timeline registered the 1.5mi trip I did earlier but it only captured 5 points on that route, it got the start and end fairly accurate (within 10-20m) and the intermediate points were on the right roads but that is still a fair distance between points. The point I'm making is that there is a lot of variance between devices and applications, especially when on battery power.

> [@LosinIt](#):
>
> I want it to be a polygon

I have a suspicion that isn't helping either. Since position coordinates are never 100% accurate, they always describe a region of uncertainty, having a relatively small polygon defining the outline almost certainly results in larger errors.

---

<div class="post-metadata">

### Author: ![LosinIt](https://avatars.discourse-cdn.com/v4/letter/l/439d5e/32.png) [@LosinIt](https://discourse.nodered.org/u/LosinIt)
#### Post date: [17 May 2021 23:28 UTC](https://discourse.nodered.org/t/geofence-resolution/45748/8 "2021-05-17T23:28:34Z")

</div>

> [@TotallyInformation](#):
>
> I've always found that anything less than 100m for geofences around my house to be very unreliable. But it very much depends on where you are and the devices you are using. I just checked on Apple "Find My" and it took a couple of minutes for it to get more accurate than 10m and at least a minute to get better than 50 and I've not left the house in the last 7 hours. A check of my Android device shows that my Google timeline registered the 1.5mi trip I did earlier but it only captured 5 points on that route, it got the start and end fairly accurate (within 10-20m) and the intermediate points were on the right roads but that is still a fair distance between points. The point I'm making is that there is a lot of variance between devices and applications, especially when on battery power.

I appreciate that but I encourage you to checkout OT's options which provide a range of granularity.  
[https://owntracks.org/booklet/features/location/](https://owntracks.org/booklet/features/location/)

> [@TotallyInformation](#):
>
> I have a suspicion that isn't helping either.

The more I look at it the more I agree with you. For the time being I've abandoned the NR solution and I've gone back to letting OT decide when I'm in a region.

Thanks for the discussion! 🙂

---

<div class="post-metadata">

### Author: ![Nathanli](https://avatars.discourse-cdn.com/v4/letter/n/cab0a1/32.png) [@Nathanli](https://discourse.nodered.org/u/Nathanli)
#### Post date: [18 May 2021 02:45 UTC](https://discourse.nodered.org/t/geofence-resolution/45748/9 "2021-05-18T02:45:32Z")

</div>

Thank you for providing a link to geolib.

---

<div class="post-metadata">

### Author: ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)
#### Post date: [18 May 2021 07:26 UTC](https://discourse.nodered.org/t/geofence-resolution/45748/10 "2021-05-18T07:26:20Z")

</div>

It doesn't have `contrib` in the name because it was written before that convention was decided on, it was effectively the first 3rd (well more like 2.5th) party node.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [17 July 2021 07:26 UTC](https://discourse.nodered.org/t/geofence-resolution/45748/11 "2021-07-17T07:26:24Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
