Project

General

Profile

« Previous | Next » 

Revision 13886

schemas/util.sql: added bounding_box__no_dateline(), which is more accurate than util.bounding_box() (latitude lines will be straight), but geocoordinate wraparound is not supported

View differences:

trunk/schemas/util.sql
766 766

  
767 767

  
768 768
--
769
-- Name: bounding_box__no_dateline(range, range); Type: FUNCTION; Schema: util; Owner: -
770
--
771

  
772
CREATE FUNCTION bounding_box__no_dateline(latitude_range_deg range, longitude_range_deg range) RETURNS postgis.geometry
773
    LANGUAGE sql IMMUTABLE
774
    AS $_$
775
/* don't use st_makebox2d() because it doesn't support geocoordinate wraparound
776
(it is not SRID-aware) */
777
SELECT postgis.st_makeenvelope(
778
  /*xmin=*/$2.lower, /*ymin=*/$1.lower
779
, /*xmax=*/$2.upper, /*ymax=*/$1.upper
780
, /*WGS84*/4326
781
)
782
$_$;
783

  
784

  
785
--
786
-- Name: FUNCTION bounding_box__no_dateline(latitude_range_deg range, longitude_range_deg range); Type: COMMENT; Schema: util; Owner: -
787
--
788

  
789
COMMENT ON FUNCTION bounding_box__no_dateline(latitude_range_deg range, longitude_range_deg range) IS '
790
the generated bounding box is more accurate than util.bounding_box() (latitude
791
lines will be straight), but geocoordinate wraparound is not supported
792

  
793
usage:
794
SET search_path = util; -- for ~ operator
795
SELECT util.bounding_box__no_dateline(lower_lat ~ upper_lat, lower_long ~ upper_long);
796
';
797

  
798

  
799
--
769 800
-- Name: cast(text, anyelement); Type: FUNCTION; Schema: util; Owner: -
770 801
--
771 802

  

Also available in: Unified diff