Hi! Right, I downloaded the data.zip and had a play. I tried to write a sld for the bc_hospitals shapefile as this seemed to be a point shapefile. I read the SLD spec and produced what I thought was a correct sld file, with the correct name (bc_hospitals.sld). But UDIG does not draw the layer when I drop the bc_hospitals.shp file onto a map (that has one other layer of bc_bounrder.shp).
I tried opening the StyleEditor for the bc_hospitals layer, and looking at the XML. I tried to validate it, to see if it could tell me what was wrong. Udig just went off and never came back. I waited 10 minutes and crashed out. So I am a bit stuck. I have attached my bc_hospitals.sld file and the png file I am trying to use for this test. (you will need the edit the href in the sld file to point to wherever you put the ong file) Can someone figure out what I am doing wrong? Thanks Michelle -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jody Garnett Sent: 17 March 2006 11:22 To: User-friendly Desktop Internet GIS; [EMAIL PROTECTED] Subject: [udig-devel] Icon + SLD at Runtime 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
bc_hospitals.sld
Description: bc_hospitals.sld
house2.PNG
Description: house2.PNG
_______________________________________________ User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel