[mapserver-users] (no subject)

Pavel Iacovlev iacovlev.pavel at gmail.com
Sat Jan 3 18:29:48 EST 2009


Good day all

I have a non rectangular extent and a raster image with known width and
height. Using this data I need to create a world file (with rotation
parameters). I got my script working with rectangular extents but* I don't
know how to calculate the pixel width and pixel height of a non rectangular
extent*.

At the moment I have:
//works only with rectangular extent
$this->_pixelWidth = ($extent['topRight']['x'] - $extent['bottomLeft']['x'])
/ $size['width'];
$this->_pixelHeight = ($extent['topRight']['y'] -
$extent['bottomLeft']['y']) / $size['height'] * -1;

$this->_rotationX = ($this->_pixelHeight * $size['height'] +
$extent['topLeft']['y'] - $extent['bottomRight']['y']) / $size['width'] *
-1;
$this->_rotationY = ($this->_pixelWidth * $size['width'] +
$extent['topLeft']['x'] - $extent['bottomRight']['x']) / $size['height'] *
-1;

$this->_topLeftX = $extent['topLeft']['x'];
$this->_topLeftY = $extent['topLeft']['y'];

Thank you in advance

-- 
http://iap.md, The future is open
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090104/2d49b375/attachment.html


More information about the mapserver-users mailing list