Reputation: 306
Is it possible to make a label orientation a function of the shape of the polygon it is labeling? Ideally this sort of label placement optimization would come out of the box from Mapbox Studio.
I imagine it's possible with Mapbox GL JS with https://www.mapbox.com/mapbox-gl-style-spec/#layout-symbol-text-rotate, but that seems like it might be a non-trivial JavaScript task in the Land of 10,000 Lakes(?). The end result will be a Mapbox GL served vector basemap.
Medicine Lake default orientation:
Medicine Lake ideal orientation (but I don't necessarily want any other lake label rotated):
Upvotes: 1
Views: 490
Reputation: 3301
The short answer is that it's currently not possible, but we're exploring the possibility of implementing this in future. This is surprisingly hard to do — algorithms for rotated label placement in polygons are very complicated and expensive. Here's the only practical implementation I could find, but it's expensive and could probably be only used as a preprocessing step (generating a point set with angles that you would then upload to Studio): https://d3plus.org/blog/behind-the-scenes/2014/07/08/largest-rect/
Upvotes: 2