Opened 17 years ago
Closed 16 years ago
#2087 closed defect (fixed)
wkt can't pull {bounds}
Reported by: | cplist | Owned by: | tomkralidis |
---|---|---|---|
Priority: | normal | Milestone: | 5.2 release |
Component: | OGR Support | Version: | svn-trunk (development) |
Severity: | normal | Keywords: | |
Cc: | sdlime, hobu |
Description
$shp->{bounds}->toString() is returning -1's for the bounds from a fromWKT shape.
###########
#!/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 }
###########
Steve's workaround (which works) was to do a $shp->setBounds(); after the fromWKT assignment.
Attachments (1)
Change History (10)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
Cc: | added |
---|---|
Version: | → svn-trunk (development) |
comment:3 by , 16 years ago
Update: when I build _without_ GEOS, the above testcase works fine. So this means OGR's WKT functionality is fine. It's GEOS then.
comment:4 by , 16 years ago
In mapgeos.c, the various functions (foreach data type) called from msGEOSGeometry2Shape need to be updated to set shapeObj.bounds.minx/miny/maxx/maxy.
I've updated this for msGEOSGeometry2Shape_point (which is a really simple fix), and will try to figure out the correct GEOS API functions to get bounds, etc. (any suggestions?). Will commit when complete.
comment:5 by , 16 years ago
Milestone: | → 5.2 release |
---|---|
Owner: | changed from | to
comment:6 by , 16 years ago
Cc: | added; removed |
---|
Added msGEOSEnvelope in r7235, which is called by everything (except for msGEOSGeometry2Shape_point per comment:4) under msGEOSGeometry2Shape. See attachment:2087-test.tgz for the test cases I used.
HISTORY.TXT updated. Can someone possibly test and confirm/verify?
comment:7 by , 16 years ago
I can confirm that the original perl test worked fine.
# STDOUT { 'minx': 0 , 'miny': 0 , 'maxx': 2 , 'maxy': 2 }
Mahvelous.
comment:8 by , 16 years ago
Couple of comments. I can't remember why I left bounds computation off, weird. There is a MapServer function to do this called msComputeBounds().
Steve
comment:9 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Ah, ok. Thanks for the info. Same thing. I'll use msComputeBounds() then, since it's already in the codebase and tried and true. Change made in r7238.
I get the same thing using python:
Chasing this down takes me to mapscript/swiginc/shape.i, line 62, which leads me to mapprimitive.c, line 61), which, in my case, calls the GEOS WKT function in mapgeos.c in line 586. GEOS is not returning error here (passing erroneous data does indeed return error :) ), so things seem to work as expected.
I don't see the members being set or anything like that, are they being set?