-- Locate user defined point on network
-- Author: Christopher Fricke
-- License: MIT

-- DROP FUNCTION routing.get_waypoint(geometry);
CREATE OR REPLACE FUNCTION routing.get_waypoint(test_geom geometry) RETURNS int AS $$
    SELECT id::integer FROM routing.ways_vertices_pgr ORDER BY the_geom <-> test_geom LIMIT 1;;
$$ LANGUAGE SQL;

Create function to locate points
Create function to locate points