perl mapscript wkt & bounds
Charlton Purvis
cplist at SECONDCREEK.ORG
Thu May 3 10:04:28 PDT 2007
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