Hi Jesse and Michelle:
I am just re-checking back after reviewing the SLD specification;
Regardless it does not change the situation: you can get where you need
to go ;-)
Here is what the SLD spec says (have you downloaded this yet? Document
02-070 from the OGC site):
The ExternalGraphic element allows a reference to be made to an
external graphic
file with a Web URL. The OnlineResource sub-element (discussed in
Section 7.3)
gives the URL and the Format sub-element identifies the expected
document MIME
type of a successful fetch. Knowing the MIME type in advance allows
the styler to select
the best-supported format from the list of URLs with equivalent
content. Users should
avoid referencing external graphics that may change at arbitrary
times, since many
systems may cache or permanently store graphic content for improved
efficiency and
reliability. Graphic content should be static when at all possible.
And now lets look for an example in that doc:
<PointSymbolizer>
<Graphic>
<ExternalGraphic>
<OnlineResource
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://www.vendor.com/geosym/2267.svg"/>
<Format>image/svg+xml</Format>
</ExternalGraphic>
<ExternalGraphic>
<OnlineResource
xmlns:xlink="http://www.w3.org/1999/xlink"
xlink:type="simple"
xlink:href="http://www.vendor.com/geosym/2267.png"/>
<Format>image/png</Format>
</ExternalGraphic>
<Mark/>
<Size>15.0</Size>
</Graphic>
</PointSymbolizer>
So the external graphic is defined as some horrible xlink construct that
cannot be tweaked based on attributes. This
doe make some senseit is a "link" to something else...
We could ask the geotools rendering people to make any "well known" name
that starts with "file:" or ("http:") drawn as an absolute url ...
James - is there any feedback you can give on this problem?
Basically, I have written a icon group manager dialog where users can
create their own groups of icons which are then displayed in a tabbed
pane, on for each group, in a View at the side of the map. So the
first I know about it is when they drop the icon onto a map.
I am not sure if I understand exactly how an sld works yet. If there
is one sld file per shape file(?), then I guess I have to create a new
one for each layer from my code - just string write it out to a file
on the drop of the first icon of that type when I create the new
layer/shapefile, with the icon path hard coded - assuming the External
Graphic can be a local file reference and not just a web address?
You can have a local file reference: (ie a file:// ).
If I understand you correctly you are thinking of having one "layer" for
each kind of icon. That makes sense to me as a user, I would then be
able to shut off all icons of that type as needed...
You could also do the following:
- have a layer for each group of icons, and in that shapefile have a
"type" field that indicates which icon was dropped, associated with that
shapefile your SLD would have a series of rules (one for each type) that
would indicate how that type should be drawn with an external graphic
I hope this helps? I would start small and try out what SLD can do, and
make your decision based on what you get working first.
Is this my only choice? If so, I can go ahead an code for that.
Heh, I am afraid you need to make a design trade-off.
I have not yet figured out how I associated the sld with the shapefile
so that it is used to draw the layer, any
hints/pointer/tutorials/examples?
If you create a file with the same name: ie shapefile.sld and
shapefile.sld it they will be loaded together. You can also just create
an SLD object on the style blackboard when they layer is created.
For examples step through with the debugger and see how a shapefile.sld
file is loaded:
- The data.zip file in the walkthrough has a countries.shp and a
countries.sld that you can use to try this out.
Cheers,
Jody
So it appears I'm wrong about External Graphics. It seems they
have to be known ahead of time. That is a little annoying. How
many graphics will you have? Is it an open set?
Jesse
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel