[postgis-users] Re:PHP access to PostGIS

Martin Høgh mh at svaj.dk
Fri Mar 11 08:29:37 PST 2005


Hi,
Yes of couse.

If you want to do snap the geometry to another geometry so they thouch, you can use this function 

$g->snapShape($shapeId,$snapTolerance,$snapLayerStr);

A geometry feature comprises one or more shapes (more if multigeometry). The shapeId is the id of the shape you want to snap, tolerance is the snap tolerance and snapLayerStr is a string with coords "x1 y1,x2, y2...." which will be evaluated. If a coord in shape with shapId lies within the tolerance from the coords of snapLayerStr, it'll be snapped to this.

e.g.

$g->snapShape(0,5,"3 3, 4 4, 8 8");

If you want to snap two geometries

$g1->snapShape(0,5,$g2->getVertices());

shape with id 0 of $g1 will be altered if it has coords that lies within a distance of 5 from the coords of $g2.

there is also the method:

$g0->snapAllShapes($snapTolerance,$snapLayerStr);

This will loop through all shapes of $g and snap them.

Soon I will start on writing some documentation.

/martin

****


Martin

Your geometry class sounds very interesting. Could you made some further
explanations particulary the snap functions.
I couldn't understand what you do mean with the snapLayerStr.


With best regards

Horst



More information about the postgis-users mailing list