David Winslow | 14 Oct 20:56 2009

Re: How to determine MinScaleDenominator and MaxScaleDenominator to use in SLD

One easy way is to open up the map preview for the layer of interest and zoom in to whatever level.  Then typing "javascript:void alert(map.getScale())" into your browser's address bar (replace the address entirely) will tell you the scale denominator for the current view.  If you use it as a maxScaleDenominator then your style will apply when you are further zoomed in; if you use it as a minScaleDenominator then your style will apply when you are further zoomed out.

If you need this information frequently you can make a bookmark with that JavaScript as the URL.

Hope this helps.

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

On 10/14/2009 02:41 PM, Vitor Isaia wrote:
Hi Andreas!

Based in your explanations, what would be the values to use in the SLD rules?

I mean... for example, what to put here?

          <MinScaleDenominator>0</MinScaleDenominator>
          <MaxScaleDenominator>??</MaxScaleDenominator>

then
          <MinScaleDenominator>??</MinScaleDenominator>
          <MaxScaleDenominator>???</MaxScaleDenominator>        
.....

How to determine these values?

May be you already showed how, but I can't get it.

Thanks!!


On Mon, Oct 5, 2009 at 10:04 AM, Andreas Hocevar <ahocevar <at> opengeo.org> wrote:
Hi,

Styler assumes the same screen resolution as the OpenLayers map preview
in GeoServer, which is 25.4 / 0.28 = 90.7143 dpi. The reason for that is
the "standardized rendering pixel size" of 0.28mm x 0.28mm, as defined
in the SLD spec. OpenLayers assumes a default resolution of 72 dpi. If
you want your OpenLayers application to show the scales exactly as
defined in SLD, you need to set the following after including
OpenLayers.js in your application:

OpenLayers.DOTS_PER_INCH = 25.4 / 0.28;


Otherwise, the scale factor would be 72 / 90.7143 = 0.7937.

Regards,
Andreas.

Justin Deoliveira wrote:
> Ahh cool, sorry i did not pick up on that you were using the styler.
> Yes, hovering over the scalebar works well. However I believe there is
> also a ticket open to renable the scale directly on the map itself.
>
> As for your question about the scale factor, i am not sure. I have
> cc'd one of the styler developers who should be able to better comment.
>
> -Justin
>
> sc wrote:
>> Hi Justin
>>
>> Yes you've understood correctly. I noticed that Styler showed the
>> scale when
>> zooming in and out and this solved my problem.  I just wondered if
>> there was
>> a more scientific way of working it out.
>>
>> I also noticed that when I displayed the scale in OpenLayers that the
>> scale
>> was slightly different to the one shown in Styler, is there some kind of
>> 'factor' I need to take into account?  I seem to remember seeing a
>> figure of
>> 0.90 somewhere?
>>
>> Regards
>> Simon
>>
>> -----Original Message-----
>> From: Justin Deoliveira [mailto:jdeolive <at> opengeo.org] Sent: 02
>> October 2009 13:31
>> To: sc
>> Cc: geoserver-users <at> lists.sourceforge.net
>> Subject: Re: [Geoserver-users] How to determine MinScaleDenominator and
>> MaxScaleDenominator to use in SLD
>>
>> Hi Simon,
>>
>> I am not sure if I completely understand your problem... but you
>> should be able to configure openlayers to show you what scale you are
>> at. Then when you zoom around you can take values from the scale and
>> plug them into your SLD.
>>
>> -Justin
>>
>> sc wrote:
>>> Hi All
>>>
>>>
>>>
>>> I've just started using GeoServer, GeoWebCache and Openlayers but I
>>> do not understand how to determine the MinScaleDenominator and
>>> MaxScaleDenominator to use in my layers SLD file.
>>>
>>>
>>>
>>> My OpenLayers map uses Google Maps as the base layer and i have a
>>> shapefile stored in GeoServer that houses the points I want to overlay.
>>>
>>>
>>>
>>> If I use the default 'point' style supplied with GeoServer the
>>> points display algeol of the time as I expect, but I would like to
>>> change their style at different zoom levels but I can't find a way
>>> of linking the zoom in OpenLayers to the scale in GeoServer.
>>>
>>>
>>>
>>> I think that I am on the right lines but could do with a steer in
>>> the right direction.  I've seen an example SLD at
>>> http://edit.csic.es/SLD/GMapExample.sld.xml but these scales do not
>>> seem to work for me.
>>>
>>>
>>>
>>> Any help would be greatly appreciated.
>>>
>>>
>>>
>>> Regards
>>>
>>> Simon
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>>
>> ----------------------------------------------------------------------------
>>
>> --
>>> Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
>>> is the only developer event you need to attend this year. Jumpstart
>>> your
>>> developing skills, take BlackBerry mobile applications to market and
>>> stay ahead of the curve. Join us from November 9&#45;12, 2009. Register
>> now&#33;
>>> http://p.sf.net/sfu/devconf
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>>
>>> _______________________________________________
>>> Geoserver-users mailing list
>>> Geoserver-users <at> lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>
>


--
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.


------------------------------------------------------------------------------
Come build with us! The BlackBerry&reg; Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9&#45;12, 2009. Register now&#33;
http://p.sf.net/sfu/devconf
_______________________________________________
Geoserver-users mailing list
Geoserver-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Geoserver-users mailing list Geoserver-users <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Geoserver-users mailing list
Geoserver-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Gmane