Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Support list placement for text #238

Open
gravitystorm opened this issue Jan 15, 2013 · 10 comments
Open

Support list placement for text #238

gravitystorm opened this issue Jan 15, 2013 · 10 comments

Comments

@gravitystorm
Copy link
Contributor

Since mapnik 2.1 you can provide a list of placement options for the textsymbolizer. This is an alternative to the "simple" placement type.

<TextSymbolizer face-name="DejaVu Sans Book" size="16" placement="point" dy="8" fill="blue" placement-type="list">[name]
    <Placement size="10" dy="-8" fill="red"/><!-- Reduces text size and changes offset -->
    <Placement fill="green">[abbreviated_name]</Placement> <!-- size="10", dy="-8", fill="green", shorter text -->
    <Placement fill="orange" dy="8">[nr]</Placement> <!-- size="10", dy="8", fill="orange", shortest text -->
</TextSymbolizer>

(from https://github.com/mapnik/mapnik/wiki/TextSymbolizer )

I don't have a particularly clear idea what the carto syntax would look like for this!

See also mapnik/mapnik-reference#45 , since it's not yet in mapnik-reference either.

@tmcw
Copy link
Contributor

tmcw commented Jan 15, 2013

Cool, need to read up Mapnik's source for this - kind of looks like the <Placement> element can take the same attributes as TextSymbolizer, except for placement, I'd assume? /cc @springmeyer

@springmeyer
Copy link

sounds right @tmcw - its basically a list of multiple text symbolizers. Not sure whether you can, on the fly, switch from something like line placement to point. @herm would.

@gravitystorm
Copy link
Contributor Author

You can't currently flick between placement types (e.g. line -> point), see mapnik/mapnik#1152

@petzlux
Copy link

petzlux commented Jun 19, 2013

Would love to see this supported in CartoCSS (and by extension in Tilemill). At the moment, need to edit XML after export from Tilemill to make use of this feature.

@gravitystorm
Copy link
Contributor Author

@petzlux there's a hack you can use, by writing XML inline within carto, e.g.

      [...]
      text-size: 24;
      text-placement-type: list;
      text-name: "[name]<Placement size='20' /><Placement size='16' />";
      [...]

See also:

@springmeyer
Copy link

btw, landed in mapnik-reference now and carto 0.9.6 now includes this which will go out with next tilemill (> 0.10.1).

@petzlux
Copy link

petzlux commented May 21, 2014

Okay I am a bit confused as I cant find any doc in carto for this feature, is it included in the latest nightlies of tilemill ? And how is the syntax in Carto ?

@springmeyer
Copy link

it is a hack and therefore is intentionally undocumented. The only documentation is #238 (comment). #347 is what it is going to take to make this officially supported.

@kocio-pl
Copy link

Is there a chance to add this support into the Carto? It allows to fine tune the style.

@nebulon42
Copy link
Collaborator

Definitely. The main shortcoming for CartoCSS here at the moment are developers who are willing to submit patches. However, for this specifically it will be first necessary to find a proper way to represent this in CartoCSS (see #347). There is a unfinished PR that needs to be picked up and probably rewritten from scratch.

Current plans are to release 1.0 in early 2018 without this and tackle this afterwards.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants