Skip to content
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

GeoJson "right hand rule" listing longitude first (GeoFence.Point) #238

Open
houstonhaynes opened this issue Jul 2, 2024 · 4 comments
Open

Comments

@houstonhaynes
Copy link

houstonhaynes commented Jul 2, 2024

Is your feature request related to a problem? Please describe.
It would be nice to have a convenience feature to have a GeoFence.Point (or GeoFence.RightHandPoint) that would provide 'longitude, latitude' as a tuple for outer-bound GeoJson closed geometries.

Describe the solution you'd like
It was a little awkward getting a GeoJson object out of a list of GeoFence.Point s. I had to switch out to handling the individual fields, which is not a terrible inconvenience. However, it would be nice to have a means to get back a Point "right handed" for creating geo-plots

Describe alternatives you've considered
See the screenshot of my F# code. I created a "rightHandPoint" type with passed it around the functions.

Additional context
None
Screenshot 2024-07-02 152217
Screenshot 2024-07-02 152327
Screenshot 2024-07-02 152547

@houstonhaynes houstonhaynes changed the title GeoJson "right hand rule" listing longitude first (GeoFence.Poin) GeoJson "right hand rule" listing longitude first (GeoFence.Point) Jul 2, 2024
@Tronald
Copy link
Owner

Tronald commented Jul 2, 2024

Hi Houston,

I hope all is well with you.

Just to make sure I understand the problem correctly.

  1. You need to the ability to reorder the GeoFence.Points collection for right-handedness.
  2. You need a Tuple<double, double> collection returned instead of a GeoFence.Point collection as it's more convenient to work with.

If I am understanding this correctly, it may be best to place a method within GeoFence class that reorders points for right handedness due to how it works, and then create a method that returns a Tuple (and another that returns an array as some may what that).

I think this makes sense, and I am actually surprised it's never been asked as I can see how this would be convenient. Let me know if I am not understanding correctly though.

@houstonhaynes
Copy link
Author

That's a great description, and yes, that sounds pretty on-point. 👍

As a sidebar I also spotted that "outer" rings are enumerated counterclockwise and inner rings are clockwise (in terms of order of pairings) though I don't have any reference as to why that requirement exists. If there was ever an interest in building a helper that would provide a GeoJson object there's that little tidbit to consider. 🤔

@Tronald
Copy link
Owner

Tronald commented Jul 2, 2024

Thanks for that tidbit. Looks like spec interprets the clockwise rings as holes so that it doesn't treat is as an overlapping boundary in a polygon collection I guess. Makes sense. The GeoFence class isn't advanced enough to determine holes on its own, but this could be a great concept to expand the library.

Lefthanded and Righthanded outputs should be easy. I will have to explore what going beyond that to have a GeoJson helper would entail. That would be a nice feature though. Thanks for the suggestion.

@houstonhaynes
Copy link
Author

houstonhaynes commented Jul 3, 2024

Absolutely. I really appreciate your work. 🔧 😃

FWIW - the current application is to create these polygons to feed into the OpenWeatherMap "Trigger" API to set locale (and datetime) boundaries to evaluate for conditions and provide notifications for weather changes. In my immediate case it's for an #IoT device that senses rainfall/wind and triggers the state of an motorized awning - mainly to retract the awning via a hacked remote control. But in the bigger picture there's a handful of other state-related management tasks I'm considering. I may set the 10 foot X 20 foot awning to partially retract in order to reduce exposure and make the "final" retraction into the wall-mounted cassette take less time as local events dictate.

Another application is to set triggers for parking a motor-positioned solar panel when wind exceeds a threshold. This too will be based on forecast - where the trigger is based on conditions existing before I take that protective action. And of course there's the situation of restoring the position of the panel (similarly with the awning) once the adverse conditions have cleared.

It's been really rewarding to work with CoordinateSharp and the OpenWeatherMaps API in F#. 🚀 😁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants