Flutter_map: Implement map rotation

Created on 20 Sep 2018  路  10Comments  路  Source: fleaflet/flutter_map

It would be nice to be able to rotate the map.

Take a look at https://github.com/flutter/flutter/pull/17345.

The mapOptions could also take an optional argument allowMapRotation, that would default to true. Maybe everyone doesn't need or want map rotation...

enhancement help wanted

Most helpful comment

We will need this functionality in our project. So I will have a closer look at this.

All 10 comments

I think the challenge here will be to determine what "box" the map tiles need to render in. (e.g. rotating the map may result in tiles in the viewport not being fetched)

kinda similar to this problem: https://stackoverflow.com/questions/10392658/calculate-the-bounding-boxs-x-y-height-and-width-of-a-rotated-element-via-jav/11771163 except the blue rectangle needs to be large enough such that the red rectangle (the viewport) is covered.

i think Flutter supports rotation so i don't see that piece being a huge effort.

Ok, I see. What info do we get? The coordinates of the viewport and the rotation?

Then we probably also want to filter out the tiles that are colored in the picture, since they are not needed.

img_20181001_130744
(apologies for the large and ugly picture)

Yes exactly. Thanks for making an illustration. I'm going to mark this as "help wanted" since this is a slightly challenging problem!

Just thinking about this, rotation would be nice, but what about things like text on a tile, wouldn't that mean it's now upside down if we rotate 180, would that be a bad experience ? Would it only be useful for tiles without text, or vector tiles or something ?

@ibrierley I think it would still be useful even with text on tiles. Humans are pretty good at reading stuff that is rotated.

I have noticed that google maps automatically rotates street names (maybe it's a separate layer or something?). That is of course the optimal solution but I don't think many free map providers offer this? (Correct me if I'm wrong)

Yes I suspect that is one of the reasons Leaflet does not support rotation.

We will need this functionality in our project. So I will have a closer look at this.

Not sure if that is enough for you needs. It only allows to rotate the map from the App side.

This issue still isn't fully resolved AFAICT. There's still work to be done to make sure that tiles on the edge of the viewport are displayed

That is strange because I haven't seen that when I tested it can you show me an example? Flutter_map has sometimes a problem not to fill the whole space.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jasonleung101 picture jasonleung101  路  3Comments

johnpryan picture johnpryan  路  4Comments

aytunch picture aytunch  路  3Comments

jacksos101 picture jacksos101  路  3Comments

garrrettt picture garrrettt  路  4Comments