Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

[OTish] how to determine if a gps location is within a set of points

42 views
Skip to first unread message

George Gallen

unread,
Jun 21, 2024, 8:34:36 AM6/21/24
to mvd...@googlegroups.com
I’m looking to create a gps zone which isn’t symmetrical. Thought was to have pairs of points for each lateral and longitudinal edges - the more the greater the resolution. Then if the location is between all closest pairs that would be the location source - that owns those pairs. Other thoughts? Database would contain pairs and locationid - sort to pull pairs closest to gps location. I’m not looking so much for the math - just ideas on determining if inside a zone and which zone

Wols Lists

unread,
Jun 21, 2024, 11:03:38 AM6/21/24
to mvd...@googlegroups.com
On 21/06/2024 13:34, George Gallen wrote:
> I’m looking to create a gps zone which isn’t symmetrical. Thought was to have pairs of points for each lateral and longitudinal edges - the more the greater the resolution. Then if the location is between all closest pairs that would be the location source - that owns those pairs. Other thoughts? Database would contain pairs and locationid - sort to pull pairs closest to gps location. I’m not looking so much for the math - just ideas on determining if inside a zone and which zone
>
The way you word that sounds like you'll duplicate points. Are you
defining individual edges (which duplicates stuff) or are you defining
the points, and letting the edges "appear".

What I'd do is just have a list of points that define your shape, so we
have a multivalue field "Northing" and another "Easting" (the
small-scale map equivalent of lat/long). Rather than wrap around, you
just define the "closure" as the first and last points need to be identical.

Next step - does your point lie inside the box? Each zone has fields
MIN(Easting), MAX(Easting), MIN(Northing), MAX(Northing) and any
box-zones that don't match the point are discarded straight away.

Now this is the point at which you'll have to do some work as this
describes the technique but you'll have to work out the detail:

Loop through all the points, and ask "does this segment lie on the same
Easting or Northing as my point?". If it lies on the same Easting, ask
whether your point lies East or West. If it's the same Northing, ask if
it's North or South, and count it.

It's something to do with whether the count is odd or even, tells you
whether your point lies inside or out. If both Northings and Eastings
say "inside" then it's inside. If either or both say outside then it's
outside. I think all four counts need to be odd, but you need to check
that for yourself.

Cheers,
Wol

George Gallen

unread,
Jun 21, 2024, 11:50:36 AM6/21/24
to mvd...@googlegroups.com
what I want to do is have defined zones with points to outline the area along it's edges.  Enough points to give a general
shape to the zone.  There can be several zones (miles apart but may be less at times (hundreds of feet)) 
- I don't envision more than 50-100 zones.

initially I would take the current gps position - and have it cycle through each point (lat,long) and determine
distance from each point - choosing the closest point to give an idea which zone is closest.

Then scan through each point of that zone to see if it's contained within that zone.

initially, just determining zone location could be anywhere within 200 feet for accuracy

zones could be circular, square or rhomboid
if the gps is within the zone - for square/circles no issue - it should be between each of all points
but for the rhomboid (think like the shape of california) the bottom is more east than the top so I dont think
    the gps would be between all points in that zone - so was only going to check if it's between the points
    in that zone that are within 200 feet.

Any other ideas? the math isn't the issue.

this is to map out walking trails - and have a utility that when accessed will be able to determine which path
the user is on - and then adjust any data collection that might be unique to that trail.

so - i'm not looking for any packages - just a learning project - to futz around with working with GPS as
I can think of a few of our applications that could be enhanced with GPS abilities.



From: mvd...@googlegroups.com <mvd...@googlegroups.com> on behalf of Wols Lists <antl...@youngman.org.uk>
Sent: Friday, June 21, 2024 11:03 AM
To: mvd...@googlegroups.com <mvd...@googlegroups.com>
Subject: Re: [mvdbms] [OTish] how to determine if a gps location is within a set of points
 

Jim Idle

unread,
Jun 21, 2024, 4:18:13 PM6/21/24
to mvd...@googlegroups.com
You just want to implement Jordan Curve Theorem. It is easy and you don't need to know the math. 

-- 
You received this message because you are subscribed to
the "Pick and MultiValue Databases" group.
To post, email to: mvd...@googlegroups.com
To unsubscribe, email to: mvdbms+un...@googlegroups.com
For more options, visit http://groups.google.com/group/mvdbms
--- 
You received this message because you are subscribed to the Google Groups "Pick and MultiValue Databases" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mvdbms+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mvdbms/SJ2PR11MB76487E45EA38A1B56D2BE505FAC92%40SJ2PR11MB7648.namprd11.prod.outlook.com.

Wol

unread,
Jun 21, 2024, 5:29:50 PM6/21/24
to mvd...@googlegroups.com
On 21/06/2024 16:50, George Gallen wrote:
> initially I would take the current gps position - and have it cycle
> through each point (lat,long) and determine
> distance from each point - choosing the closest point to give an idea
> which zone is closest.
>
> Then scan through each point of that zone to see if it's contained
> within that zone.

If it's a learning project, that's still not a good excuse for doing far
more work than necessary, using a method that could give you the wrong
answer ... :-)

Using min/max lat/long will take four comparisons per zone to give you a
definite negative. All being well, you'll then have just the one zone of
interest (or even none). And the more accurately you define your zone,
your method means more work. Min/Max will be the same whether you use
four points for a box or hundreds of points for a very accurate map.

And depending on the shape of the zone, it's quite possible that you
could be in one zone, but the closest point belongs to a different zone.

I did a load of storm analysis years ago. Comparing point by point is a
HUGE job :-)

Cheers,
Wol
Reply all
Reply to author
Forward
0 new messages