Proper way to set extent 'margins'

Steve Lime Steve.Lime at DNR.STATE.MN.US
Mon May 7 21:31:12 EDT 2007


I usually express a margin as a percentage of the total extent. For example to add 10% you'd do something like:

where pntext is the extent of your points layer and mapext is your map extent...

  dx = .05 * (pntext->maxx - pntext->minx);
  dy = .05 * (pntext->maxy - pntext->miny);
  mapext->minx = pntext->minx - dx;
  mapext->maxx = pntext->maxx + dx;
  mapext->miny = pntext->miny - dy;
  mapext->maxy = pntext->maxy + dy;

Then let MapServer pad the appropriate dimension based on your image aspect.

Steve

>>> Ben Sims <benjaminsims at YAHOO.COM> 05/07/07 10:48 AM >>>
Hello to all,

I'm getting confused on how to correctly set 'margins' on my maps in a simple application. I currently get the extents of the dynamically generated pointsLayer using:

pointsLayer->getExtent();

I then add/subtract arbitary margin values (0.75 for x, 0.5 for y). This works well enough at the country level, but at a wider (often global) scale, the points are cut off by the edge of the image.

What I would like to do is simply extend the extent viewed by the width of the largest possible point. However, I don't know how to convert the size of the points (in pixels) to a margin usable by  $map->setExtents().

Any help much appreciated,

Benjamin

PS: Also, the Mapserver main doc site is down, which makes it hard to browse documentation.




	
	
		
___________________________________________________________ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 



More information about the mapserver-users mailing list