-
-
Notifications
You must be signed in to change notification settings - Fork 860
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
[FEATURE] Is it possible to re-make LatLng
as a first-party class?
#1452
Comments
I personally don't have an issue with this, if anyone wants a bash. |
Don't have any issue either but this will be quite the breaking change I think 🤔 |
Indeed, a lot of file changes, and people may have their own other chunks of code elsewhere that rely on it, so not a trivial one in terms of changes (logic probably generally unchanged on the whole I suspect). I'm not sure if there's a middle way to allow either, but feels like it may be a bit clunky to do that, not sure! |
Yeah and it will also break all the plugins depending on flutter_map. If we want to do it iteratively we'll have to create methods that would use our new latlong object but keep and deprecate all the public methods relying on the For example, we would keep for a while the |
Another approach could be to ask latlng2 folk to allow an option where a > +/-90/180 is allowed. Just thinking out loud. |
That would also be a solution but, seeing that the package hasn't been updated for the past 17 months even with a few issues and PR open I don't know if such option would be added anytime soon 🤔 |
The lack of update on the latlong2 package was also the reason the suggestion was made to make it first-party. It was initially forked from the original package to make it null-safe and not much update since then. I do realize this would be significant breaking change and could possibly be relegated to a major version change. One thing to note about the demo: The official leaflet JS does not support polylines spanning the meridian boundary. There are two methods to overcome the limitation.
Polyline(
points: [
LatLng(37, -100),
LatLng(57, 100),
],
), becomes Polyline(
points: [
LatLng(37, -100),
LatLng(57, 100 - 360),
],
), Using the second method, the map does not blink as it would with PS: |
I think the parity with leaflet was broken some time ago (if it was ever fully there), but I personally do try and always match leaflet.js if its something that exists there already if that makes sense, and try and hedge anyone that way (also to check if something has been done by leaflet.js as inspiration. It's difficult to keep an eye on another repo though. If there are features in leaflet that aren't in flutter_map and anyone wants a bash at adding those features, I'm sure it would go down well. I think the key with major changes, is not to do them too often, and have a good reason, rather than never to do them. |
Understood and it makes sense. I do not think this is an extremely high priority feature rather as something that can trickle down with intermediate fixes like @TesteurManiak had suggested. The developers could be given some deprecation warnings on upcoming changes when they test/run their existing code. |
it may still be worth asking the author of LatLng2 first, see if he is interested in updating with the feature as a first step. |
As pointed out on the Discord server (https://discord.com/channels/951867686378409984/1092883585943486544), the |
I agree with @ibrierley, first step should be trying to find a fix upstream. Submitting a PR to that repo would be much less work for everyone than implementing our own
That alone is not an indication of whether the package is maintained or not, it could also be because the package is fairly mature. There doesn't seem to be a large backlog on issues or PR:s. They have 3 open issues, all of which seem like quite minor improvements. With the release of Dart 3 they did update the package, |
i've opened an issue with latlong2 |
From v0.9.1, there are no longer assertions in |
For the time being, I'm going to close this issue. I think the time is better spent working with what we've got here to introduce cross-boundary lines and such like. |
What do you want implemented?
LatLng
used by Flutter Map is currently from the latlong2 plugin. One major limitation of the plugin is the assertion of the latitude/longitude bounds. The original leaflet JS library has it's own LatLng class and does not have bounds on latitude/longitude values and allows for wrapping based on CRS.Eliminating the restrictions on the latitude/longitude values, opens up possibility to solve the issues #1338 and #468 which relate to the polylines across the +/-180 longitude and repeating the maps across the +/-180 longitude.
It is a relatively light codebase to port and could be made in accordance with official leaflet source.
What other alternatives are available?
I have been able to modify the latlong2 plugin code and remove the restrictions mentioned above. I also made the necessary changes to the FlutterMap code to follow the official leaflet JS with respect to wrapping the tiles.
With this I can pan across the +/-180 boundaries and also show polylines across them without splitting them up.
Can you provide any other information?
Demo:
MapPanTest.mov
Platforms Affected
Android, iOS, Web, Windows, MacOS, Linux
Severity
Annoying: Currently have to use workarounds
Requirements
The text was updated successfully, but these errors were encountered: