Skip to content
This repository has been archived by the owner on Apr 10, 2018. It is now read-only.

combine text and icons into symbol render type #67

Closed
ansis opened this issue Jun 24, 2014 · 8 comments
Closed

combine text and icons into symbol render type #67

ansis opened this issue Jun 24, 2014 · 8 comments
Milestone

Comments

@ansis
Copy link
Contributor

ansis commented Jun 24, 2014

I think we need to replace the text and icon render types with a combined symbol render type. This would allow us to place text and points only if they can both be placed, and more importantly allow placement to be interwoven. Both the icon and text for a feature would be placed before moving onto the next feature. If all icons are placed for a group of features before all text is (or the other way around), then the layer placed first blocks too much from the second. Every gl style so far has this problem.

Styles would change very little. The render type for both text and icons layers would change to "symbol". These layers would then be able to specify both text-* and icon-* render and style properties.

@kkaefer @yhahn @mourner


Other approaches that seem worse:

Multiple render types per layer. This makes layers more complex just to handle a single special case.

Having only text-* and letting icons be used in text-field. This makes text field replacement way more complicated. Getting the right offsets would be hacky. It also isn't flexible enough to allow different relative positions, for example a point on the exact feature with text s/n/e/w of it.

Handle the interweaving problem by letting later layers change the placement values for earlier layers' features. You'd need to add some priority value to each item that would get compared against colliding items' priorities. The priority would get incremented for each feature in the layer to simulate interweaving. This seems complicated.

@mourner
Copy link
Member

mourner commented Jun 24, 2014

@ansis I suggested the first approach earlier mapbox/mapbox-gl-js#319 (comment), and I'm up for it. :) Relatively simple and should be a great improvement.

The only problem with this is that having type "symbol", but different prefixes ("text-" and "icon-", and potentially "circle-") deviates from all other types and breaks consistency, which may cause confusion. But if we can document and explain it well, it'll be fine.

@mourner mourner added the v3 label Jun 24, 2014
@ansis
Copy link
Contributor Author

ansis commented Jun 24, 2014

@mourner you're right! I knew I had seen the idea mentioned somewhere

Having different prefixes is a bit weird, but I think this would be the only case. circle-* should be a completely separate render type.

@nickidlugash
Copy link
Contributor

Would we be able to incorporate the concept of shields into this as well? #36

@mourner
Copy link
Member

mourner commented Jun 24, 2014

circle-* should be a completely separate render type.

I don't think so, since we need to place labeled circles (like icons) as well.

@nickidlugash
Copy link
Contributor

circle-* should be a completely separate render type.

I don't think so, since we need to place labeled circles (like icons) as well.

What is a circle? Is this comparable to the default marker in carto (i.e. if you don't specify a marker icon file, a filled circle gets drawn)? If so, I prefer circles and icons to be specified similarly, since conceptually they are the same.

@mourner
Copy link
Member

mourner commented Jun 24, 2014

Comparable, the only styling difference being that circle radius is flexible and can be transitioned.

@ansis
Copy link
Contributor Author

ansis commented Jun 24, 2014

Would we be able to incorporate the concept of shields into this as well?

Yes, the image kind. The rectangular type might need something special.

@ansis
Copy link
Contributor Author

ansis commented Jul 3, 2014

done in #79

@ansis ansis closed this as completed Jul 3, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants