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

Mapsforge: large query zoom levels have polygon artifacts #391

Closed
wants to merge 1 commit into from
Closed

Mapsforge: large query zoom levels have polygon artifacts #391

wants to merge 1 commit into from

Conversation

braandl
Copy link

@braandl braandl commented Sep 4, 2017

When trying to render large Polygons from Mapsforge Mapsource, the Polygons and their outlines got destroyed, due to coordinates that break the linits of the shortBuffer.

Clipping these coordinates does improve rendering performance a little and prevents rendering artifacts on high zoomlevels (18+ for me).

@devemux86
Copy link
Collaborator

Can you share an area to test that behavior before and after?

@braandl
Copy link
Author

braandl commented Sep 4, 2017

Sorry, I was just preparing the Images for upload. Here they come:
broken

fixed

@braandl
Copy link
Author

braandl commented Sep 4, 2017

Simply allow the MapFileTileSource to load up to Zoomlevel 20+ and then load some map.

@devemux86
Copy link
Collaborator

Coordinates (to avoid searching) ? 🙂

@braandl
Copy link
Author

braandl commented Sep 4, 2017

lat: 50.069218, lon: 8.719738

https://www.google.de/maps/place/50%C2%B004'09.2%22N+8%C2%B043'11.7%22E/@50.069207,8.7177343,17z/data=!3m1!4b1!4m14!1m7!3m6!1s0x47bd1ea31649d8eb:0x98bb77a2ca2fc8a5!2sA66!3b1!8m2!3d50.1313217!4d8.6615183!3m5!1s0x0:0x0!7e2!8m2!3d50.0692073!4d8.7199232

using the normal "hessen.map" from Mapsforge Download Server for example.

The only changes I did to the mapsforge sample is allowing Zoomlevels up to 21.

screenshot_20170904-154634

After applying my patch, the issue is gone.

@devemux86
Copy link
Collaborator

Thanks for the additional info, will review it.

BTW any tile clip buffer probably should be based on dpi, like in MapDatabase.

@braandl
Copy link
Author

braandl commented Sep 4, 2017

The issue with dpi based buffers is, that no dpi is known in gwt applications what can lead to render artifacts again.

@devemux86
Copy link
Collaborator

Library is platform agnostic, running on mobile and desktop, so should support all.

We use dpi scaling (e.g. CanvasAdapter.dpi / CanvasAdapter.DEFAULT_DPI) in many places like in rendering, themes, etc.
If a platform cannot calculate it, the default is 1.

@braandl
Copy link
Author

braandl commented Sep 4, 2017

I know. Still it results in bad render quality on some browser plattforms, but feel free to change it and change the buffer to some dpi dependent value.

@devemux86
Copy link
Collaborator

Still it results in bad render quality on browser plattforms.

Why? It's the ratio we use, not the actual dpi value.
Vector map libraries like Mapsforge or VTM on desktop can keep default scale ratio 1, unless have in mind 4K screens.

@braandl
Copy link
Author

braandl commented Sep 4, 2017

Exactly. It makes lines disappear and produces a lot of alias. But this is all totally off-topic.

@devemux86
Copy link
Collaborator

Cannot reproduce the case (even with tilt), what else is needed?

Used vtm-android-example and MapsforgeMapActivity with hessen.map and changed:

mMap.viewport().setMaxZoomLevel(22);
mMap.setMapPosition(new MapPosition(50.069218, 8.719738, 1 << 21));

sample

@braandl
Copy link
Author

braandl commented Sep 5, 2017

Nothing else. The effect is the strongest when you have some large polygons with highlighted boundaries... My screenshot is from a clean pull of the master branch with no changes...

@devemux86
Copy link
Collaborator

devemux86 commented Sep 5, 2017

Still we need a test case. Cannot see anything strange at those coordinates.

@braandl
Copy link
Author

braandl commented Sep 5, 2017

@devemux86
Copy link
Collaborator

Very strange.. using the same map file and default theme, see nothing.

mMap.viewport().setMaxZoomLevel(30);
mMap.setMapPosition(new MapPosition(50.0808835, 9.0028989, 1 << 21));

Where is the image position, is it the above?
Can you post an exact setMapPosition where the issue should appear?
The issue should be reproducible on Android emulator to be able to test it.

@braandl
Copy link
Author

braandl commented Sep 5, 2017

Did you allow the Maploader to generate Tiles to that degree, too? Otherwise it will simply not render the tiles in that zoomlevel and the issue does not appear, as I wrote earlier. You can enable the debugoverdraw in "VectorTileRenderer" and all tiles should be rendered in green. The position does not matter to much, it happens everywhere on the map.

public MapFileTileSource() { this(0, 21); }

@devemux86
Copy link
Collaborator

No, of course not. Such information did not exist in issue description, so obviously hadn't all the required information for a proper testing. 🙁

BTW there is #231 about changing Mapsforge default settings, in most cases not needed since the tiles over zoom to max zoom of the map view and map files max base zoom is 14.

@braandl
Copy link
Author

braandl commented Sep 5, 2017

Simply allow the MapFileTileSource to load up to Zoomlevel 20+ and then load some map.

And it is a completly different issue

@devemux86
Copy link
Collaborator

A test code is a thousand words.

Now that the issue is more informative, can test what happens.

Repository owner deleted a comment from braandl Sep 5, 2017
@devemux86
Copy link
Collaborator

Behavior seems Mapsforge specific, so if can handle it inside Mapsforge classes, to not break rest lib GL rendering.

The buildings could cause the issue (as seen in urban areas), since commenting them here in default.xml theme eliminates any artifacts.

In Mapsforge MapDatabase.processWays there is a check here to not use TileClipper for buildings, probably due to opensciencemap#124.

So pushed in issue_391 branch also an additional check for map file tile source max zoom that clips also the buildings and the render artifacts disappear.

Additional work can be done in MapDatabase.setTileClipping optimizing the tile clip buffer for map files.

@braandl
Copy link
Author

braandl commented Sep 5, 2017

That should also do it for the MapFileTileSource, but I am convinced that your assumption is wrong, and it does simply not effect other Tilesources because they do not deliver tiles on such a high zoom level, so the parent tiles are rendered.

@devemux86
Copy link
Collaborator

devemux86 commented Sep 5, 2017

Each tile source has its own tile decoder and we can check each one when can be actually tested.
e.g. Mapzen doesn't seem having polygon issues, but has line artifacts even at zoom 16 (#288)

@devemux86 devemux86 changed the title Fix: Correct Polygon renderings on large Polygons and high Zoom Levels Mapsforge: large query zoom levels have polygon artifacts Sep 6, 2017
@devemux86 devemux86 added the bug label Sep 6, 2017
@devemux86 devemux86 added this to the 0.9.0 milestone Sep 6, 2017
@devemux86 devemux86 closed this in f1634e4 Sep 6, 2017
@devemux86
Copy link
Collaborator

Closing as handled inside Mapsforge classes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants