Closed westnordost closed 7 years ago
Oh, haha that's fair. It's probably more convenient for everyone if we return longitudes within (-180, 180] and say that in the documentation for the getter.
Fun fact: My app made lon=-350.0608708311122 into lon=_7_9,939129168887803 until I fixed this bug right now https://github.com/westnordost/osmapi/commit/16691490a7be8a187fde052d6db0b3e1f1ff316f :-D
I should point actually not wrapping allowed had a side effect of allowing lines to be drawn across the international dateline. Since I raised a duplicate bug on the exact issue addressed here perhaps I should have added this before
See this freehand drawing example (just me drawing a random wave):
Before fix After fix
I know this fix is better for most scenarios, but maybe some applications will want to work as before. At this point I'm still just playing with Tangram-es to see what can be done. Freehand drawing works pretty well with markers.
@ac87 thats a valid argument, maybe we can expose the API such that the user has the flexibility of getting a wrapped longitude or an unwrapped longitude (controlled by a boolean)? And by default we always return wrapped longitude.
I don't think it will be helpful to add an option for getting an explicitly "unwrapped" longitude, as this concept isn't guaranteed to be preserved if we change the implementation of world-wrapping. Lines with segments that cross 180 degrees longitude will be correctly displayed using a MapData
instance, so I'd recommend using that for cases like this.
I'm not sure a drawing use case works with MapData or at least I haven't seen something dynamic enough to allow variable thickness and any color. I do appreciate the world-wrapping situation though, its currently not ideal with markers, without a jump to my location button taking you to the 'primary' world you can get lost.
Actually having thought for a minute longer I suppose a color set and set of thicknesses could be defined in YAML then drawing could work with MapData.
Tangram-ES Version 0.4.5
MapController::getPosition and MapController::screenPositionToLngLat may return a LngLat in which (at least) the longitude is negative.
I got this above Hamburg, when having the map centered at lat=53,58220643220753, lon=9,939129168887803. Lon was -350.0608708311122 instead.
I know this is still mathematically correct, but having a coordinate whose longitude is not within the -180°..+180° bounds is certainly unexpected. If you intend to not fix this by normalizing the angle, it would be good if this were documented.