alyssa wright ha scritto:
>   Hi all,
> 
> I am labelling a point and find myself with extra points without labels. 
> See the red boxes here:
> 
> http://skitch.com/alyssawright/d1gse/openlayers-map-preview
> 
> It gets better when I remove my vendor options, but it's never perfect.  
> I'm wondering what I might do to mitigate this?

When you want to make sure a point and a label can only appear togheter,
or not appear at all, you can put the Graphic inside the text symbolizer
(yes, this is a non well documented GeoServer specific extension):

<Rule>
   <Name>city1 12.5M_3M</Name>
   <Title>city1 12.5M_3M</Title>
   <ogc:Filter>
     <ogc:Or>
       <ogc:PropertyIsEqualTo>
         <ogc:PropertyName>place</ogc:PropertyName>
         <ogc:Literal>city</ogc:Literal>
       </ogc:PropertyIsEqualTo>
       <ogc:PropertyIsEqualTo>
         <ogc:PropertyName>place</ogc:PropertyName>
         <ogc:Literal>metropolis</ogc:Literal>
       </ogc:PropertyIsEqualTo>
     </ogc:Or>
   </ogc:Filter>
   <MinScaleDenominator>3000000.0</MinScaleDenominator>
   <MaxScaleDenominator>1.25E7</MaxScaleDenominator>
   <TextSymbolizer>
     <Label>
       <ogc:PropertyName>name</ogc:PropertyName>
     </Label>
     <Font>
       <CssParameter name="font-family">SansSerif</CssParameter>
       <CssParameter name="font-size">10</CssParameter>
       <CssParameter name="font-style">normal</CssParameter>
       <CssParameter name="font-weight">normal</CssParameter>
     </Font>
     <LabelPlacement>
       <PointPlacement>
         <AnchorPoint>
           <AnchorPointX>
             <ogc:Literal>0.5</ogc:Literal>
           </AnchorPointX>
           <AnchorPointY>
             <ogc:Literal>0.5</ogc:Literal>
           </AnchorPointY>
         </AnchorPoint>
         <Displacement>
           <DisplacementX>0</DisplacementX>
           <DisplacementY>10</DisplacementY>
         </Displacement>
       </PointPlacement>
     </LabelPlacement>
     <Halo>
       <Radius>
         <ogc:Literal>2</ogc:Literal>
       </Radius>
       <Fill>
         <CssParameter name="fill">#FFFFFF</CssParameter>
         <CssParameter name="fill-opacity">0.5</CssParameter>
       </Fill>
     </Halo>
     <Fill>
       <CssParameter name="fill">#2b2b2b</CssParameter>
     </Fill>
     <Graphic>
       <ExternalGraphic>
         <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink";
           xlink:type="simple" 
xlink:href="file:/pathto/styles/symbols/large-city.png" />
         <Format>image/png</Format>
       </ExternalGraphic>
       <Size>8</Size>
     </Graphic>
     <VendorOption name="autoWrap">100</VendorOption>
     <VendorOption name="spaceAround">20</VendorOption>
     <VendorOption name="allowOverrun">true</VendorOption>
   </TextSymbolizer>
</Rule>

Hope this helps

Cheers
Andrea

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

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Geoserver-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to