Project

General

Profile

« Previous | Next » 

Revision 13890

schemas/util.sql: point(): take a single util.geocoord param instead of separate lat/long

View differences:

util.sql
2286 2286
    AS $_$
2287 2287
/* use function rather than operator+search_path to allow inlining, which
2288 2288
enables util.new_world() to only be evaluated once */
2289
SELECT util.contained_within(util.point($1, $2), util.new_world())
2289
SELECT util.contained_within(util.point(($1, $2)), util.new_world())
2290 2290
$_$;
2291 2291

  
2292 2292

  
......
3037 3037

  
3038 3038

  
3039 3039
--
3040
-- Name: point(double precision, double precision); Type: FUNCTION; Schema: util; Owner: -
3040
-- Name: point(geocoord); Type: FUNCTION; Schema: util; Owner: -
3041 3041
--
3042 3042

  
3043
CREATE FUNCTION point(latitude_deg double precision, longitude_deg double precision) RETURNS postgis.geography
3043
CREATE FUNCTION point(geocoord geocoord) RETURNS postgis.geography
3044 3044
    LANGUAGE sql IMMUTABLE
3045 3045
    SET client_min_messages TO 'warning'
3046 3046
    AS $_$
3047
SELECT postgis.st_setsrid(postgis.st_point(/*x_lon=*/$2, /*y_lat=*/$1),
3047
SELECT postgis.st_setsrid(postgis.st_point(
3048
/*x_lon=*/$1.longitude_deg, /*y_lat=*/$1.latitude_deg),
3048 3049
/*WGS84*/4326)::postgis.geography
3049 3050
$_$;
3050 3051

  

Also available in: Unified diff