From: Andrea A. <aa...@op...> - 2009-04-16 07:12:08
|
Graham Davis ha scritto: > This may not be the best place to ask this question, but I'm trying to > do something with SLD in uDig which I believe uses GeoTools for SLD stuff. > > I'm looking at ways to display multiple routes that overlap so that each > route is visible side-by-side. One idea was to use SLD to style the > lines with images that have transparent offsets in them. For instance, > line 1 would be red and be drawn as normal, line 2 would be green and > would have 2 transparent pixels above the green part the line graphic > (so that the red line still appeared and so the green line appeared > displaced by 2 pixels). I have this idea working somewhat in my > examples, however, I am not satisfied with how the graphicstroke draws > graphics along a line. There are gaps/spaces at every vertex. I've > tried searching for various cssparameters and other rules to prevent > this, but nothing seems to work. No matter what I do, there are always > gaps. Here is an example linesymbolizer from my SLD. You don't say which version of GeoTools you're using. Anyways, I've been playing with this topic a bit in my spare time some months ago and I could not find any satisfactory solution. The renderer is playing blind here, it has a square/rectangular block that has to be painted along a line and when a corner is reached there are various policies that can be taken: - stop at the last full image that can be drawn along the line - have the image be full drawn even if it extends past the end of the line - cut the image and reach the end of the block - keep on following the line and just find a point that's far enough from the last one reached to draw a full image block, forgetting about the corner itself Basically each policy works in some cases but not in others. In your case you are trying to fake a continuous line so approach 3 seems to be the one that works best, but other times you're trying to depict a line with circles or other symbols that you don't want to get partially drawn or superimposed at corners, so approach 1 or 4 work better. This would need to be handled using some vendor parameter controlling how the graphics is being stroked along the line, which is doable, and I would like to implement before FOSS4G 2009. Maybe I'll tackle this problem during summer vacations. > Also, I notice > various email threads and forum postings about maybe having a > displacement/offset attribute added for lines. Is this already part of > the 1.1.0 SLD spec, or something new? Does GeoTools implement 1.0.0 or > 1.1.0 of the SLD spec? StreamingRenderer/ShapefileRenderer implements version 1.0.0 of the spec. Implementing v1.1.0 is beyond reach for a weekend project, it would take quite some time and thus needs some sponsoring. Cheers Andrea |