Web-Map-Custom-Element icon indicating copy to clipboard operation
Web-Map-Custom-Element copied to clipboard

Use <map-featurecaption> as the feature label and accessible name by default

Open prushforth opened this issue 1 year ago • 3 comments

If a <map-feature> contains a <map-featurecaption>, the feature should be visually labelled, using map text label defaults built into the user agent stylesheet, amended by the user stylesheet and potentially customized by the server-provided style rules found in <map-link rel=stylesheet> and <map-style>.

The <map-geometry> should be used to control the label placement algorithm.

If a feature is tiled into parts, it should be possible to merge the geometry parts using a standard attribute name which has a common value across the parts. The label placement algorthim could use the resulting re-assembled geometry as required.

CSS rules could be used to substitute content to be rendered in place of <map-featurecaption>, but <map-featurecaption> would be the "batteries-included" default, which would help accessibility I think.

prushforth avatar Mar 23 '24 16:03 prushforth

As discussed, possible overlapping problems may exist with this approach:

image

Similarly, when zoomed out, we will face the issue of improper label size since no media query exists yet to incorporate map scale which would be used to adjust size accordingly. image

AliyanH avatar Apr 04 '24 03:04 AliyanH

There are going to be challenges, but it should be possible to have a default rendering heuristic perhaps. For example, a <map-feature> has a zoom attribute aka native zoom, and perhaps we could limit the default rendering to that zoom value.

As far as overlapping labels goes, yes, this would require some label collision detection logic to be built into the renderer I guess.

Good to keep discussing what might be involved for now.

prushforth avatar Apr 04 '24 13:04 prushforth

For consideration https://en.wikipedia.org/wiki/Automatic_label_placement

prushforth avatar Apr 04 '24 13:04 prushforth