[Geoserver-users] WMS requests, scaling and how GeoServer renders data

Ok, so, naive question here that hopefully hasn’t been asked a thousand times (I haven’t found it in the archives, but you never know)… . Also it may technically be an OGC SLD question, but I’m hoping I don’t get thrown out on a technicality here…

When GeoServer handles a request for a dataset with a bounding box and image width and height in pixels, what is the calculation it does to decide whether such a request is at a scale that can be displayed based on the stylization? In essence, how are the and used? The reason I ask is from a printing perspective, if I make a low resolution request for an image to display in a browser window, and then request the same area at a higher resolution for printing purposes, I assume that I may need to change which styles I use in order to ensure that everything displays similarly between requests.

Any insight?
Thanks,
Steve

Stephen Mather, GIS Manager

Metroparks

svm@anonymised.com

Phone: (216) 635-3243

FAX: (216) 635-3286

Stephen V. Mather ha scritto:

Ok, so, naive question here that hopefully hasn't been asked a thousand times (I haven't found it in the archives, but you never know)... . Also it may technically be an OGC SLD question, but I'm hoping I don't get thrown out on a technicality here...
When GeoServer handles a request for a dataset with a bounding box and image width and height in pixels, what is the calculation it does to decide whether such a request is at a scale that can be displayed based on the stylization? In essence, how are the <MaxScaleDenominator> and <MinScaleDenominator> used? The reason I ask is from a printing perspective, if I make a low resolution request for an image to display in a browser window, and then request the same area at a higher resolution for printing purposes, I assume that I may need to change which styles I use in order to ensure that everything displays similarly between requests.

Indeed it's true. Unless you use a resolution independent format such
as PDF and SVG... which.. well, will be resolution independent only for
the vector part anyways, if you're printing raster they will be rendered
at the standard resolution anyways.

The WMS specification mandates two formulas for computing the scale,
both depend on the area and the image size. So yeah, if you request
a bigger image for the same envelope you're effectively asking
for a bigger scale (smaller denominator) and thus different rules
might trigger.

The exact expressions, mandated by the SLD 1.0 spec, are
(SD = scale denominator):

   SD = envelope.getWidth() / (imageWidth / DPI * 0.0254)

for projected data, and:

   OGC_DEGREE_TO_METERS = 6378137.0 * 2.0 * Math.PI / 360
   SD = (bounds.getWidth() * OGC_DEGREE_TO_METERS) / (imageWidth / DPI * 0.0254);

where the standard DPI = 25.4 / 0.28 (the standard pixel
size according to OGC is 0.00028m/pixel).

In order to be able and generate a "denser" image without changing
the scale we'd have to introduce an extra parameter that changes
the scale computation, but also the size of all strokes, symbols
and so on (since in SLD 1.0 they are specified in pixels, not meters).

Hope this helps
Cheers
Andrea

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

Also, min- and max-scaledenominators are not required in your SLD. If
you omit them, then your style will be the same regardless of
resolution. As Andrea mentioned, rendering with the 'same' style at a
higher resolution will actually look quite different since the style
sizing attributes are specified in pixels, so keep that in mind.

Hope this helps.

--
David Winslow
OpenGeo - http://opengeo.org/

On Thu, 2009-03-26 at 23:02 +0100, Andrea Aime wrote:

Stephen V. Mather ha scritto:
> Ok, so, naive question here that hopefully hasn't been asked a thousand
> times (I haven't found it in the archives, but you never know)... .
> Also it may technically be an OGC SLD question, but I'm hoping I don't
> get thrown out on a technicality here...
>
> When GeoServer handles a request for a dataset with a bounding box
> and image width and height in pixels, what is the calculation it does to
> decide whether such a request is at a scale that can be displayed based
> on the stylization? In essence, how are the <MaxScaleDenominator> and
> <MinScaleDenominator> used? The reason I ask is from a printing
> perspective, if I make a low resolution request for an image to display
> in a browser window, and then request the same area at a higher
> resolution for printing purposes, I assume that I may need to change
> which styles I use in order to ensure that everything displays similarly
> between requests.

Indeed it's true. Unless you use a resolution independent format such
as PDF and SVG... which.. well, will be resolution independent only for
the vector part anyways, if you're printing raster they will be rendered
at the standard resolution anyways.

The WMS specification mandates two formulas for computing the scale,
both depend on the area and the image size. So yeah, if you request
a bigger image for the same envelope you're effectively asking
for a bigger scale (smaller denominator) and thus different rules
might trigger.

The exact expressions, mandated by the SLD 1.0 spec, are
(SD = scale denominator):

   SD = envelope.getWidth() / (imageWidth / DPI * 0.0254)

for projected data, and:

   OGC_DEGREE_TO_METERS = 6378137.0 * 2.0 * Math.PI / 360
   SD = (bounds.getWidth() * OGC_DEGREE_TO_METERS) / (imageWidth / DPI *
0.0254);

where the standard DPI = 25.4 / 0.28 (the standard pixel
size according to OGC is 0.00028m/pixel).

In order to be able and generate a "denser" image without changing
the scale we'd have to introduce an extra parameter that changes
the scale computation, but also the size of all strokes, symbols
and so on (since in SLD 1.0 they are specified in pixels, not meters).

Hope this helps
Cheers
Andrea