Open nvkelso opened 7 years ago
Another related funk is I suspect non-tiled GeoJSON is being tiled into 256px tiles when larger 512px blocks would create better labels.
/cc @burritojustice
While there is probably more than this going on in the background, for your second example, have you tried optional: true
on the nested text? Remember it defaults to false
(at your request ;) so that points will only appear if they're text fits too.
Agree that switching internal tiling of non-tiled sources to 512px
is a good idea. Need to look into it.
While there is probably more than this going on in the background, for your second example, have you tried optional: true on the nested text? Remember it defaults to false (at your request ;) so that points will only appear if they're text fits too.
Aha! I do remember now. But the documentation doesn't say anything about that and needs a fix.
https://mapzen.com/documentation/tangram/draw/#text-behavior
However the results with text: { optional: true }
are still less than desired, with seemingly random order instead of listening to the priority
I set (code snippet below) – and the features that do include labels need to be on top of the features without text generally:
priority: |
function() {
var order = 1000 + feature.rank * 100;
if( feature.placetype === 'campus') {
order += 50;
}
return order;
}
Added PR for the documentation change here: https://github.com/tangrams/tangram-docs/pull/223.
@nvkelso change here to tile non-tiled sources to 512px: https://github.com/tangrams/tangram/commit/c7506ba4ee3b16bb6146222e3a82b97197cc8ade
re non-tiled and 256px vs 512px, I suspect it's why I'm not seeing all of the TIGER block labels in this map at z15, when there seems to be plenty of room
The collision logic described here is not working for me:
Says:
- Points collide: false, text collide: true: all points will render, text will render if it fits.
- Points collide: true, text collide: false: points will render if they fit, in which case their attached text will also render, even if it overlaps something else.
points: { collide: false, text: { visible: false } }
All ~600 of my points, yeah!
See: https://mapzen.com/tangram/view/?api=506/875#4.622/40.370/-111.484 Archived as: https://gist.github.com/nvkelso/71168b641677ff9193e8b92f8c9de842
Now let's try to add some labels:
points: { collide: false, text: { collide: true } }
I expect to see many more dots in this view:
points: { collide: false, text: { collide: false } }
This does properly show all dots, but now labels cover all the dots and each other 😿
I really want an option for all the dots to show up, but be under (e.g. not collide) the dots that get labels. So I create a new style using inlay.
When I add a new source under the first layer with the collide settings using the inlay style I finally achieve the design I'm looking for:
Recommendation:
It would be nice to specify something like
order
for the points and ifpoints: { collide: false, text: { collide: true } }
is set than the points that don't get text should be under the points that do, and the priority should also affect the order (worse priority points sometimes cover better priority points, even if their text collides properly using the priority number – see the overlapping San Francisco and San Francisco State University labels).