Krunoslav Hrnjak created GEOS-4965:
--------------------------------------

             Summary: Fix DPI param
                 Key: GEOS-4965
                 URL: https://jira.codehaus.org/browse/GEOS-4965
             Project: GeoServer
          Issue Type: Bug
          Components: WMS
    Affects Versions: 2.1.3
         Environment: 
 Test environment info:
 General information about GeoServer
    Build Information
        Version 2.1.3
        Subversion Revision 16668
        Build Date 21-Dec-2011 11:55
        GeoTools Version 2.7.4 (rev 38443)
                
 WMS request:   
 
http://arpis-dev01-aio03.arpis.local:8080/geoserver/wms/reflect?layers=sf:Restricted_Line&BBOX=598534.854774036,4917029.553902023,598544.854774036,4917039.553902023&width=1181&format_options=layout:foo;dpi=300
 
                
 Tomcat log:            
Request: reflect
        Time = null
        Filter = null
        Format = null
        Buffer = 0
        Height = 0
        Width = 1181
        Layers = [org.geoserver.wms.MapLayerInfo@ad056fb0]
        Transparent = false
        Filters = null
        SRS = null
        Styles = [StyleImpl[ name=line]]
        Legend = false
        MaxFeatures = null
        Bbox = ReferencedEnvelope[598534.854774036 : 598544.854774036, 
4917029.553902023 : 4917039.553902023]
        RemoteOwsType = null
        RemoteOwsURL = null
        Env = {}
        FormatOptions = {DPI=300=true, LAYOUT=foo}
        Angle = 0.0
        CQLFilter = null
        Elevation = NaN
        FeatureId = null
        Palette = null
        Sld = null
        SldBody = null
        StartIndex = null
        ViewParams = null
        FeatureVersion = null
        Tiled = false
        Crs = null
        BgColor = java.awt.Color[r=255,g=255,b=255]
        ValidateSchema = false
        SldVersion = null
        TilesOrigin = null
        Exceptions = SE_XML
        KMScore = 40
        KMattr = true
        Version = null
        Request = GetMap
        RawKvp = 
{BBOX=598534.854774036,4917029.553902023,598544.854774036,4917039.553902023, 
FORMAT_OPTIONS=layout:foo;dpi=300, LAYERS=sf:Restricted_Line, WIDTH=1181}
        Get = true
        BaseUrl = http://arpis-dev01-aio03.arpis.local:8080/geoserver/
        RequestCharset = UTF-8
        
                

            Reporter: Krunoslav Hrnjak
            Assignee: Andrea Aime
         Attachments: DPI.xls, Restricted_Line.zip

Dear geo folks,

 I would like to state few questions regarding DPI WMS vendor parameter and 
make some proposal how to enhance WMS output in this case. 
 It seems to me that DPI parameter does not have any kind of effect on WMS 
output. Any kind of value can be submitted to DPI parameter, even 
alphanumerical one.
 
 For this discussion I suggest to publish new sample data on GeoServer. I have 
attached Restricted_Line.shp (produced in        EPSG:26713) that has several 
rectangles of different lengths: 1km, 0.5km, 100m, 10m, 1m, 10cm. On these 
rectangles it is possible to check how to produce print out and verify scale.
 
 Let's begin with rectangle 10mx10m rectangle. I will print out this rectangle 
on the paper and print out will be 10cm and use printer with 300dpi resolution. 
In this case scale ratio is 1:10m/10cm = 1:100. Since printer resolution is 300 
dpi I have to request picture that is 10cm/2,54cm/inch*300d/inch=1181 dots 
(pixels) width.
 
 WMS decorations scaleline and scaleratio will be used.
 cd $GEO-SERVER-DATA-DIR
 mkdir layouts
 cd layouts
 vi foo.xml
 and paste:
 <layout>
    <decoration type="scaleline" affinity="bottom,left" offset="36,6"/>
    <decoration type="scaleratio" affinity="top,left" offset="6,6" size="auto"/>
 </layout>

 So let's create the WMS request:
 1. First let's grab the BBOX over WFS: 
http://arpis-dev01-aio03.arpis.local:8080/geoserver/wfs?request=GetFeature&version=1.1.0&typeName=sf:Restricted_Line&outputFormat=text/xml;%20subtype=gml/3.2&CQL_FILTER=NAME='10m'
 2. Let's get object's picture 
http://arpis-dev01-aio03.arpis.local:8080/geoserver/wms/reflect?layers=sf:Restricted_Line&BBOX=598534.854774036,4917029.553902023,598544.854774036,4917039.553902023&width=1181&format_options=layout:foo;dpi=300
 3. Save picture to your hard disk
 4. I have opened picture in IrfanView and set DPI to 300 (it would be nice if 
this value would already be encoded in picture).
 5. After printing on paper, object size was 10 cm, but scaleratio is not 
calculated on the right way. Instead of 1:100 it is written 1:30, and also 
scale line representing 1m length was only 0.8cm long, instead of 1cm. Both 
should be fixed.
 
 From this discussion it is obvious that dpi parameter does not have any impact 
on scale line and scale ratio parameters. And I am not sure how it is connected 
with DPI Scaling announcement 
http://blog.geoserver.org/2010/09/04/geoserver-21-beta-released/ where it is 
written:
 "By default GeoServer renders images at a resolution of 90 DPI. While this is 
acceptable for the standard screen it is not acceptable for print which 
requires a higher resolution. Now it is possible to supply a format option to a 
WMS request on the fly that controls the DPI setting."
 
 By my opinion expected behavior would be the following:
 BBOX, HEIGHT or WIDTH and DPI params should be used to calculate scale ratio:
 1. First calculate distance between maxx and minx to get object size in some 
unit (I suggest meters)
 2. Divide WIDTH/DPI*2,54*100 to get print out size in meters
 3. Calculate scale ratio as object-size/print-size
 (in case of  HEIGHT param received this procedure should be done with maxy and 
miny)

 I am not sure will dpi param have some influence on how picture is printed 
out. There is a huge problem in double styling, one made for screen and one for 
print out. Usually layer that looks good on screen but if the same styling is 
used during printing lines are usually too narrow, and also scalline is too 
small in this case. I believe dpi params should made some kind of changes on 
print out when high dpi resolution is used since if there is not any change on 
styling lines are too narrow. So dpi should do some king of magic here.
 
 As I can see it is possible to send anything as DPI param and no error is 
received like:
 
http://arpis-dev01-aio03.arpis.local:8080/geoserver/wms/reflect?layers=sf:Restricted_Line&BBOX=598534.854774036,4917029.553902023,598544.854774036,4917039.553902023&width=1181&format_options=layout:foo;dpi=Tihana
 
 I understand why it takes value 'Tihana' since this is name of one beautiful 
young lady, but why it takes words like War or Kill? 

 Looking forward to hear from you.
 
                
        Recommended readings:
                Maybe to some people this is well known but it can set rigt was 
of thinking regarding DPI param encoded in digital picture: 
http://www.scantips.com/no72dpi.html
 


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Geoserver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to