tangrams / tangram

WebGL map rendering engine for creative cartography
https://tangram.city
MIT License
2.21k stars 290 forks source link

Change default `repeat_distance` for point feature labels #718

Closed bcamper closed 5 years ago

bcamper commented 5 years ago

The default repeat_distance for labels has always been 256px across the board. This is a sensible default for cases such as street labels (the original use case for repeat label culling) and road shields, but can generate unexpected results particularly when applied to point labels.

For example, when labelling data with a property that has a finite set of values, such as category names ("bar", "restaurant", "hardware store", etc.) or numeric values, it's often surprising/undesirable that only a few labels are plotted.

This branch changes this behavior such that:

This example illustrates the difference in point geometry behavior:

        draw:
            points:
                color: red
                size: 4px
                collide: false
                text:
                    text_source: function(){ return 1 }
                    font:
                        color: white
                        stroke: { color: black, width: 4px }

In the prior behavior, only a few point labels are shown, and in the new behavior, all points are rendered:

Webp net-gifmaker

bcamper commented 5 years ago

@matteblair @meetar @nvkelso we talked about this a few months ago... finally getting around to it.

nvkelso commented 5 years ago

LGTM!