perl mapscript wkt & bounds
Steve Lime
Steve.Lime at DNR.STATE.MN.US
Thu May 3 11:23:51 PDT 2007
That's most likely a bug so if you would be so kind as to file one... ;-) I need to see if the OGR WKT converter
behaves similarly.
A quick workaround is to call setBounds() on the resulting shape and that will force computation of the bbox.
So do:
my $shp = mapscript::shapeObj::fromWKT(...);
$shp->setBounds();
Steve
>>> On 5/3/2007 at 12:04 PM, in message <008e01c78da5$1d8898c0$650fa8c0 at latitude>,
Charlton Purvis <cplist at SECONDCREEK.ORG> wrote:
> Hi, all:
>
> I am having a tough time doing something that should be a snap. I can't
> pull a bounding box out for a WKT polygon (in this example).
>
> #!/usr/bin/perl
> use strict;
> use mapscript;
> my $shp = mapscript::shapeObj::fromWKT(
> 'POLYGON((0.0 0.0, 0.0 2.0, 2.0 2.0, 2.0 0.0, 0.0 0.0))'
> );
> print $shp->{bounds}->toString()."\n";
>
> What I get is:
> { 'minx': -1 , 'miny': -1 , 'maxx': -1 , 'maxy': -1 }
>
> I can do a {bounds} on a shape from a shapefile just fine. Something like:
> { 'minx': -109, 'miny': 31, 'maxx': -103, 'maxy': 37 }
>
> And just for kicks and to make sure I wasn't insane, pumping that geometry
> into postis and doing an envelope on it gives me what I want:
>
> POLYGON((0 0,0 2,2 2,2 0,0 0))
>
> ms 4.10.1
> geos-3.0.0rc4
>
> Thanks in advance,
>
> Charlton
More information about the MapServer-users
mailing list