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