danfran / hcoord

Easily convert between latitude/longitude, Universal Transverse Mercator (UTM) and Ordnance Survey (OSGB) references with Haskell.
Other
5 stars 2 forks source link

Validation of latitude and longitude converting from UTM. #7

Open philderbeast opened 5 years ago

philderbeast commented 5 years ago

https://github.com/danfran/hcoord/blob/e308934570874a6ce7f7ebdbf51a3c34e4acd745/src/UTMRef.hs#L85

When converting from a UTMRef to a LatLng perhaps we need a tighter validation on latitude? UTM doesn't represent latitude outside of the range -80 .. 84. Could we drop the validation on longitude?

https://github.com/danfran/hcoord/blob/e308934570874a6ce7f7ebdbf51a3c34e4acd745/src/LatLng.hs#L24-L25

danfran commented 5 years ago

Thank you Phil. Yes you are right as the polar regions south of 80°S and north of 84°N are excluded from UTMRef (not needed for longitude as 60 part of 6° each one). Can you please add a test to verify the correct behaviour of the code you have added?

https://github.com/danfran/hcoord/blob/master/test/UTMRef/Tests.hs

I am not agree about removing the validation for LatLng.hs tho.