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

Martin Høgh mh at svaj.dk
Mon Mar 21 06:05:44 PST 2005


Hi Horst,
I've written a tentative snap method which can do line snap.

snapShape(shapeId,snapTolerance,pointString,[arrayWithLineSegments])

As you see, where is a new optional arg called 'arrayWithLineSegments'. This must be an array with point strings representing line segments (that is linestrings or polygons)

e.g:

Array ( [0] => 1 1,2 2,3 3 [1] => 20 20,30 30,40 40 [2] => 283 167,114 151,3 3,283 167) 

if you've a geometry object called $geo you can do $arrayWithLineSegments=$geo->getShapeArray()

A bug: If a point don't have a perpendicular projection on to a the line segment it will snap to the imaginary extention of the line segment. Therefore I have made vertex snap priority one meaning that vertex snap will occure even if a line segment is closer.

I'll try to figure this out.

You can pass FALSE instead of pointString to the method and it will only do line snap with the risk of the imaginary extention bug.

I've updates CVS.

You can also try it on my demo web site 

http: slashslash 193.88.249.111/kortbrowser/maplink_itasca/wmsclient.phtml

/martin

***

Hi Martin

> By line snap do you mean snap to an arbitrary point on a
> line string belonging to a polyline or polygon? 

That's what I meant. The point should snap to the closest point on a line
belonging to a polyline or polygon. Take a look at the attached image.

With best regards

Horst

---------------------------------
 
Dr. Horst Düster 
GIS-Koordinator /Amtschef Stv.

Kanton Solothurn 
Amt für Geoinformation
Abteilung SO!GIS Koordination
Werkhofstr. 65
CH-4509 Solothurn 

Tel.: ++41 (0)32 627 25 32 
Fax: ++41 (0)32 627 22 14

horst.duester at bd.so.ch 
www.sogis.so.ch





More information about the postgis-users mailing list