[PHP] Add Geos function : Contains
Add geos function contains (see also Bug 1327). Here is an e-mail from Steve
explaining how it works :
For grins I added the conains operator to the geos wrapper and to Swig-based
mapscript. That support is in CVS head (not 4.8, too late for that, sorry).
I hesitate to touch the PHP wrapper though. You'll have to convince one of
the other developers to make that change (or have them ok me doing it).
Anyway in a language like Perl you can do:
shape1 = mapscript::shapeObj::fromWKT('POLYGON((0.0 0.0, 0.0 2.0, 2.0 2.0,
2.0 0.0, 0.0 0.0))') or die("Shape 1: ". mapscript::msGetErrorString("\n")
."\n");
$shape2 = mapscript::shapeObj::fromWKT('POLYGON((0.5 0.5,0.5 1.5,1.5 1.5,1.5
0.5,0.5 0.5))') or die("Shape 2:". mapscript::msGetErrorString("\n") ."\n");
print $shape1->contains($shape2) ."\n";
print $shape2->contains($shape1) ."\n";
print $shape2->contains($shape2) ."\n";
Which outputs:
1
0
1
as expected. This is only exposing the operator. Nothing is itegrated into
the MapServer query functions. However, in MapScript you could:
1) use the bounds of shape 1 to do a rect-based query and then
2) loop through the result set doing contains
I'm not going to do a full implementation of GEOS until I convert the cpp
interface to c (sometime soon). However, it seems like contains might be
interesting to folks in the meantime so...
Change History
(6)
Cc: |
mapserver-bugs@… added
|
Owner: |
changed from mapserverbugs to assefa
|
Owner: |
changed from assefa to jmckenna@…
|
Resolution: |
→ duplicate
|
Status: |
new → closed
|