Hi Chris,

I hope it's not a big deal to bring this to the users list; in general I
prefer to answer CSS questions there so Google can help the next person to
have your problem ;)

Yes, the docs are a bit confusing. (It's a common trap for developers - in
SLD, styled marks rely heavily on nested XML structure, so finding a decent
way to encode this in CSS was kind of tricky.  Then when I wrote up the
documentation I only gave an example of the most complicated case - using
multiple different symbols with different styling.  If you have suggestions
on clarifying the documentation here I would be happy to incorporate some
edits.)

Anyway, for basic styled marks, it's fairly straightforward: you can think
of the mark as a new, polygon geometry and use stroke and fill parameters
for that.  A rule with ":mark" in its selector will match these synthetic
geometries (":stroke", ":fill", and ":shield" work for geometries generated
for stroke patterns, fill patterns, and label shields respectively, and you
can also use ":symbol" to match any generated symbol.)

You need *at least two* rules: one to generate this synthetic geometry, and
one to style it (but as a convenience, if you don't style it it will have a
grey/black theme.)

* {
  mark: symbol('circle');
}

* :mark {
  fill: red;
  stroke: black;
}

Or, specifically for the example you gave:

[@scale>34000000][@scale<69000000][longest_runway_ft>8000]{****

  mark: symbol('circle');****

  mark-size: 2;

  halo-radius: 3;****

  halo-color: #FFFFFF;****

  label: [icao_identifier];****

  label-offset: 0.0 0.0;****

  label-anchor: 0 0.5;****

  -gt-label-padding: 20;****

  -gt-label-priority: [longest_runway_ft];****

}


[@scale>34000000][@scale<69000000][longest_runway_ft>8000]

:mark {

  fill: #FF0000;

}


--

David Winslow

OpenGeo - http://opengeo.org/

On Tue, Mar 6, 2012 at 6:30 AM, Chris Haste <[email protected]> wrote:

> Hi David,****
>
> ** **
>
> I hope you will forgive the direct email.****
>
> ** **
>
> I have been evaluating your CSS styling module for Geoserver. I am
> relatively new to Geoserver fullstop, but must say that I think the CSS
> option is a massive improvement over having to work with SLD, so a big
> thank you for the work being done in this area.****
>
> ** **
>
> My question is probably quite a simple one but for the life of me I cannot
> find the answer anywhere!****
>
> ** **
>
> I wish to use marks on my map (circles) and I wish them to be coloured
> based on an attribute of the data. I don’t seem to be able to get any
> colour info to a symbol using CSS. I looked at the example of a hospital
> symbol, which would imply that it can be done, but I couldn’t try this as I
> didn’t know how to reference the ‘hospital’ as a mark (I tried – mark:
> symbol(‘hospital’) but that didn’t work).****
>
> ** **
>
> As an example here is a CSS rule that I am defining:****
>
> [@scale>34000000][@scale<69000000][longest_runway_ft>8000]{****
>
>   mark: symbol('circle');****
>
>   mark-size: 2;****
>
>   fill: #FF0000;****
>
>   halo-radius: 3;****
>
>   halo-color: #FFFFFF;****
>
>   label: [icao_identifier];****
>
>   label-offset: 0.0 0.0;****
>
>   label-anchor: 0 0.5;****
>
>   -gt-label-padding: 20;****
>
>   -gt-label-priority: [longest_runway_ft];****
>
> }****
>
> ** **
>
> The fill:#FF0000; line is where I am expecting it to render red circles,
> but I just get grey ones!****
>
> ** **
>
> I think this problem is a result of what I am doing and not necessarily a
> bug etc. so I would appreciate if you could tell me where I’m going wrong?
> ****
>
> ** **
>
> Many thanks****
>
> ** **
>
> Chris****
>
> ** **
> *** This communication has been sent from World Fuel Services
> Corporation or its subsidiaries or its affiliates for the intended
> recipient
> only and may contain proprietary, confidential or privileged information.
> If you are not the intended recipient, any review, disclosure, copying,
> use, or distribution of the information included in this communication
> and any attachments is strictly prohibited. If you have received this
> communication in error, please notify us immediately by replying to this
> communication and delete the communication, including any
> attachments, from your computer. Electronic communications sent to or
> from World Fuel Services Corporation or its subsidiaries or its affiliates
> may be monitored for quality assurance and compliance purposes.***
>
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to