[Geoserver-users] maxscale on layers

Hi list,

we are using a Geoserver WMS layer which is quite heavy, so it is only
shown below a certain map scale (which is in the SLD).

Our application framework (using OpenLayers) has selection functionality
through SLD, and creates a filter with a red symbolizer, but this SLD has
no scale denominators, ofcourse how can the client know the layer is so
heavy that it needs to insert scale denominators.

Is there a way to limit scales on Geoserver layers server-side, without
being dependent on SLD? We are using 1.7.4.

TIA.

Best regards,
Bart

bartvde@anonymised.com ha scritto:

Hi list,

we are using a Geoserver WMS layer which is quite heavy, so it is only
shown below a certain map scale (which is in the SLD).

Our application framework (using OpenLayers) has selection functionality
through SLD, and creates a filter with a red symbolizer, but this SLD has
no scale denominators, ofcourse how can the client know the layer is so
heavy that it needs to insert scale denominators.

Is there a way to limit scales on Geoserver layers server-side, without
being dependent on SLD? We are using 1.7.4.

Nope, no way. That would be a new feature. I can see it would be useful
as a way to defend the server from too big requests, open a jira issue,
if there is enough interest we'll consider implementing it.

I was reasoning on the topic lately but as a defense measure I was
thinking of allowing the client to use only one of the styles
registered against the feature type, as opposed to a random one
like we allow now.

Wondering, can't the client use a check in that case? Even using
a styel with a max scale, or a server side setting, the user would
end up wondering why the selection he made did not show up.

And oh, to prevent clients from doing too heavy requests also
have a look at:
http://docs.geoserver.org/1.7.x/user/services/wms/configuration.html#request-limits

Cheers
Andrea

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

Hi Andrea,

I've created a JIRA issue:

http://jira.codehaus.org/browse/GEOS-3121

Wrt to your proposal to only allow a registered style, I would be really
against such a thing. Dynamic selections done by a client application,
which is a really useful feature in a web GIS, would become impossible.

What check do you mean that the client can use? I assume that since the
scales are set in an SLD, and different SLD's can have different scales
set, that Geoserver WMS does not advertize ScaleHints in its
GetCapabilities response? That would be the only way for a client to know
the layer is scale dependent, and maybe the client could then insert these
values into the SLD created. But still you will always have less
intelligent clients who won't use this approach.

Let me eloborate a bit on the problem use case: the map is zoomed to
1:25.000 and the layer is visible. The user performs a selection using
SLD. The selection is visible. Then the user zooms out to 1:100.000 and
the layer disappears, but the SLD selection layer is still processed and
drawn. So I don't think the user will wonder why his selection did not get
processed, he/she will wonder why it did get processed instead :slight_smile:

Thanks for the hint about request limits. I'll look into this.

Best regards,
Bart

bartvde@anonymised.com ha scritto:

Hi list,

we are using a Geoserver WMS layer which is quite heavy, so it is only
shown below a certain map scale (which is in the SLD).

Our application framework (using OpenLayers) has selection functionality
through SLD, and creates a filter with a red symbolizer, but this SLD
has
no scale denominators, ofcourse how can the client know the layer is so
heavy that it needs to insert scale denominators.

Is there a way to limit scales on Geoserver layers server-side, without
being dependent on SLD? We are using 1.7.4.

Nope, no way. That would be a new feature. I can see it would be useful
as a way to defend the server from too big requests, open a jira issue,
if there is enough interest we'll consider implementing it.

I was reasoning on the topic lately but as a defense measure I was
thinking of allowing the client to use only one of the styles
registered against the feature type, as opposed to a random one
like we allow now.

Wondering, can't the client use a check in that case? Even using
a styel with a max scale, or a server side setting, the user would
end up wondering why the selection he made did not show up.

And oh, to prevent clients from doing too heavy requests also
have a look at:
http://docs.geoserver.org/1.7.x/user/services/wms/configuration.html#request-limits

Cheers
Andrea

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

bartvde@anonymised.com ha scritto:

Hi Andrea,

I've created a JIRA issue:

http://jira.codehaus.org/browse/GEOS-3121

Wrt to your proposal to only allow a registered style, I would be really
against such a thing. Dynamic selections done by a client application,
which is a really useful feature in a web GIS, would become impossible.

Just like the memory consumption toggles, it would be an option, whether
it's going to be enabled or not, it's up to the administrator.

If you're making an application that is not using client dynamic styles
(and the GeoServer instance is dedicated) by raising that flag you'd
give attackers one less weapon to bring the server down (there are other
ways to make the server die with a SLD other than making it draw the
whole world, such as making it load a ridiculously big external graphic).

What check do you mean that the client can use? I assume that since the
scales are set in an SLD, and different SLD's can have different scales
set, that Geoserver WMS does not advertize ScaleHints in its
GetCapabilities response? That would be the only way for a client to know
the layer is scale dependent, and maybe the client could then insert these
values into the SLD created. But still you will always have less
intelligent clients who won't use this approach.

No, there would not be any way. But if you want to make a user friendly
client you have to tell the user "cannot do selection at the current
scale" somehow. Not sure there is any way to publish custom per layer information in the WMS capabilities, so a custom protocol would
have to be established to pass around that information.

Anyways, I agree that a zoom level control at the layer definition level
would put everyone on the same playing field, smart client and attacker
alike: no way to get anything drawn past a certain zoom level.

Let me eloborate a bit on the problem use case: the map is zoomed to
1:25.000 and the layer is visible. The user performs a selection using
SLD. The selection is visible. Then the user zooms out to 1:100.000 and
the layer disappears, but the SLD selection layer is still processed and
drawn. So I don't think the user will wonder why his selection did not get
processed, he/she will wonder why it did get processed instead :slight_smile:

I was considering the case in which the user makes the selection directly at 1:100.000. If the client is smart enough to disallow the
selection action at that zoom level it should be possible to make it
change the map definition and hide the selection layer when the zoom
level is inadequate to show it.

Cheers
Andrea

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

Aside, there's a ScaleHint element that can go in the capabilities for each layer, that we might leverage, as to give the clients a hint of what scales the layer is reasonable at.
from the spec:

"...Layers may include a <ScaleHint> element that suggests minimum and maximum scales
for which it is appropriate to display this layer. Because WMS output is destined for
output devices of arbitrary size and resolution, the usual definition of scale as the ratio of
map size to real-world size is not appropriate here...."

This puts the responsibility on the client to be smart and look for a SacaleHint, which is good and complementary to having a server side hard setting to prevent resource exhaustion.

Gabriel
Andrea Aime wrote:

bartvde@anonymised.com ha scritto:

Hi Andrea,

I've created a JIRA issue:

http://jira.codehaus.org/browse/GEOS-3121

Wrt to your proposal to only allow a registered style, I would be really
against such a thing. Dynamic selections done by a client application,
which is a really useful feature in a web GIS, would become impossible.

Just like the memory consumption toggles, it would be an option, whether
it's going to be enabled or not, it's up to the administrator.

If you're making an application that is not using client dynamic styles
(and the GeoServer instance is dedicated) by raising that flag you'd
give attackers one less weapon to bring the server down (there are other
ways to make the server die with a SLD other than making it draw the
whole world, such as making it load a ridiculously big external graphic).

What check do you mean that the client can use? I assume that since the
scales are set in an SLD, and different SLD's can have different scales
set, that Geoserver WMS does not advertize ScaleHints in its
GetCapabilities response? That would be the only way for a client to know
the layer is scale dependent, and maybe the client could then insert these
values into the SLD created. But still you will always have less
intelligent clients who won't use this approach.

No, there would not be any way. But if you want to make a user friendly
client you have to tell the user "cannot do selection at the current
scale" somehow. Not sure there is any way to publish custom per layer information in the WMS capabilities, so a custom protocol would
have to be established to pass around that information.

Anyways, I agree that a zoom level control at the layer definition level
would put everyone on the same playing field, smart client and attacker
alike: no way to get anything drawn past a certain zoom level.

Let me eloborate a bit on the problem use case: the map is zoomed to
1:25.000 and the layer is visible. The user performs a selection using
SLD. The selection is visible. Then the user zooms out to 1:100.000 and
the layer disappears, but the SLD selection layer is still processed and
drawn. So I don't think the user will wonder why his selection did not get
processed, he/she will wonder why it did get processed instead :slight_smile:

I was considering the case in which the user makes the selection directly at 1:100.000. If the client is smart enough to disallow the
selection action at that zoom level it should be possible to make it
change the map definition and hide the selection layer when the zoom
level is inadequate to show it.

Cheers
Andrea

--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Right,

ScaleHints would be useful asset to GeoServer WMS.

Would they be fed from the default style (SLD) or from the server-side
setting?

Best regards,
Bart

Aside, there's a ScaleHint element that can go in the capabilities for
each layer, that we might leverage, as to give the clients a hint of
what scales the layer is reasonable at.
from the spec:

"...Layers may include a <ScaleHint> element that suggests minimum and
maximum scales
for which it is appropriate to display this layer. Because WMS output is
destined for
output devices of arbitrary size and resolution, the usual definition of
scale as the ratio of
map size to real-world size is not appropriate here...."

This puts the responsibility on the client to be smart and look for a
SacaleHint, which is good and complementary to having a server side hard
setting to prevent resource exhaustion.

Gabriel
Andrea Aime wrote:

bartvde@anonymised.com ha scritto:

Hi Andrea,

I've created a JIRA issue:

http://jira.codehaus.org/browse/GEOS-3121

Wrt to your proposal to only allow a registered style, I would be
really
against such a thing. Dynamic selections done by a client application,
which is a really useful feature in a web GIS, would become impossible.

Just like the memory consumption toggles, it would be an option, whether
it's going to be enabled or not, it's up to the administrator.

If you're making an application that is not using client dynamic styles
(and the GeoServer instance is dedicated) by raising that flag you'd
give attackers one less weapon to bring the server down (there are other
ways to make the server die with a SLD other than making it draw the
whole world, such as making it load a ridiculously big external
graphic).

What check do you mean that the client can use? I assume that since the
scales are set in an SLD, and different SLD's can have different scales
set, that Geoserver WMS does not advertize ScaleHints in its
GetCapabilities response? That would be the only way for a client to
know
the layer is scale dependent, and maybe the client could then insert
these
values into the SLD created. But still you will always have less
intelligent clients who won't use this approach.

No, there would not be any way. But if you want to make a user friendly
client you have to tell the user "cannot do selection at the current
scale" somehow. Not sure there is any way to publish custom per layer
information in the WMS capabilities, so a custom protocol would
have to be established to pass around that information.

Anyways, I agree that a zoom level control at the layer definition level
would put everyone on the same playing field, smart client and attacker
alike: no way to get anything drawn past a certain zoom level.

Let me eloborate a bit on the problem use case: the map is zoomed to
1:25.000 and the layer is visible. The user performs a selection using
SLD. The selection is visible. Then the user zooms out to 1:100.000 and
the layer disappears, but the SLD selection layer is still processed
and
drawn. So I don't think the user will wonder why his selection did not
get
processed, he/she will wonder why it did get processed instead :slight_smile:

I was considering the case in which the user makes the selection
directly at 1:100.000. If the client is smart enough to disallow the
selection action at that zoom level it should be possible to make it
change the map definition and hide the selection layer when the zoom
level is inadequate to show it.

Cheers
Andrea

--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

bartvde@anonymised.com wrote:

Right,

ScaleHints would be useful asset to GeoServer WMS.

Would they be fed from the default style (SLD) or from the server-side
setting?

ah, dunno... what do you suggest?
inspecting the default style seems clever, though still would need at least a server setting enabling that inspection...
Andrea what do you think about it?

Gabriel

Best regards,
Bart

Aside, there's a ScaleHint element that can go in the capabilities for
each layer, that we might leverage, as to give the clients a hint of
what scales the layer is reasonable at.
from the spec:

"...Layers may include a <ScaleHint> element that suggests minimum and
maximum scales
for which it is appropriate to display this layer. Because WMS output is
destined for
output devices of arbitrary size and resolution, the usual definition of
scale as the ratio of
map size to real-world size is not appropriate here...."

This puts the responsibility on the client to be smart and look for a
SacaleHint, which is good and complementary to having a server side hard
setting to prevent resource exhaustion.

Gabriel
Andrea Aime wrote:

bartvde@anonymised.com ha scritto:

Hi Andrea,

I've created a JIRA issue:

http://jira.codehaus.org/browse/GEOS-3121

Wrt to your proposal to only allow a registered style, I would be
really
against such a thing. Dynamic selections done by a client application,
which is a really useful feature in a web GIS, would become impossible.

Just like the memory consumption toggles, it would be an option, whether
it's going to be enabled or not, it's up to the administrator.

If you're making an application that is not using client dynamic styles
(and the GeoServer instance is dedicated) by raising that flag you'd
give attackers one less weapon to bring the server down (there are other
ways to make the server die with a SLD other than making it draw the
whole world, such as making it load a ridiculously big external
graphic).

What check do you mean that the client can use? I assume that since the
scales are set in an SLD, and different SLD's can have different scales
set, that Geoserver WMS does not advertize ScaleHints in its
GetCapabilities response? That would be the only way for a client to
know
the layer is scale dependent, and maybe the client could then insert
these
values into the SLD created. But still you will always have less
intelligent clients who won't use this approach.

No, there would not be any way. But if you want to make a user friendly
client you have to tell the user "cannot do selection at the current
scale" somehow. Not sure there is any way to publish custom per layer
information in the WMS capabilities, so a custom protocol would
have to be established to pass around that information.

Anyways, I agree that a zoom level control at the layer definition level
would put everyone on the same playing field, smart client and attacker
alike: no way to get anything drawn past a certain zoom level.

Let me eloborate a bit on the problem use case: the map is zoomed to
1:25.000 and the layer is visible. The user performs a selection using
SLD. The selection is visible. Then the user zooms out to 1:100.000 and
the layer disappears, but the SLD selection layer is still processed
and
drawn. So I don't think the user will wonder why his selection did not
get
processed, he/she will wonder why it did get processed instead :slight_smile:

I was considering the case in which the user makes the selection
directly at 1:100.000. If the client is smart enough to disallow the
selection action at that zoom level it should be possible to make it
change the map definition and hide the selection layer when the zoom
level is inadequate to show it.

Cheers
Andrea

--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

--
Gabriel Roldan
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Gabriel Roldan ha scritto:

bartvde@anonymised.com wrote:

Right,

ScaleHints would be useful asset to GeoServer WMS.

Would they be fed from the default style (SLD) or from the server-side
setting?

ah, dunno... what do you suggest?
inspecting the default style seems clever, though still would need at least a server setting enabling that inspection...
Andrea what do you think about it?

Hmm... if we want this as a measure to prevent attacks while still
having the liberty of submitting custom styles, it should be a
separate parameter in my opinion.

Code wise, we should check what the current scale is and not include
at all in the map context the layers that are not supposed to be
there (MapContext and MapLayer do not have a place for this
extra scale param).

Cheers
Andrea

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

I'm running into this right now as well, a ScaleHints would indeed be handy. However, if I want to do something similar right now, what is the suggested way to access the default SLD (as well as other layer information)? I tried using WMS DescribeLayer, but that doesn't seem to work?

In the Demo Request page (GeoServer 1.73), I tried the WMS_describelayer.url like this:

http://ogi.state.ok.us/geoserver/wms?request=DescribeLayer&version=1.1.1&layers=ogi:oklakes

but all that was returned was

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE WMS_DescribeLayerResponse SYSTEM "http://ogi.state.ok.us:80/geoserver/schemas/wms/1.1.1/WMS_DescribeLayerResponse.dtd&quot;&gt;
<WMS_DescribeLayerResponse version="1.1.1"><LayerDescription name="ogi:oklakes" wfs="http://ogi.state.ok.us:80/geoserver/wfs/WfsDispatcher?&quot;&gt;&lt;Query typeName="ogi:oklakes"/></LayerDescription></WMS_DescribeLayerResponse>

Any advice?

Thanks,
Roger

--------------------------------------------------
From: "Andrea Aime" <aaime@anonymised.com>
Sent: Thursday, June 04, 2009 3:37 PM
To: "Gabriel Roldan" <groldan@anonymised.com>
Cc: <geoserver-users@lists.sourceforge.net>
Subject: Re: [Geoserver-users] maxscale on layers

Gabriel Roldan ha scritto:

bartvde@anonymised.com wrote:

Right,

ScaleHints would be useful asset to GeoServer WMS.

Would they be fed from the default style (SLD) or from the server-side
setting?

ah, dunno... what do you suggest?
inspecting the default style seems clever, though still would need at
least a server setting enabling that inspection...
Andrea what do you think about it?

Hmm... if we want this as a measure to prevent attacks while still
having the liberty of submitting custom styles, it should be a
separate parameter in my opinion.

Code wise, we should check what the current scale is and not include
at all in the map context the layers that are not supposed to be
there (MapContext and MapLayer do not have a place for this
extra scale param).

Cheers
Andrea

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

------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises
looking to deploy the next generation of Solaris that includes the latest
innovations from Sun and the OpenSource community. Download a copy and
enjoy capabilities such as Networking, Storage and Virtualization.
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Roger Bedell ha scritto:

I'm running into this right now as well, a ScaleHints would indeed be handy. However, if I want to do something similar right now, what is the suggested way to access the default SLD (as well as other layer information)? I tried using WMS DescribeLayer, but that doesn't seem to work?

In the Demo Request page (GeoServer 1.73), I tried the WMS_describelayer.url like this:

http://ogi.state.ok.us/geoserver/wms?request=DescribeLayer&version=1.1.1&layers=ogi:oklakes

but all that was returned was

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE WMS_DescribeLayerResponse SYSTEM "http://ogi.state.ok.us:80/geoserver/schemas/wms/1.1.1/WMS_DescribeLayerResponse.dtd&quot;&gt;
<WMS_DescribeLayerResponse version="1.1.1"><LayerDescription name="ogi:oklakes" wfs="http://ogi.state.ok.us:80/geoserver/wfs/WfsDispatcher?&quot;&gt;&lt;Query typeName="ogi:oklakes"/></LayerDescription></WMS_DescribeLayerResponse>

Any advice?

DescribeLayer work is just to re-route you to a WFS or WCS that can describe the layer attribute, it's not related to styles.
What would be related to styles are GetStyles, PutStyles, but they
are ill conceived, I don't think any server supports them.

For the time being, if you cannot put resources towards implementing
a scaleHint, you can use the RESTConfig extension,
see http://docs.geoserver.org/1.7.4/user/extensions/rest/index.html

Cheers
Andrea

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