As I mentioned in my other thread: Wrong longitude for mouse location across dateline , working with features crossing the dateline causes some issues.
I have a custom track overlay that is used as a measure tool. Basically, the user clicks, and a line is built between the clicks, showing the length of the line on the label. This works except when the line crosses the dateline when wrapping mode is enabled. If I fix the x,y values, the line being drawn goes backwords across the entire map once it crosses the dateline, instead of just drawing a short distance across the dateline.
If I DON’T fix the values, the line draws fine across the dateline, but I can’t use functions like .GetLength(), because the actual X values being produced are < -180 or > 180. This will throw an error.
What’s a good way to get around this?
When I say I’m “fixing” the lat/long values, I mean I’m using modulus to keep them in the correct range.