[Geoserver-users] Scale discrepancy between Web Mercator and BC-Albers

Hi,

I am not sure if I understood the problem but I wonder how the true scale suits together with Web Mercator. I guess that you do not expect that the tiles of the same zoom level would use different styles at equator than in Canada or Finland even the true scale differs a lot.

-Jukka Rahkonen-

Martin Davis wrote:

···

We are displaying map images in Web Mercator, from a GeoServer with native CRS as BC-Albers (EPGS:3005).

We are using an OpenLayers client to display the map images. We have confirmed that the geodetic scale displayed by OpenLayers is approximately the true scale of the map images (modulo the fact that OL uses a fixed resolution of 72 DPI).

Based on the zoom levels at which layers become visible, it appears that GeoServer’s internal computed scale is from 2 to 4 times larger than the client scale.

Is this expected?

Is there any way to determine a way to map between client scale and Geoserver scale, so that we can configure the client to track GeoServer visibility faithfully?

Is there any way to display the internal GeoServer scale to make it possible to confirm if this analysis is correct?

GeoServer ver 2.6 (although I believe this is happening in 2.8 as well)

Yes, we realize that’s an issue. In our case we’re only concerned with a relatively small area (the province of BC), so the variation in true scale across the area is not that large (around 20%). We realize that we won’t get 100% correlation, but we’d like to at least get it looking right better than 50% of the time!

The issue is that it’s very hard to determine what a scale limit in a SLD corresponds to in terms of client (true, screen) scale. It seems odd that the GeoServer scale would be a factor of 2 or more different to the true (image) scale.

There does appear to be a rough correlation, which may even be a linear factor. But it’s hard to tell without seeing the exact scale that GeoServer is using in its SLD algorithm.

As examples, here’s some scale limits from SLDs, with the corresponding largest client scale (approximate) at which the layer is visible

SLD Client Zoom Level
10,000,000 4,399,000 6
6,000,000 2,297,000 7

2,000,000 565,000 9
1,000,000 282,000 10
500,000 143,000 11

20,000 8,957 15

···

On Mon, Feb 15, 2016 at 2:35 PM, Rahkonen Jukka (MML) <jukka.rahkonen@anonymised.com> wrote:

Hi,

I am not sure if I understood the problem but I wonder how the true scale suits together with Web Mercator. I guess that you do not expect that the tiles of the same zoom level would use different styles at equator than in Canada or Finland even the true scale differs a lot.

-Jukka Rahkonen-

Martin Davis wrote:

We are displaying map images in Web Mercator, from a GeoServer with native CRS as BC-Albers (EPGS:3005).

We are using an OpenLayers client to display the map images. We have confirmed that the geodetic scale displayed by OpenLayers is approximately the true scale of the map images (modulo the fact that OL uses a fixed resolution of 72 DPI).

Based on the zoom levels at which layers become visible, it appears that GeoServer’s internal computed scale is from 2 to 4 times larger than the client scale.

Is this expected?

Is there any way to determine a way to map between client scale and Geoserver scale, so that we can configure the client to track GeoServer visibility faithfully?

Is there any way to display the internal GeoServer scale to make it possible to confirm if this analysis is correct?

GeoServer ver 2.6 (although I believe this is happening in 2.8 as well)

Are you suggesting that GeoServer computes the scale at a single known point for all map request extents, no matter where on the globe they are located? Does the OGC standard specify this?

If so, I guess that might explain the discrepancy between SLD scale and true image scale, at our latitudes (49 to 60) ?

···

On Mon, Feb 15, 2016 at 2:35 PM, Rahkonen Jukka (MML) <jukka.rahkonen@anonymised.com> wrote:

Hi,

I am not sure if I understood the problem but I wonder how the true scale suits together with Web Mercator. I guess that you do not expect that the tiles of the same zoom level would use different styles at equator than in Canada or Finland even the true scale differs a lot.

-Jukka Rahkonen-

Martin Davis wrote:

We are displaying map images in Web Mercator, from a GeoServer with native CRS as BC-Albers (EPGS:3005).

We are using an OpenLayers client to display the map images. We have confirmed that the geodetic scale displayed by OpenLayers is approximately the true scale of the map images (modulo the fact that OL uses a fixed resolution of 72 DPI).

Based on the zoom levels at which layers become visible, it appears that GeoServer’s internal computed scale is from 2 to 4 times larger than the client scale.

Is this expected?

Is there any way to determine a way to map between client scale and Geoserver scale, so that we can configure the client to track GeoServer visibility faithfully?

Is there any way to display the internal GeoServer scale to make it possible to confirm if this analysis is correct?

GeoServer ver 2.6 (although I believe this is happening in 2.8 as well)

On Tue, Feb 16, 2016 at 12:05 AM, Martin Davis <mtnclimb@anonymised.com> wrote:

Are you suggesting that GeoServer computes the scale at a single known
point for all map request extents, no matter where on the globe they are
located? Does the OGC standard specify this?

The OGC standard basically defines (brace yourself) an "cylindrical earth"
model in the SLD specification, that's what GeoServer implements, at least
for
geographic coordinate systems.
For projected ones it's the "flat map" scale one, measured in the projected
coordinates, which is also very far away from a true scale (measured along
a geodetic distance) especially at those latitudes
and using that projection.

If you really want to break the standards GeoServer gives you a hand by
offering a vendor param to compute the scale
in the accurate (geodetic) way:
http://docs.geoserver.org/latest/en/user/services/wms/vendor.html#scalemethod

We normally use that for printouts :slight_smile:

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

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

Thanks, Andrea. I suspected this might be the cause of the issue.

Is there a way to view the scale computed for a map request? That might let us correlate the client (geodetic) scale to “OGC scale”, so we can translate between the two.

···

On Tue, Feb 16, 2016 at 12:40 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Tue, Feb 16, 2016 at 12:05 AM, Martin Davis <mtnclimb@anonymised.com> wrote:

Are you suggesting that GeoServer computes the scale at a single known point for all map request extents, no matter where on the globe they are located? Does the OGC standard specify this?

The OGC standard basically defines (brace yourself) an “cylindrical earth” model in the SLD specification, that’s what GeoServer implements, at least for
geographic coordinate systems.
For projected ones it’s the “flat map” scale one, measured in the projected coordinates, which is also very far away from a true scale (measured along a geodetic distance) especially at those latitudes
and using that projection.

If you really want to break the standards GeoServer gives you a hand by offering a vendor param to compute the scale
in the accurate (geodetic) way:
http://docs.geoserver.org/latest/en/user/services/wms/vendor.html#scalemethod

We normally use that for printouts :slight_smile:

Cheers
Andrea

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313

fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


On Tue, Feb 16, 2016 at 6:10 PM, Martin Davis <mtnclimb@anonymised.com> wrote:

Thanks, Andrea. I suspected this might be the cause of the issue.

Is there a way to view the scale computed for a map request? That might
let us correlate the client (geodetic) scale to "OGC scale", so we can
translate between the two.

You can use the decorations:
http://docs.geoserver.org/stable/en/user/advanced/wmsdecoration.html

A "correlation" might be possible in a very specific local area, but just
so that we are on the same
page, the math is wildly different, so you could have a rough linear
correlation in a town,
not sure you can have that in a larger area (something spanning degrees,
especially
at that latitude where the mercator scale factor starts to diverge)

Cheers
Andrea

--

GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

*AVVERTENZE AI SENSI DEL D.Lgs. 196/2003*

Le informazioni contenute in questo messaggio di posta elettronica e/o
nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il
loro utilizzo è consentito esclusivamente al destinatario del messaggio,
per le finalità indicate nel messaggio stesso. Qualora riceviate questo
messaggio senza esserne il destinatario, Vi preghiamo cortesemente di
darcene notizia via e-mail e di procedere alla distruzione del messaggio
stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso,
divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od
utilizzarlo per finalità diverse, costituisce comportamento contrario ai
principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for
the attention and use of the named addressee(s) and may be confidential or
proprietary in nature or covered by the provisions of privacy act
(Legislative Decree June, 30 2003, no.196 - Italy's New Data Protection
Code).Any use not in accord with its purpose, any disclosure, reproduction,
copying, distribution, or either dissemination, either whole or partial, is
strictly forbidden except previous formal approval of the named
addressee(s). If you are not the intended recipient, please contact
immediately the sender by telephone, fax or e-mail and delete the
information in this message that has been received in error. The sender
does not give any warranty or accept liability as the content, accuracy or
completeness of sent messages and accepts no responsibility for changes
made after they were sent or for other risks which arise as a result of
e-mail transmission, viruses, etc.

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

Thanks for the advice - and for the warning. Sigh…

···

On Tue, Feb 16, 2016 at 9:35 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Tue, Feb 16, 2016 at 6:10 PM, Martin Davis <mtnclimb@anonymised.com> wrote:

Thanks, Andrea. I suspected this might be the cause of the issue.

Is there a way to view the scale computed for a map request? That might let us correlate the client (geodetic) scale to “OGC scale”, so we can translate between the two.

You can use the decorations:
http://docs.geoserver.org/stable/en/user/advanced/wmsdecoration.html

A “correlation” might be possible in a very specific local area, but just so that we are on the same
page, the math is wildly different, so you could have a rough linear correlation in a town,
not sure you can have that in a larger area (something spanning degrees, especially
at that latitude where the mercator scale factor starts to diverge)

Cheers

Andrea

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313

fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


Good news on this. Further experimentation revealed that it is possible to get reasonably good agreement between scales in OpenLayers and GeoServer using the following approach:

  • use OpenLayers NON-geodesic (nominal) scale calculation
  • set OpenLayers DOTS_PER_INCH to match the GeoServer value of 90

This produced OL scales that were in good agreement with the GeoServer values (close enough for government work, anyway 8^). For example, at a map nominal scale of 541,679 GeoServer computed the scale of 545,979

This was greatly assisted by Andrea’s suggestion of using WMS Decorations, in conjunction with some enhancements to my WMS Viewer ( http://dr-jts.github.io/maptest/maptest.html ).

For those interested, the following was used to display the GeoServer scale on each map image:

GetMap parameter

format_options=layout:scaleratio

WMS Decoration Layout file scaleratio.xml:

···

On Tue, Feb 16, 2016 at 9:35 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:

On Tue, Feb 16, 2016 at 6:10 PM, Martin Davis <mtnclimb@anonymised.com> wrote:

Thanks, Andrea. I suspected this might be the cause of the issue.

Is there a way to view the scale computed for a map request? That might let us correlate the client (geodetic) scale to “OGC scale”, so we can translate between the two.

You can use the decorations:
http://docs.geoserver.org/stable/en/user/advanced/wmsdecoration.html

A “correlation” might be possible in a very specific local area, but just so that we are on the same
page, the math is wildly different, so you could have a rough linear correlation in a town,
not sure you can have that in a larger area (something spanning degrees, especially
at that latitude where the mercator scale factor starts to diverge)

Cheers

Andrea

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313

fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.