Hi,

Maybe i´ m a little bit too late...I´m not a geotools expert, but maybe I can 
help.

>if you want to have a background shape that "sticks" to the label how do you 
>do that?

I think that the TextSymbolizer2 could solve your problem.  You can add your 
CircleMark to this textSymbolizer so your PointSymbolizer is not necessary for 
your label background.

TextSymbolizer2 textSymbolizer = 
(TextSymbolizer2)styleFactory.createTextSymbolizer(...);
textSymbolizer.setGraphic(graphic);

I

Von: Matthew Kerle [mailto:[email protected]]
Gesendet: Mittwoch, 14. April 2010 11:01
An: Andrea Aime
Cc: [email protected]
Betreff: Re: [Geotools-gt2-users] how to get geotools to draw overlapping 
features?

thanks Andrea!

 that link actually makes a lot of sense of some other things I was wrestling 
with in geotools (eg PointPlacement/ AnchorPoints/Displacement), I didn't 
realise that geoserver had such good doco that was missing from geotools (eg - 
what units they're in, we thought both were pixels, half right...)

two more questions if you don't mind...

first, in geotools the conflictresolution property in geotools seems to crop up 
in the LabelCacheItem class deep inside the StreamingRenderer, how can I 
configure the renderer to pass this through? from google it looks like this was 
added in GEOT-2437, but what with the recent Jira hacking and all it looks like 
it's down at the moment and the google cache doesn't have a lot of detail. you 
were the developer on that issue, can you give me some pointers on how to set 
conflictResolution=false on my TextSymbolizer?  something like this: 
textSymbolizer.getOptions().put("conflictResolution", "true");?

second, I'm drawing my TextSymbolizer on top of a PointSymbolizer set with a 
circle Mark. this works fine 95% of the time except when the underlying 
polygons are partially off-screen, in that case the textsymbolizer seems to 
take the intersect of the underlying polygon and the viewport, and position 
itself in the center of that area (as it should). However the background 
PointSymbolizer doesn't, it remains in the center of the feature geometry, 
which means that when the feature geometry is occluded by the viewport the 
label wanders off its background... Am I doing it wrong? if you want to have a 
background shape that "sticks" to the label how do you do that?

thanks again!
On 14 April 2010 15:39, Andrea Aime 
<[email protected]<mailto:[email protected]>> wrote:
Matthew Kerle ha scritto:

Hi guys!

geotools newbie here so apologies in advance if this is a silly question or if 
I abuse terminology...

I'm writing a custom layer engine for a 3rd party application that uses 
geotools to draw custom rendering. I have data that occurs multiple times per 
single location (fire unit responses) over many addresses, so I'm drawing a 
TextSymbolizer of the integer count on top of the address to indicate how many 
incidents occured there. this is all good, but the problem I'm having is that 
as you zoom out the labels start to cluster together and then geotools stops 
drawing some of the symbols as they overlap, so it looks like there are fewer 
points of interest overall.

eg at max zoom you might see 20 addresses with incidents and associated counts. 
zoom out to double, they move together and half the labels disappear, double 
again and another half disappear, and so on til only one remains.

I understand the technical reasons for this happening, but I know the client is 
going to insist they see all incidents, even if they overlap or occlude. I can 
manually change the drawing styles (not using SLDs, directly doing this in 
Java) to use a different style at higher scales (eg just a small circle), but 
I'm wondering if there's a way I can tell geotools not to perform this 
optimisation so that even at high scale you can still see overlapping symbols?

You're probably looking for:
<VendorOption name="conflictResolution">false</VendorOption>

See:
http://geoserver.org/display/GEOSDOC/LabelingOptions
(it's GeoServer docs, but GeoServer uses the GeoTools renderer)

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

------------------------------------------------------------------------------
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to