Print-to-scale ideas

huub fleuren hfl at HOME.NL
Wed Dec 15 05:27:55 PST 2004


Hallo Abe,

[see also] OGC docs for SLD scale_denominator

  i think you can calculate a  scale 1 : X cm for an image with this
  denominator thing.

  if you know the dimensions of the screen in pixels
  and the size of the screen on the monitor in inches
  (together dpi on the screen)
  you might want to ask the latter size from the computer user


  you might have to ajust for other dpi settings of a PDF document and
  other dpi resolution of a downloaded image.

  from the elements in the following calculation you could also calculate a bbox
  for a certain scale for a certain device once you know:

  -dpi on screen of a certain monitor size
  -or the dpi of the bare image
  -and/or dpi setting of the pdf/{e}ps.


function get_scaledenominator()
{
/* example from SLD spec
  linear width = 200 meter //(bbox.width/image.width)
  100dpi = 1/100 inches (actual pixel size in inches)
  1/100 inches × 25.4mm/inch = 0.254mm (actual pixel size)
  0.254mm × 1000mm/m = 0.000254m (actual pixel size in meters)
  200m ÷ 0.000254m = 787401.5748 (actual scale denominator)
  The actual scale denominator is translated into the “standard” scale denominator as:
  0.28mm ÷ 0.254mm = 1.102362205 (multiplier for scale conversion)
  787401.5748 × 1.102362205 = 868001.736 (standard scale denominator)
  The standard scale denominator is approximately 868K. The “type” of the last
  calculation is correct since the types of its components have the form:
  actual × standard/actual = standard
*/

  var meterperinch = 0.0254
  var standard_dpi = 72
  var actual_dpi = 72
  var actual_meter_perpixel = widthperpixel()/(1/actual_dpi * meterperinch)
  var standard_scale_denominator = ((1/actual_dpi)/(1/standard_dpi)) * actual_meter_perpixel
  return standard_scale_denominator
}



Huub

Tuesday, December 14, 2004, 7:52:57 PM, you wrote:

AG> Is there anyway a MapServer map might be printed to scale over the web?
AG>   Or is this an impossible task due to the discrepancies in resolutions
AG> among the web users' monitors / printers?

AG> If it's not impossible, can someone point me somewhere / offer any
AG> ideas to get started on this?

AG> Thanks.
AG> -Abe



More information about the MapServer-users mailing list