lutraconsulting / qgis-xyz-tiles

A processing algorithm to generate xyz tiles from map/layer extent.
GNU General Public License v2.0
20 stars 12 forks source link

Labels missing from tiles #19

Open klakar opened 5 years ago

klakar commented 5 years ago

Running QGIS 3.6.3 and Tiles XYZ 0.6 OS Ubuntu 18.04

It looks like there's a significant number of labels missing in the generated tiles. In QGIS it looks as below: Skärmbild_2019-06-03_20-59-11 While the export to XYZ tiles have a lot of labels missing (below): Skärmbild_2019-06-03_21-02-50

I've noted the "fix" to remove partial labels, but to my eye this looks like a substantial amount of additional labels that are missing.

One of my problems (my mistake) early on was that I had my project in meters and this changed the style for a lot of symbols when rendering the tiles. The labels also have size settings in map-units, if that may have something to do with this problem (haven't had time to examine this yet).

It would of course be preferred to not have ANY labels partially rendered.

Might it be possible to render a larger area, including all labels over the tile edges, and then clip them to the correct tile size? It will take more processing time, but if it is an option in the tool, that would be really useful when rendering from vector source.

Thanks!

saberraz commented 5 years ago

Thanks for your feedback and reporting this issue. There is a new version of the plugin (0.8) from QGIS plugin repo, please update and reopen this issue if you still have problems with labels.

klakar commented 5 years ago

Thanks, it has helped a lot, but the core problem persists. Skärmbild från 2019-06-04 16-49-38 All symbols above should have labels. Some are missing and some symbols are also "clipped" at the tile edges.

I'm guessing that a complete fix for this is harder to do, but unfortunately necessary in order to be 100% useful for vector data sources. (Enhancement?)

Anyhow, thanks for the quick update.

wonder-sk commented 5 years ago

The issue with cut-off point symbols is something different from the issue with labels - I think that deserves a separate ticket. Can you please share your project? That would help testing why some labels are still missing.

klakar commented 5 years ago

Sure I've created a small project with a simple GeoJSON point layer. The same label text for all points. Random placement and random rotation, but ALL labels are placed in QGIS: Skärmbild från 2019-06-04 18-57-43

I also created larger point symbols to help seeing where the tile edges are. Which will show when I generate tiles around zoom level 12-14: Skärmbild från 2019-06-04 18-59-27

The project and PointLayer are in attached zip-file. Label_Test.zip

Of course it is also possible to set a fixed size for the labels in map units, but I'm sure you will find that some labels are missing as it is. As for the points I can make a ticket for that, but I think that it might be related to the same problem, or might have the same solution. If it is possible to render larger (overlapping) tiles and then clip them to size, point symbols and labels might render ok over the final tile edges (not sure how the tool works). When and if the label issue is resolved, I'll revisit the point symbols.

wonder-sk commented 5 years ago

@klakar thanks for the followup. Looking at your project, labels have hardcoded quadrants and rotation. This will inevitably produce some features that are not getting labeled because the labels can't fit into a single (meta)tile without getting the label text cut off at the edge. If the labels were not constrained so much, there would be much higher chance of getting labels on all of them.

There may be ways how to solve this issue (e.g. by allowing overlap to neighboring tiles and then providing already rendered labels at the edges from previous tiles as input when rendering the next tile. But that's something that would first need to be supported in qgis core library.

For cut off symbols I have opened ticket #22 as it is a different problem.

klakar commented 5 years ago

Just adding a comment for this issue. In most cases it is required to be able to place labels exactly at certain locations and/or with specific orientations for cartographic reasons. The only way to do this right now, is to first generate a raster image of suitable resolution, and then cut it up into tiles. It would be really useful if a tool like this would remove this intermediate step. It is however understood that changes in the QGIS core functionality might be required for this to be a simple fix.

mark79as commented 2 years ago

Is there any built-in solution for the missing label problem?

Tartamillo commented 1 year ago

There may be ways how to solve this issue (e.g. by allowing overlap to neighboring tiles and then providing already rendered labels at the edges from previous tiles as input when rendering the next tile. But that's something that would first need to be supported in qgis core library.

That's what was implemented in Tilemill and works very well. Basically you render a buffer area around the metatiles that gets subsequently cropped. See https://tilemill-project.github.io/tilemill/docs/guides/metatiles/ I see a potential difficulty to implement this in QGIS because of the non-deterministic label placement (the label would likely move when rendering the next batch of metatiles)