<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class='hmmessage'>Hello,<BR>
 <BR>
I have the following function which check if two (or more) points are one, the function just consider the x,y coordinates. can any body help me to modify it to check z-index also. <BR>
 <BR>
Thanks<BR>
 <BR>
Ihab<BR>
 <BR>
below is the function<BR>
 <BR>
-- Function: assign_vertex_id(character varying, double precision, character varying, character varying) <BR>
-- DROP FUNCTION assign_vertex_id(character varying, double precision, character varying, character varying); <BR>
CREATE OR REPLACE FUNCTION assign_vertex_id(geom_table character varying, tolerance double precision, geo_cname character varying, gid_cname character varying) <BR>
RETURNS character varying AS <BR>
$BODY$ DECLARE <BR>
points record; i record; source_id int; target_id int; pre varchar; post varchar; <BR>
BEGIN <BR>
BEGIN <BR>
DROP TABLE vertices_tmp; <BR>
EXCEPTION <BR>
WHEN UNDEFINED_TABLE THEN <BR>
END; <BR>
CREATE TABLE vertices_tmp ( id serial ); <BR>
EXECUTE $q$ SELECT addGeometryColumn('vertices_tmp', 'the_geom', <BR>
(SELECT srid FROM geometry_columns WHERE f_table_name='$q$ quote_ident(geom_table) $q$') , 'POINT', 4) $q$; <BR>
CREATE INDEX vertices_tmp_idx ON vertices_tmp USING GIST (the_geom); <BR>
pre = ; <BR>
post = ; <BR>
FOR i in EXECUTE 'SELECT count(*) as t from ' quote_ident(geom_table) ' WHERE <A class="missing wiki" href="http://pgrouting.postlbs.org/wiki/NumGeometries" rel=nofollow><U><FONT face="" color=#0000ff>NumGeometries?</FONT></U></A>?(' quote_ident(geo_cname) ') is not null' loop <BR>
IF (i.t > 0) THEN <BR>
pre = 'geometryN('; post = ' , 1)'; <BR>
END IF; <BR>
END LOOP; <BR>
FOR points IN EXECUTE 'SELECT ' quote_ident(gid_cname) ' AS id,' <BR>
' startPoint(' pre quote_ident(geo_cname) post ') AS source,' ' endPoint(' pre quote_ident(geo_cname) post ') as target' ' FROM ' quote_ident(geom_table) loop <BR>
source_id := point_to_id(points.source, tolerance); target_id := point_to_id(points.target, tolerance); <BR>
EXECUTE 'update ' quote_ident(geom_table) <BR>
' SET source_id = ' source_id <BR>
', target_id = ' target_id <BR>
' WHERE ' quote_ident(gid_cname) ' = ' points.id; <BR>
END LOOP; <BR>
RETURN 'OK'; <BR>
END; $BODY$ <BR>
LANGUAGE 'plpgsql' VOLATILE STRICT COST 100; <BR>
ALTER FUNCTION assign_vertex_id(character varying, double precision, character varying, character varying) OWNER TO postgres; <BR><br /><hr />Discover the new Windows Vista <a href='http://search.msn.com/results.aspx?q=windows+vista&mkt=en-US&form=QBRE' target='_new'>Learn more!</a></body>
</html>