Krunoslav Hrnjak created GEOS-4970:
--------------------------------------
Summary: Changing scale ratio map decorations in accordance to dpi settings and producing dpi independent scale line
Key: GEOS-4970
URL: https://jira.codehaus.org/browse/GEOS-4970
Project: GeoServer
Issue Type: Bug
Components: WMS
Affects Versions: 2.1.3
Environment: Build Information
Version 2.1.3
Subversion Revision 16668
Build Date 21-Dec-2011 11:55
GeoTools Version 2.7.4 (rev 38443)
Reporter: Krunoslav Hrnjak
Assignee: Andrea Aime
Attachments: Restricted_Line.zip
SCALE RATIO:
Scale ratio map decoration should be calculated in accordance with dpi settings sent in WMS request. From bound box parameters it is possible to calculate real object size, and from width or height parameter combined with dpi it is possible to calculate print out size. So, suggested way of calculating map scale ratio is the following:
SCALE_RATIO=ROUND((maxx-minx)*100/(width/dpi*2,54))
SCALE LINE:
Scale line should not be dpi dependent (since it should be calculated proportional to map size, so if map is printed as bigger or smaller the scale line will also be bigger or smaller).
1m scale line = width[px]/(maxx-minx)[m], according to this value visible scale line (sometimes representing 0,1m and sometimes 100m) should be placed on map.
For eg. is map is 10m width, and requested width is 1181 pixels, then 1m scale line should be 118px long.
Scale line should not be dpi dependant in sense of line length, maybe only in sense of styling (for larger dpi settings line should be ticker).
TESTING DATA:
I suggest publishing 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. Maybe it should not be called restricted lines and also styling could be made to display line length.
It is necessary to create decoration file:
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>
And this req. can be used for testing:
http://localhost: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
Request above will always return scale ratio 1:30, regarding less of DPI settings, and scale line is 99px wide instead of 118px.
--
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