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

Allow optional specification of UTM zone in Coordinate.UTM Property #128

Closed
rolyhudson opened this issue Feb 20, 2020 · 5 comments
Closed

Comments

@rolyhudson
Copy link

rolyhudson commented Feb 20, 2020

Great library see how I am using it here: #79 (comment)
Problem arises where I have an array of Coordinates representing a line string that spans a boundary between UTM zones the conversion to UTM has unexpected results.
Mapping the M25 around London is a good example:
69537259-ac08bc80-0f77-11ea-87b6-fa7888522e6a
London spans the boundary between Zones 30 and 31 so the lat lons get converted into different zones.
Would be great to have an optional input so I could say use zone 30 for the case above.

If this is ignorance, on my part, of a conversion method I would be better off using or if I am suggesting an ugly hack my apologies. Please correct me.

@Tronald
Copy link
Owner

Tronald commented Feb 20, 2020

Thank you for your kind words, as well as adding to our Tell Us Issue!

This is a really interesting concept, so let's discuss this a bit more. Forgive me as I am about to think out loud here.

By definition UTM zones do not overlap, but that doesn't mean you can't project past the zone boundaries. I have no idea personally how this would effect the precision of the UTM coordinate though. You will definitely lose precision the farther you extended outside the boundary, but how much is unknown to me.

I completely understand why this would be useful though as you could remain in one zone. Having to switch to another zone for a few hundred meters seems pointless if precision loss is minimal. Furthermore, users of CoordinateSharp usually don't require hyper precision as it is designed to be lightweight over precise so I think that's an acceptable risk as long as people are aware of it.

Furthermore, you can project past a boundary and successfully convert back to geodetic, so the UTM back to Geodetic part is already in place (again I am unsure of the precision implications of it though).

I found an interesting discussion on this here.

Perhaps a boundary lock property on the UniversalTranverseMercator class could be set to keep conversion in the current zone.

I do like the idea, so let me research this a bit more. If you or anyone has anything to add please do so.

@Tronald
Copy link
Owner

Tronald commented Feb 21, 2020

Ok, just a quick update.

With the UTM Zone "locked" at 30 (which ends at 0W), using geodetic 51.5074N 1E, I was able to successfully project past the zone limitation with less than a meter’s loss of precision. That's pretty darn good for a whole degree (approximately 111 Km) in my opinion.

I'm comfortable adding this feature to the library assuming users understand the risk associated with it. I need to brainstorm the most user friendly way to implement this however, but I think we can get it out in the next release as it will only delay it slightly (a week or two).

Great suggestion.

I'm going to keep this issue open to track progress.

@rolyhudson
Copy link
Author

Fantastic. Sounds great will be a huge help for me. Happy to test when it is ready.

@Tronald
Copy link
Owner

Tronald commented Feb 22, 2020

I've committed the change to the develop branch if you wish to test it out. We still need to build tests as well as document the changes before release, but please provide any feedback you have before then if you choose to try it out (you will have to fork/download the develop branch and build it yourself for now sorry).

It's super easy to use any only requires one extra line of code.

EXAMPLE:

//Create a coordinate that projects to UTM Grid Zone 31
Coordinate coord = new Coordinate(51.5074,1); 
//Display normal projected UTM
Console.WriteLine(coord.UTM); //31U 361203mE 5708148mN

//Lock coordinate conversions to Grid Zone 30 (over-project);
coord.Lock_UTM_MGRS_Zone(30);

//Display over-projected UTM
Console.WriteLine(coord.UTM); //30U 777555mE 5713840mN

To unlock the zone and return to normal projection you can simply call coord.Unlock_UTM_MGRS_Zone();

I believe we are still on schedule to release the next update in about a week so feel free to either try it out now or wait until you can grab it from Nuget. Either way is fine, but if you decide to try it early please let us know if you have any feedback.

Thanks again for the great idea. Leaving this issue open until release / and for any feedback.

@Tronald
Copy link
Owner

Tronald commented Mar 1, 2020

v2.4.3.1 Released.

Example Usage:

//Create a coordinate that projects to UTM Grid Zone 31
Coordinate coord = new Coordinate(51.5074,1); 
//Display normal projected UTM
Console.WriteLine(coord.UTM); //31U 361203mE 5708148mN

//Lock coordinate conversions to Grid Zone 30 (over-project);
coord.Lock_UTM_MGRS_Zone(30);

//Display over-projected UTM
Console.WriteLine(coord.UTM); //30U 777555mE 5713840mN 
//Approximately 1 meter of precision lost with a 1° (111 km / 69 miles) over-projection.

@Tronald Tronald closed this as completed Mar 1, 2020
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