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

[BUG] Crossing W/E Extremity With Polyline Results In Unexpected Lines #1338

Open
5 tasks done
WorldpixelSoftware opened this issue Aug 11, 2022 · 17 comments · May be fixed by #1969
Open
5 tasks done

[BUG] Crossing W/E Extremity With Polyline Results In Unexpected Lines #1338

WorldpixelSoftware opened this issue Aug 11, 2022 · 17 comments · May be fixed by #1969
Assignees
Labels
bug This issue reports broken functionality or another error P: 3 (low) (Default priority for feature requests) S: core Scoped to the core flutter_map functionality

Comments

@WorldpixelSoftware
Copy link

WorldpixelSoftware commented Aug 11, 2022

What is the bug?

I was trying to implement a great circle map between two points using the OSM Map.

All is good as long as you don't cross 180E/W. Then the line suddenly jumps to the other side of the map.

flutter_map_bug

What is the expected behaviour?

Having a closed line between the two points. On low zoom levels (like OSM 0), there should be just two renders of any layer at a given coordinate.

How can we reproduce this issue?

No response

Do you have a potential solution?

Maybe mirroring the coordinates is possible somehow? So that a marker or a line is shown twice on low zoom levels.

Can you provide any other information?

No response

Platforms Affected

Android, iOS, Windows, MacOS

Severity

Obtrusive: Prevents normal functioning but causes no errors in the console

Frequency

Consistently: Always occurs at the same time and location

Requirements

  • I agree to follow this project's Code of Conduct
  • My Flutter/Dart installation is unaltered, and flutter doctor finds no relevant issues
  • I am using the latest stable version of this package
  • I have checked the FAQs section on the documentation website
  • I have checked for similar issues which may be duplicates
@WorldpixelSoftware WorldpixelSoftware added bug This issue reports broken functionality or another error needs triage This new bug report needs reproducing and prioritizing labels Aug 11, 2022
@JaffaKetchup JaffaKetchup added non-fatal and removed needs triage This new bug report needs reproducing and prioritizing labels Aug 12, 2022
@JaffaKetchup JaffaKetchup changed the title [BUG] Crossig 180W/E in Polyline Layer results in undesirable view [BUG] Crossing W/E Extremity With Polyline Results In Unexpected Lines Aug 12, 2022
@JaffaKetchup
Copy link
Member

Hi there, and thanks for the report!
We've known about this issue for a while, but have never tried to resolve it as it seems to be a rare-ish occurrence. Can you try splitting your line into two parts, where one starts/ends at 180 and the other at -180?

@WorldpixelSoftware
Copy link
Author

@JaffaKetchup Yeah splitting the lines was basically my workaround for this situation. I just think that looks weird though.

What would be really great is to have a map view, that has no physical boundaries left and right, basically like when you go on google maps and pan from one side to the other and the map just "rotates" in view

I've included two pictures of what I would consider expected behaviour for a map projection.

But thank you for your time and effort that went into this project!

maps_ew_crossing
gcmapper_ew_crossing
.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@JaffaKetchup
Copy link
Member

Hi there @KKStudios, and sorry for the delay.
I think someone else wanted infinitely panning maps, but that's quite a low priority. Can you send some pictures of how the splitting technique looks?

@zery6
Copy link

zery6 commented Sep 26, 2022

@JaffaKetchup Yeah splitting the lines was basically my workaround for this situation. I just think that looks weird though.

What would be really great is to have a map view, that has no physical boundaries left and right, basically like when you go on google maps and pan from one side to the other and the map just "rotates" in view

I've included two pictures of what I would consider expected behaviour for a map projection.

But thank you for your time and effort that went into this project!

maps_ew_crossing gcmapper_ew_crossing .

Hi there @KKStudios,
I have the same problem,
Can you show your solution code?
Thx!

@WorldpixelSoftware
Copy link
Author

@JaffaKetchup

Here is how a workaround would look like splitting the path into two..

If you ask me, looks pretty crappy, that's why I won't implement that right now.

180_crossing

But probably would make a lot of work for the project to change to some kind of infinite scrolling map.

Cheers

@JaffaKetchup
Copy link
Member

@KKStudios
Yeah, I can see that's less than desirable. There has been some talk on reworking the tile layer mechanics, and infinite functionality may be a part of this; but for now, it's unlikely we'll implement it.
(Anyone else reading and wants to submit a PR, please do!)

Thanks for your insight :)

@WorldpixelSoftware
Copy link
Author

@zery6
Would be to much code to post right now since it's all integrated in my project and using internal utilities...
But basically you just calculate where the great circle between two points crosse 180E/W.

Then you do polylines between that point and your departure/ destination point. Thats it.

Formula for calc can be found here: https://edwilliams.org/avform147.htm
Very neat comprehension.

@WorldpixelSoftware
Copy link
Author

@JaffaKetchup
Ok no problem. Maybe I'll have a look into it if modifying the project and digging into the codebase is worth the effort or implementing a scrolling map from scratch with only the required functionality is less work.

Just not my no1 priority right now.

Thanks anyhow.

@ibrierley
Copy link
Collaborator

If you felt brave, and wanted to have a play with a very alpha plugin, my vector slicer plugin can draw across lines across the dateline, and also repeat (but not infinite). Examples of the effect would be https://fluttermap.dabbles.info/dateline_test/#/ https://fluttermap.dabbles.info/geoslicer/#/ you should see the repeats if you zoom out (dateline crossing in first example, repeated none dateline stuff with simple clustering in 2nd).

Repo at https://github.com/ibrierley/geojson_vector_slicer Basically it's a fast way with functionality to draw geometry.

Couple of thoughts worth bearing in mind. It's designed for more static geometry (i.e it may take a few seconds if its very complicated, like the US example). But it may be ok redoing relatively simple geometry more often, I've not really tested that. Erm and it's very much a pre alpha :). But if someone else ever wanted a play, I'd probably work on it.

It's designed for geojson, but one could convert to geojson relatively quickly, I could probably add a method to do that.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale label Dec 28, 2022
@JaffaKetchup JaffaKetchup mentioned this issue Dec 30, 2022
5 tasks
@ivanzhadnov
Copy link

Hi
could you please inform is it bug will be solved at next release?

@ibrierley
Copy link
Collaborator

It's currently unlikely (unless someone wants to submit a PR).

@monsieurtanuki
Copy link
Contributor

I solved a similar issue in https://github.com/osmdroid/osmdroid, years ago.

If I remember well the idea is:

  • to know the width of the world, in pixels
  • to check each time we add a projected point - if I added/subtracted the world width, would I be closer to the previous polyline point?
  • probably use the polyline center in order to decide which part of the world to center the polyline on
  • possibly display as many identical polylines as the world replications need

@JaffaKetchup JaffaKetchup added the S: core Scoped to the core flutter_map functionality label Apr 25, 2024
@monsieurtanuki
Copy link
Contributor

@JaffaKetchup I'm currently working on it. There are similarities with the "teleporting marker" issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue reports broken functionality or another error P: 3 (low) (Default priority for feature requests) S: core Scoped to the core flutter_map functionality
Projects
Status: To do
Development

Successfully merging a pull request may close this issue.

6 participants