[mapserver-users] mapserver wrong scale computation

Worth Lutz wal3 at mindspring.com
Wed Jul 9 09:18:49 PDT 2014


Are you using mapscript? If so leave resolution alone and do the 
following in the order shown (important!):

$map = new mapObj($mapfile);

// set the image size first - important!
$map->setSize($width, $height);

// now set extent
// extent will be modified to fit into aspect ratio of the size set above
$map->setExtent($minx, $miny, $maxx, $maxy);

$w = $map->width;
$h = $map->height;

$x = $map->width / 2;
$y = $map->height / 2;

$centerPixel = new pointObj();
$centerPixel->setXY($x, $y);


$map->zoomScale($scale, $centerPixel, $map->width, $map->height, 
$map->extent);

I get good pdf maps which print accurately to scale using this method.


*Worth Lutz*
------------------

On 07/09/2014 10:55 AM, Mario Jurcevic wrote:
> Hi,
> I am trying to create an image with same size as the map extent, only 
> by a scale factor of 500.
> The mapserver scale computation gives 500.8989383487 scale.
>
> If I set the image inch*72.129302863661 instead of default 72 the 
> mapsever scale computed is
> 500.00127000041.
>
> What is the correct value for resolution?
>
> Regards,
> Mario Jurcevic
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140709/8a1e9754/attachment.html>


More information about the mapserver-users mailing list