Thanks Jody. I was afraid that it might come down to SLD styles. I fair
that it will be more work to put together an SLD style to do what I want
because of the complexity of what I need to do. I have a feeling that I
am heading down the wrong path with this now.
I have a "Road Event" WFS layer (points). Road events are of different
types (hazard, road works, etc) and have different statuses (open,
closed, deleted). For each road event I have to display an icon that
represents the type and the status (eg, a roadworks symbol with an O for
open). That's cool, I am doing that with SLD rules like the one you
provided.
The problem arises when I want to filter what events are displayed on
the map. For example, the user can enter the start date and end date,
filter on type, etc. The problem would be that the events would still be
returned by a query on the layer - ie, when I click to create a new road
event it checks that there is not one there already...
bah... this is getting WAY too off topic... sorry. I'll have to stop and
have a bit of a think about where I am going with this.
Thanks for your help once again.
Mark
Jody Garnett wrote:
Mark Presling wrote:
Hi All.
I'm afraid I have another annoying question for you. I have a WFS
layer on my map and I want to be able to filter what features are
returned from the server by applying a Filter to the layer. The
filter will be built up based on some input fields in a form. I guess
I am trying to achieve the same as this:
http://www.geotools.org/display/GEOTOOLS/Filters
I understand the need, and I have an architect's response for you ...
aka where such code should exisit, and how it may be obtained with our
existing infrastructure.
But first I have a question, are you doing this to obtain a
visualization (or to limit yourself to a subset of data for
processing? Since you mention map and layer I will guess you are
concerned with display?
The only difference is that I want the BasicFeatureRenderer to do
that for me when I supply the layer/renderer/whatever a filter to
use. I'm not actually trying to search for Features myself, I just
want them displayed on the map as the Filter provides. Can this be done?
And that confirms it ...
Okay you need to look into the geotools Style construct. This follows
the Style Layer Descriptor specification (from the OGC) and can be
used to dictate what information is displayed on the screen.
If you go to the Style Editor in uDig you can see and advanced tab
(where you can import, export and see the raw XML used to control the
display). You will find an existing rule like this:
To start out with use the Themer on a polygon layer to get an outline
of what is needed, delete all but one of the rules and then play with
the filter used....
<sld:FeatureTypeStyle>
<sld:FeatureTypeName>citiesx020</sld:FeatureTypeName>
<sld:Rule>
<sld:Name>rule01</sld:Name>
<ogc:Filter>
<ogc:And>
<ogc:CompareGreaterThan>
<ogc:Literal>100000</ogc:Literal>
<ogc:PropertyName>POP_2000</ogc:PropertyName>
</ogc:PropertyIsLessThanOrEqualTo>
<ogc:PropertyIsLessThan>
<ogc:PropertyName>NDP</ogc:PropertyName>
<ogc:Literal>5723</ogc:Literal>
</ogc:PropertyIsLessThan>
</ogc:And>
</ogc:Filter>
You can use any number of symbolizers after the rule to display the
selected features.
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name="fill">
<ogc:Literal>#FFFFCC</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name="fill-opacity">
<ogc:Literal>0.5</ogc:Literal>
</sld:CssParameter>
</sld:Fill>
<sld:Stroke>
<sld:CssParameter name="stroke">
<ogc:Literal>#000000</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name="stroke-linecap">
<ogc:Literal>butt</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name="stroke-linejoin">
<ogc:Literal>miter</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name="stroke-opacity">
<ogc:Literal>1</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name="stroke-width">
<ogc:Literal>1</ogc:Literal>
</sld:CssParameter>
<sld:CssParameter name="stroke-dashoffset">
<ogc:Literal>0</ogc:Literal>
</sld:CssParameter>
</sld:Stroke>
</sld:PolygonSymbolizer>
</sld:Rule>
The trick is nothing says that every feature needs to be covered by a
rule, and features that are not covered by a rule will not be
displayed....
Have fun!
Jody
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
--
This message has been scanned for viruses and dangerous
content by MailScanner, and is believed to be clean.
begin:vcard
fn:Mark Presling
n:Presling;Mark
email;internet:[EMAIL PROTECTED]
tel;home:+6442322774
tel;cell:+6421549540
version:2.1
end:vcard
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel