Posted by Yancho on Sat 15 Mar 10:55
report abuse | download | new post
- CREATE OR REPLACE FUNCTION give_source(text, integer, integer)
- RETURNS integer AS
- $BODY$
- DECLARE
- pojnt ALIAS FOR $1;
- box ALIAS FOR $2;
- dist ALIAS FOR $3;
- r_source INTEGER;
- BEGIN
- SELECT source INTO r_source
- FROM streets s
- WHERE
- (
- the_geom && expand (pointfromtext(pojnt),box) AND
- distance (s.the_geom , pointfromtext(pojnt)) < dist
- )
- ORDER BY distance (s.the_geom , pointfromtext(pojnt)) ASC
- LIMIT 1;
- RETURN r_source;
- END;
- $BODY$
- LANGUAGE 'plpgsql' VOLATILE;
- ALTER FUNCTION give_source(text, integer, integer) OWNER TO yancho;
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.