AW: [postgis-users] Re:PHP access to PostGIS

Martin Høgh mh at svaj.dk
Sun Mar 20 05:26:16 PST 2005


Hi Horst,
By line snap do you mean snap to an arbitrary point on a line string belonging to a polyline or polygon? And the possibility of adding a new vertex where the snap occurred?

I’ve though of this and it’s a very good idea. I’ll think about how this could be accomplished.

/Martin

********

Martin

I took a look at your snap function. I works nice with single vertex snap,
but a linesnap is not available. That means, that two lines with different
number of vertexpoints doesn't snap correct. I'm sure that you are aware of
this circumstance. Are your interested to enhance your snap function with
this feature? Further I think, that an add vertex function with linesnapping
could be a very helpful thing. With these mensioned enhancements and your
geometry class it is possible to build a wide featured web editing tool.

What do you think about my ideas?

Horst




-----Ursprüngliche Nachricht-----
Von: "Martin Høgh" [mailto:mh at svaj.dk]
Gesendet am: Freitag, 11. März 2005 17:30
An: postgis-users at postgis.refractions.net
Betreff: [postgis-users] Re:PHP access to PostGIS

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