[Geoserver-users] SLD class creation issue‏

Hi to all,

I'm quite new to GeoServer (currently using the 2.1 RC3 version), i have a few questions about SLDs.

I'm styling a vector layer that has many polygons on which i project data which covers a numeric range. When the data range is really large (i.e. from 1-9Bil) the time it takes to render the layer is really long and i can see a lot of postgres processes running. Conversley, when the data range is small (i.e 1-100) the rendering is very fast.

Also the number of classes generated (6) is equal regardless of the data range.

Is there a way of optimizing the SLDs classes creation when the data range is large? The SLD is generated using the GeoServer SLD Service which uses the following rule:

<sld:Rule>
      <sld:Title> &gt; 153.45 AND &lt;= 291.42</sld:Title>
      <ogc:Filter>
        <ogc:PropertyIsLessThanOrEqualTo>
          <ogc:Literal>291.42</ogc:Literal>
          <ogc:PropertyName>quantity</ogc:PropertyName>
        </ogc:PropertyIsLessThanOrEqualTo>
      </ogc:Filter>
      <sld:PolygonSymbolizer>
        <sld:Fill>
          <sld:CssParameter name="fill">#E6AA91</sld:CssParameter>
        </sld:Fill>
      </sld:PolygonSymbolizer>
</sld:Rule>

Maybe i'm missing something quite obvious, any help would be most appreciated
Thanks,
Simone

On Mon, Apr 18, 2011 at 10:00 AM, Murzilli, Simone (ESA)
<Simone.Murzilli@anonymised.com> wrote:

Hi to all,

I'm quite new to GeoServer (currently using the 2.1 RC3 version), i have a few questions about SLDs.

I'm styling a vector layer that has many polygons on which i project data which covers a numeric range. When the data range is really large (i.e. from 1-9Bil) the time it takes to render the layer is really long and i can see a lot of postgres processes running. Conversley, when the data range is small (i.e 1-100) the rendering is very fast.

Also the number of classes generated (6) is equal regardless of the data range.

Is there a way of optimizing the SLDs classes creation when the data range is large? The SLD is generated using the GeoServer SLD Service which uses the following rule:

<sld:Rule>
<sld:Title> &gt; 153.45 AND &lt;= 291.42</sld:Title>
<ogc:Filter>
<ogc:PropertyIsLessThanOrEqualTo>
<ogc:Literal>291.42</ogc:Literal>
<ogc:PropertyName>quantity</ogc:PropertyName>
</ogc:PropertyIsLessThanOrEqualTo>
</ogc:Filter>
<sld:PolygonSymbolizer>
<sld:Fill>
<sld:CssParameter name="fill">#E6AA91</sld:CssParameter>
</sld:Fill>
</sld:PolygonSymbolizer>
</sld:Rule>

Maybe i'm missing something quite obvious, any help would be most appreciated

I'd check if the data store configuration uses prepared statements. If
so, please go and disable them.
Prepared statements offer better security against sql injection and
some performance improvement
if the queries made are all "similar", but if you mix very selective
queries with ones that are not
the database is probably going to make a wrong choice of access plan.
In your case it probably
decided to use an index based on the interval filter, but if the
interval is very large, not selective
at all, that choice is going to be very poor

Cheers
Andrea

--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 333 8128928

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------

Thanks Andrea for the answer,

I'm not sure if i fully understood what you mean, i'm not running any specific query, i'm using just the REST calls, i don't know if there is any specific data store configuration. Can u let me know how can i check this?

I just noted that there is a lot of postgres activities before the layer is rendered and also the default polygon style takes a while to render the layer.

here is the URL with the default polygon SLD (it takes a long time):
http://fenix.fao.org:8050/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=fenix:prj_445744375&styles=polygon&bbox=-180.0,-55.9794960021973,180.0,83.1106185913086&width=854&height=330&srs=EPSG:4326&format=application/openlayers

here is the URL that uses the SLD with the classes (it takes a long time):
http://fenix.fao.org:8050/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=fenix:prj_445744375&styles=&bbox=-180.0,-55.9794960021973,180.0,83.1106185913086&width=854&height=330&srs=EPSG:4326&format=application/openlayers

and also using the World layer (that contains more polygons), the rendering is much faster:
http://fenix.fao.org:8050/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=fenix:zzlayer_gaul0&styles=polygon&bbox=-180.0,-89.9,180.0,83.627&width=684&height=330&srs=EPSG:4326&format=application/openlayers

Do you have any idea? :slight_smile:

Thanks again,
Simone

________________________________________
Da: andrea.aime@...84... [andrea.aime@...84...] per conto di Andrea Aime [andrea.aime@...1107...]
Inviato: lunedì 18 aprile 2011 10.22
A: Murzilli, Simone (ESA)
Cc: geoserver-users@lists.sourceforge.net
Oggetto: Re: [Geoserver-users] SLD class creation issue‏

On Mon, Apr 18, 2011 at 10:00 AM, Murzilli, Simone (ESA)
<Simone.Murzilli@...672...> wrote:

Hi to all,

I'm quite new to GeoServer (currently using the 2.1 RC3 version), i have a few questions about SLDs.

I'm styling a vector layer that has many polygons on which i project data which covers a numeric range. When the data range is really large (i.e. from 1-9Bil) the time it takes to render the layer is really long and i can see a lot of postgres processes running. Conversley, when the data range is small (i.e 1-100) the rendering is very fast.

Also the number of classes generated (6) is equal regardless of the data range.

Is there a way of optimizing the SLDs classes creation when the data range is large? The SLD is generated using the GeoServer SLD Service which uses the following rule:

<sld:Rule>
     <sld:Title> &gt; 153.45 AND &lt;= 291.42</sld:Title>
     <ogc:Filter>
       <ogc:PropertyIsLessThanOrEqualTo>
         <ogc:Literal>291.42</ogc:Literal>
         <ogc:PropertyName>quantity</ogc:PropertyName>
       </ogc:PropertyIsLessThanOrEqualTo>
     </ogc:Filter>
     <sld:PolygonSymbolizer>
       <sld:Fill>
         <sld:CssParameter name="fill">#E6AA91</sld:CssParameter>
       </sld:Fill>
     </sld:PolygonSymbolizer>
</sld:Rule>

Maybe i'm missing something quite obvious, any help would be most appreciated

I'd check if the data store configuration uses prepared statements. If
so, please go and disable them.
Prepared statements offer better security against sql injection and
some performance improvement
if the queries made are all "similar", but if you mix very selective
queries with ones that are not
the database is probably going to make a wrong choice of access plan.
In your case it probably
decided to use an index based on the interval filter, but if the
interval is very large, not selective
at all, that choice is going to be very poor

Cheers
Andrea

--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 333 8128928

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------

On Mon, Apr 18, 2011 at 11:15 AM, Murzilli, Simone (ESA)
<Simone.Murzilli@anonymised.com> wrote:

Thanks Andrea for the answer,

I'm not sure if i fully understood what you mean, i'm not running any specific query, i'm using just the REST calls, i don't know if there is any specific data store configuration. Can u let me know how can i check this?

Prepared statement usage cannot be modified from WMS requests, you
have to be an administrator
and check the datastore configuration, the flag is there

Cheers
Andrea

--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 333 8128928

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------

I found the preparedStatements flag and it is not selected and actually none of the available options are selected.

Any other things i can check?

Simone

________________________________________
Da: andrea.aime@...84... [andrea.aime@...84...] per conto di Andrea Aime [andrea.aime@...1107...]
Inviato: lunedì 18 aprile 2011 11.43
A: Murzilli, Simone (ESA)
Cc: geoserver-users@lists.sourceforge.net
Oggetto: Re: [Geoserver-users] SLD class creation issue‏

On Mon, Apr 18, 2011 at 11:15 AM, Murzilli, Simone (ESA)
<Simone.Murzilli@...672...> wrote:

Thanks Andrea for the answer,

I'm not sure if i fully understood what you mean, i'm not running any specific query, i'm using just the REST calls, i don't know if there is any specific data store configuration. Can u let me know how can i check this?

Prepared statement usage cannot be modified from WMS requests, you
have to be an administrator
and check the datastore configuration, the flag is there

Cheers
Andrea

--
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy

phone: +39 0584 962313
fax: +39 0584 962313
mob: +39 333 8128928

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------

On 04/18/2011 12:05 PM, Murzilli, Simone (ESA) wrote:

I found the preparedStatements flag and it is not selected and actually none of
the available options are selected.

Any other things i can check?

For instance, you could read the actual SQL statament GeoServer passes to PostgreSQL (I would use ngrep to this end) and look for anything suspicious, possibly using EXPLAIN to see how PostgreSQL is processing the query.

Regards,

Luca Morandini
http://www.lucamorandini.it