O Sun, Dec 30, 2012 at 12:11 PM, Ákos Maróy <[email protected]> wrote:

> PS: all the above assumes that RendererUtilities.getDpi(rendererHints);
> would return a realistic DPI value when called from StreamingRenderer. I
> wonder where the DPI value comes from - does for example WMS request supply
> a realistic DPI value?
>
Let's start from this, since this is the underlying assumption that
unfortunately cannot be met.

First off, the standard WMS protocol provides no way for the client to
specify the DPI of the device it's running onto.
The SLD 1.0/1.1 standard defines a standard DPI that all servers must
adhere to, which is around 90, so that's
what any compliant WMS server uses.

GeoServer has a vendor parameter allowing the client to specify the
DPI (
http://docs.geoserver.org/latest/en/user/services/wms/vendor.html#format-options)
but
since
it's a vendor parameter, you cannot rely on it against any random server,
just against GeoServer.

Finally, and more importantly, can a generic program know the DPI of the
display device it's using?
The answer is no, not even the operating system knows that for sure, in
fact in Windows you normally
have a slider allowing the user to choose their "preferred" dpi.
See also this:
http://stackoverflow.com/questions/2621439/how-to-get-screen-dpi-linux-mac-programatically

Long story short, if you want to build an application that relies on the
screen DPI, you'll
have to provide the user some way to specify the DPI manually, or to
"calibrate" it somehow.

For example, there is this web page:
http://www.infobyip.com/detectmonitordpi.php
trying to show a 1 inch x 1 inch square using the
information coming from the OS, on my main computer, screen 1, it is
actually
2.3cm (instead of 2.56), on the secondary monitor, which is not equal to
the main one,
it is 2.4cm, on my laptop, which has a very high resolution (1900x1200 in
17" screen)
it's just 1.6cm, and on all machines I tried it says the dpi is 96, because
that's what
the OS says (and the OS clearly does not know the right value here).

Besides this issue, having a two monitor setup with the main being the
notebook
screen, the secondary being a larger desktop type screen is not uncommon
these
days, and of course the DPI of the two screens is normally not the same.

Which makes it all the more important for your user to be able to customize
the DPI manually. Is that even a possibility?

Cheers
Andrea

-- 
==
Our support, Your Success! Visit http://opensdi.geo-solutions.it for more
information.
==

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39  339 8844549

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

-------------------------------------------------------
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_123012
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to