Hi Mauro!

I've been involved in other issues but now I'm come back on this one.

Searching on the web I've found that probably there is a bug on GeoServer
about this functionality (ref: https://jira.codehaus.org/browse/GEOS-5228.
See also discussion
http://comments.gmane.org/gmane.comp.gis.geoserver.user/39166),  and this
is a point, bad point but a point.

https://jira.codehaus.org/browse/GEOS-5228. See also discussion
http://comments.gmane.org/gmane.comp.gis.geoserver.user/39166.

So I'm started form your suggestion and now I've found a little workaround
that seems working quite fine using a single SLD and avoiding to use a
GroupLayer too.

Here you are my new SLD

<?xml version="1.0" encoding="ISO-8859-1"?>
  <StyledLayerDescriptor version="1.0.0"
   xsi:schemaLocation="http://www.opengis.net/sld StyledLayerDescriptor.xsd"
   xmlns="http://www.opengis.net/sld";
   xmlns:ogc="http://www.opengis.net/ogc";
   xmlns:xlink="http://www.w3.org/1999/xlink";
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
    <NamedLayer>
      <Name>Cluster points</Name>
      <UserStyle>
      <!-- Styles can have names, titles and abstracts -->
        <Title>Cluster points</Title>
        <Abstract>Styling using cluster points server side</Abstract>
        <FeatureTypeStyle>
          <Transformation>
            <ogc:Function name="gs:PointStacker">
              <ogc:Function name="parameter">
                <ogc:Literal>data</ogc:Literal>
              </ogc:Function>
              <ogc:Function name="parameter">
                <ogc:Literal>cellSize</ogc:Literal>
                <ogc:Literal>30</ogc:Literal>
              </ogc:Function>
              <ogc:Function name="parameter">
                <ogc:Literal>outputBBOX</ogc:Literal>
                <ogc:Function name="env">
               <ogc:Literal>wms_bbox</ogc:Literal>
                </ogc:Function>
              </ogc:Function>
              <ogc:Function name="parameter">
                <ogc:Literal>outputWidth</ogc:Literal>
                <ogc:Function name="env">
               <ogc:Literal>wms_width</ogc:Literal>
                </ogc:Function>
              </ogc:Function>
              <ogc:Function name="parameter">
                <ogc:Literal>outputHeight</ogc:Literal>
                <ogc:Function name="env">
                  <ogc:Literal>wms_height</ogc:Literal>
                </ogc:Function>
              </ogc:Function>
            </ogc:Function>
          </Transformation>
        <Rule>
          <Name>rule1</Name>
          <Title>Singoli punti</Title>
          <MinScaleDenominator>2000</MinScaleDenominator>
          <PointSymbolizer>
            <Graphic>
              <Mark>
                <WellKnownName>circle</WellKnownName>
                <Fill>
                  <CssParameter name="fill">#ff0000</CssParameter>
                </Fill>
              </Mark>
              <Size>6</Size>
            </Graphic>
          </PointSymbolizer>
        </Rule>
          <Rule>
            <Name>ruleGT1</Name>
            <Title>Cluster</Title>
            <ogc:Filter>
              <ogc:PropertyIsGreaterThan>
                <ogc:PropertyName>count</ogc:PropertyName>
                <ogc:Literal>1</ogc:Literal>
              </ogc:PropertyIsGreaterThan>
            </ogc:Filter>
            <MaxScaleDenominator>10000000</MaxScaleDenominator>
            <PointSymbolizer>
              <Graphic>
                <Mark>
                  <WellKnownName>circle</WellKnownName>
                  <Fill>
                    <CssParameter name="fill">#ff0000</CssParameter>
                  </Fill>
                </Mark>
                <Size>22</Size>
              </Graphic>
            </PointSymbolizer>
            <TextSymbolizer>
              <Label>
                <ogc:PropertyName>count</ogc:PropertyName>
              </Label>
              <Font>
                <CssParameter name="font-family">Arial</CssParameter>
                <CssParameter name="font-size">12</CssParameter>
                <CssParameter name="font-weight">bold</CssParameter>
              </Font>
              <LabelPlacement>
                <PointPlacement>
                  <AnchorPoint>
                    <AnchorPointX>0.5</AnchorPointX>
                    <AnchorPointY>0.8</AnchorPointY>
                  </AnchorPoint>
                </PointPlacement>
              </LabelPlacement>
              <Halo>
                 <Radius>2</Radius>
                 <Fill>
                   <CssParameter name="fill">#ff0000</CssParameter>
                   <CssParameter name="fill-opacity">0.9</CssParameter>
                 </Fill>
              </Halo>
              <Fill>
                <CssParameter name="fill">#FFFFFF</CssParameter>
                <CssParameter name="fill-opacity">1.0</CssParameter>
              </Fill>
            </TextSymbolizer>
          </Rule>
        </FeatureTypeStyle>
      </UserStyle>
    </NamedLayer>
  </StyledLayerDescriptor>

I've tried to use it using GeoExplorer and also using QGIS as WMS service
client and it's working.

NOTE: in this manner, I don't know why,  I can also identify point cluster
too.... :-)

Thanks for the suggestions and I hope this could be useful for others!!

 Bye

 Cesare

Cesare Gerbino

http://cesaregerbino.wordpress.com/
http://www.facebook.com/cesare.gerbino
http://www.facebook.com/pages/Cesare-Gerbino-GIS-Blog/246234455498174?ref=hl
https://twitter.com/CesareGerbino
http://www.linkedin.com/pub/cesare-gerbino/56/494/77b



2014-06-03 9:04 GMT+02:00 Mauro Bartolomeoli <
mauro.bartolome...@geo-solutions.it>:

> Hi Cesare,
> I think the problem is that rendering transformations are not correctly
> supported, currently, in GetFeatureInfo.
> Your SLD is correct, but is referring a property (count) that is in the
> transformed feature (PointStacker) but not in your original one, while the
> GetFeatureInfo code tries to apply the filter to your original feature and
> so it fails.
> Maybe you could try using a layergroup where the pointstacker is used only
> until a certain scale, and then the original layer is used for lower scales.
>
> Mauro Bartolomeoli
>
>
> 2014-05-31 17:57 GMT+02:00 cesare gerbino <cesaregerb...@gmail.com>:
>
>> I'm a newbie to use GeoServer and SLDs so, sorry in advance if my
>> question is stupid.
>>
>> I'm trying to use the Point Stacker rendering transfomation for to
>> cluster my point layer. I've a POSTGIS point layer with more than 514.000
>> points (all the OSM addresses in Italy ....), and so I can't to render them
>> with a simple "red point" in my map and I can't render them using a
>> clustering in the browser using Leaflet, OpenLayers, ecc ...
>>
>> The structure of my POSTGIS layer is the following
>> field_1 BigDecimal true 0/1 field_2 BigDecimal true 0/1 field_3
>> BigDecimal true 0/1 field_4 String true 0/1 geom Point true 0/1
>>
>> The field I'm interested on is "field_4"
>>
>> If I try to use a default point symbol to render my layer the
>> visualization is obviously slow but it works right and I can also to
>> identify my point.
>>
>> I've tried to use the SLD that I've found here
>> http://suite.opengeo.org/opengeo-docs/cartography/rt/pointstacker.html
>> for clustering server side and it's working for mapping my layer as
>> clustered points.
>>
>> I shoud add more classes in my SLD style and I'll do it, but at the
>> moment the issue is that, using cluster, I can't identify points, not when
>> they'are clustered (I don't want this ....), but when they are rappresented
>> as single point.
>>
>> The error is "internal error occurred Property 'count' could not be found
>> in osm_civici": I haven't that field in my layer but I've seen that is a
>> "field" used in the SLD style ....
>>
>> NOTE: I'm using the SLD style found in OpenGeo Suite documentation at
>> http://suite.opengeo.org/opengeo-docs/cartography/rt/pointstacker.html
>> "as-is" and probably there is something to change but I don't know what
>> ....
>>
>> I'm using OpenGeoSuite Version 4.0.2 on Windows 7 (GeoServer 2.4-SNAPSHOT
>> Git Revision f295d37d70c3b1f0e51942e8b031253e4d75459 Build Date 20-Jan-2014
>> 22:29)
>>
>> Thank you very much in advance!
>> Cesare Gerbino
>>
>> http://cesaregerbino.wordpress.com/
>> http://www.facebook.com/cesare.gerbino
>>
>> http://www.facebook.com/pages/Cesare-Gerbino-GIS-Blog/246234455498174?ref=hl
>> https://twitter.com/CesareGerbino
>> http://www.linkedin.com/pub/cesare-gerbino/56/494/77b
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Time is money. Stop wasting it! Get your web API in 5 minutes.
>> www.restlet.com/download
>> http://p.sf.net/sfu/restlet
>> _______________________________________________
>> Geoserver-users mailing list
>> Geoserver-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>>
>
>
> --
> ==
> Meet us at GEO Business 2014! in London! Visit http://goo.gl/fES3aK
> for more information.
> ==
>
> Dott. Mauro Bartolomeoli
> @mauro_bart
> Senior Software Engineer
>
> GeoSolutions S.A.S.
> Via Poggio alle Viti 1187
> 55054  Massarosa (LU)
> Italy
> phone: +39 0584 962313
> fax:     +39 0584 1660272
>
> http://www.geo-solutions.it
> http://twitter.com/geosolutions_it
>
> -------------------------------------------------------
>
------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to