[mapserver-users] getExtent / setExtent problems
Daniel Morissette
morissette at dmsolutions.ca
Mon Jul 30 08:25:15 PDT 2001
Puneet Kishor wrote:
>
> I am trying to getExtent of a shape that I have retrieved using its index.
>
> $shapeExtObj = $shapeFileObj->getExtent($row_id);
> $minx = $shapeExtObj->minx;
> $miny = $shapeExtObj->miny;
> $maxx = $shapeExtObj->maxx;
> $maxy = $shapeExtObj->maxy;
>
> $border = 1000;
>
> $minx = $minx - $border;
> $miny = $miny - $border;
> $maxx = $maxx + $border;
> $maxy = $maxy + $border;
>
> $mapObj->setExtent( $minx, $miny, $maxx, $maxy);
>
> except, the resulting map extent of the map is slightly off-center... if my
> logic above is correct, the chosen shape should be exactly centered on the
> resulting image, with a border of 1000 feet (map coords are in feet) around
> it. Except, the chosen shape appears in the bottom left corner of the image.
>
> What is the obviously obvious that I am doing wrong?
>
It's so obvious that I can't see it either! :)
The PHP mapObj.setExtent() method calls msAdjustExtent() internally and
this will adjust the extents you've specified to fit the output image's
width/height ratio. msAdjustExtent() should keep the extent you've
specified centered on the image, so I don't understand why that doesn't
work for you.
Perhaps you could try to print the values of $mapObj->extent->minx, etc.
before and after the call to SetExtent and that may give some clues on
what the problem is.
> --
>
> Oh... nudderthing... I am unable to query the dbf files on my *nix box using
> PHP... says dbase_open() etc. are not copacetic. Could that be because the
> PHP install does not have a dbase module compiled in it? I thought that was
> automatically included. What gives here?
>
No, dbase support is not included by default in PHP. On Unix you have
to specify --with-dbase when you configure PHP, and on Windows I think
PHP comes with a PHP_DBASE.DLL that you can load using dl().
--
------------------------------------------------------------
Daniel Morissette morissette at dmsolutions.ca
DM Solutions Group http://www.dmsolutions.ca/
------------------------------------------------------------
Don't put for tomorrow what you can do today, because if
you enjoy it today you can do it again tomorrow.
More information about the MapServer-users
mailing list