Thanks very much for the response, Dane

Scripting the rules to be created automatically based on the values in the
data sounds like a good idea - the resulting style rules will still be
pretty bloated, but it's certainly better than having to hard-code each
combination into the XML ;)

Thanks

a.

-----Original Message-----
From: Dane Springmeyer [mailto:[email protected]] 
Sent: 04 August 2011 12:21 AM
To: Alastair Aitchison
Cc: [email protected]
Subject: Re: [Mapnik-users] Setting TextSymbolizer attributes from data
fields

Hi Alastair,

I see we missed responding to this question earlier and you have another one
you just sent (which is just fine). Anyway, I'll respond to both, in
order...

See below inline...

On Jul 16, 2011, at 10:38 AM, Alastair Aitchison wrote:

> Hi,
>  
> I have a shapefile containing details of all text labels to appear on the
map. Each text element in the shapefile contains attributes including
FONTHEIGHT, FONTCOLOUR, and FONTTYPE, which I'd like to map to the "size",
"fill", and "face_name" properties of the TextSymbolizer applied to this
layer, but I seem to be unable to do so.

Right, Mapnik does not currently support reading from features to control
symbolizers with the exception of Text labels and for constructing paths to
image symbols.

> In other words, I'd like to use syntax such as this in my styles.xml file:
>  
> <Style name="text">
>     <Rule>
>       <TextSymbolizer
>           name="NAME"
>           face_name="FONTTYPE"
>           size="FONTHEIGHT"
>           fill="FONTCOLOUR"
>           />
>     </Rule>
> </Style>
>  
> However, it seems that the only property from the TextSymbolizer that can
be (and indeed *has* to be) mapped to a field from the data layer is the
"name" field.

Yes.

> How do I set values for the other properties based on attributes in the
data? (The only way I've been successful so far is to create a ton of
<Rule>s to filter for each combination of type/size/colour, but there's got
to be a better way!)

Not yet, but you are welcome to file a ticket for this at trac.mapnik.org.
In the meantime it sounds like scripting the <Rules> based on querying your
data might be easiest.

>  
> Thanks for any advice!
> _______________________________________________
> Mapnik-users mailing list
> [email protected]
> https://lists.berlios.de/mailman/listinfo/mapnik-users

-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1390 / Virus Database: 1518/3807 - Release Date: 08/03/11

_______________________________________________
Mapnik-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/mapnik-users

Reply via email to