]> granicus.if.org Git - postgis/commitdiff
#961: ST_AsGeoJSON change to use default args
authorRegina Obe <lr@pcorp.us>
Sun, 1 Jan 2012 15:22:50 +0000 (15:22 +0000)
committerRegina Obe <lr@pcorp.us>
Sun, 1 Jan 2012 15:22:50 +0000 (15:22 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8640 b70326c6-7e19-0410-871a-916f4a2858ee

doc/reference_output.xml
postgis/geography.sql.in.c
postgis/postgis.sql.in.c
postgis/postgis_drop.sql.in.c

index 50be0baa60d6b5953ad384b943fb4309efcba20a..fb7db7c49902aff871c736c9ecf152a88d3d7561 100644 (file)
@@ -243,69 +243,29 @@ CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 150406 3)
                <funcsynopsis>
                        <funcprototype>
                                <funcdef>text <function>ST_AsGeoJSON</function></funcdef>
-                               <paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
-                       </funcprototype>
-                       <funcprototype>
-                               <funcdef>text <function>ST_AsGeoJSON</function></funcdef>
-                               <paramdef><type>geography </type> <parameter>g1</parameter></paramdef>
-                       </funcprototype>
-                       <funcprototype>
-                               <funcdef>text <function>ST_AsGeoJSON</function></funcdef>
-                               <paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
-                               <paramdef><type>integer </type> <parameter>max_decimal_digits</parameter></paramdef>
-                       </funcprototype>
-                       <funcprototype>
-                               <funcdef>text <function>ST_AsGeoJSON</function></funcdef>
-                               <paramdef><type>geography </type> <parameter>g1</parameter></paramdef>
-                               <paramdef><type>integer </type> <parameter>max_decimal_digits</parameter></paramdef>
-                       </funcprototype>
-                       <funcprototype>
-                               <funcdef>text <function>ST_AsGeoJSON</function></funcdef>
-                               <paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
-                               <paramdef><type>integer </type> <parameter>max_decimal_digits</parameter></paramdef>
-                               <paramdef><type>integer </type> <parameter>options</parameter></paramdef>
-                       </funcprototype>
-                       <funcprototype>
-                               <funcdef>text <function>ST_AsGeoJSON</function></funcdef>
-                               <paramdef><type>geography </type> <parameter>g1</parameter></paramdef>
-                               <paramdef><type>integer </type> <parameter>max_decimal_digits</parameter></paramdef>
-                               <paramdef><type>integer </type> <parameter>options</parameter></paramdef>
-                       </funcprototype>
-                       <funcprototype>
-                               <funcdef>text <function>ST_AsGeoJSON</function></funcdef>
-                               <paramdef><type>integer </type> <parameter>version</parameter></paramdef>
-                               <paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
-                       </funcprototype>
-                       <funcprototype>
-                               <funcdef>text <function>ST_AsGeoJSON</function></funcdef>
-                               <paramdef><type>integer </type> <parameter>gj_version</parameter></paramdef>
-                               <paramdef><type>geography </type> <parameter>g1</parameter></paramdef>
-                       </funcprototype>
-                       <funcprototype>
-                               <funcdef>text <function>ST_AsGeoJSON</function></funcdef>
-                               <paramdef><type>integer </type> <parameter>gj_version</parameter></paramdef>
-                               <paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
-                               <paramdef><type>integer </type> <parameter>max_decimal_digits</parameter></paramdef>
+                               <paramdef><type>geometry </type> <parameter>geom</parameter></paramdef>
+                               <paramdef choice='opt'><type>integer </type> <parameter>maxdecimaldigits=15</parameter></paramdef>
+                               <paramdef choice='opt'><type>integer </type> <parameter>options=0</parameter></paramdef>
                        </funcprototype>
                        <funcprototype>
                                <funcdef>text <function>ST_AsGeoJSON</function></funcdef>
-                               <paramdef><type>integer </type> <parameter>gj_version</parameter></paramdef>
-                               <paramdef><type>geography </type> <parameter>g1</parameter></paramdef>
-                               <paramdef><type>integer </type> <parameter>max_decimal_digits</parameter></paramdef>
+                               <paramdef><type>geography </type> <parameter>geog</parameter></paramdef>
+                               <paramdef choice='opt'><type>integer </type> <parameter>maxdecimaldigits=15</parameter></paramdef>
+                               <paramdef choice='opt'><type>integer </type> <parameter>options=0</parameter></paramdef>
                        </funcprototype>
                        <funcprototype>
                                <funcdef>text <function>ST_AsGeoJSON</function></funcdef>
                                <paramdef><type>integer </type> <parameter>gj_version</parameter></paramdef>
-                               <paramdef><type>geometry </type> <parameter>g1</parameter></paramdef>
-                               <paramdef><type>integer </type> <parameter>max_decimal_digits</parameter></paramdef>
-                               <paramdef><type>integer </type> <parameter>options</parameter></paramdef>
+                               <paramdef><type>geometry </type> <parameter>geom</parameter></paramdef>
+                               <paramdef choice='opt'><type>integer </type> <parameter>maxdecimaldigits=15</parameter></paramdef>
+                               <paramdef choice='opt'><type>integer </type> <parameter>options=0</parameter></paramdef>
                        </funcprototype>
                        <funcprototype>
                                <funcdef>text <function>ST_AsGeoJSON</function></funcdef>
                                <paramdef><type>integer </type> <parameter>gj_version</parameter></paramdef>
-                               <paramdef><type>geography </type> <parameter>g1</parameter></paramdef>
-                               <paramdef><type>integer </type> <parameter>max_decimal_digits</parameter></paramdef>
-                               <paramdef><type>integer </type> <parameter>options</parameter></paramdef>
+                               <paramdef><type>geography </type> <parameter>geog</parameter></paramdef>
+                               <paramdef choice='opt'><type>integer </type> <parameter>maxdecimaldigits=15</parameter></paramdef>
+                               <paramdef choice='opt'><type>integer </type> <parameter>options=0</parameter></paramdef>
                        </funcprototype>
                </funcsynopsis>
          </refsynopsisdiv>
index 3a88bb43665a517b1e2c3b96fd2dbf5b33f631fb..e2d7d90de39f57e31a45571051c5fa519b22a364 100644 (file)
@@ -474,47 +474,25 @@ CREATE OR REPLACE FUNCTION _ST_AsGeoJson(int4, geography, int4, int4)
        AS 'MODULE_PATHNAME','geography_as_geojson'
        LANGUAGE 'C' IMMUTABLE STRICT;
 
--- ST_AsGeoJson(geography, precision) / version=1 options=0
-CREATE OR REPLACE FUNCTION ST_AsGeoJson(geography, int4)
-       RETURNS text
-       AS 'SELECT _ST_AsGeoJson(1, $1, $2, 0)'
-       LANGUAGE 'SQL' IMMUTABLE STRICT;
-
--- ST_AsGeoJson(geography) / precision=15 version=1 options=0
-CREATE OR REPLACE FUNCTION ST_AsGeoJson(geography)
-       RETURNS text
-       AS 'SELECT _ST_AsGeoJson(1, $1, 15, 0)'
-       LANGUAGE 'SQL' IMMUTABLE STRICT;
-
 -- Availability: 1.5.0 - this is just a hack to prevent unknown from causing ambiguous name because of geography
--- TODO Remove in 2.0
+-- Deprecated in 2.0.0
 CREATE OR REPLACE FUNCTION ST_AsGeoJson(text)
        RETURNS text AS
-       $$ SELECT ST_AsGeoJson($1::geometry);  $$
-       LANGUAGE 'SQL' IMMUTABLE STRICT;
-
--- ST_AsGeoJson(version, geography) / precision=15 options=0
-CREATE OR REPLACE FUNCTION ST_AsGeoJson(int4, geography)
-       RETURNS text
-       AS 'SELECT _ST_AsGeoJson($1, $2, 15, 0)'
-       LANGUAGE 'SQL' IMMUTABLE STRICT;
-
--- ST_AsGeoJson(version, geography, precision) / options=0
-CREATE OR REPLACE FUNCTION ST_AsGeoJson(int4, geography, int4)
-       RETURNS text
-       AS 'SELECT _ST_AsGeoJson($1, $2, $3, 0)'
+       $$ SELECT _ST_AsGeoJson(1, $1::geometry,15,0);  $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 -- ST_AsGeoJson(geography, precision, options) / version=1
-CREATE OR REPLACE FUNCTION ST_AsGeoJson(geography, int4, int4)
+-- Changed: 2.0.0 to use default args and named args
+CREATE OR REPLACE FUNCTION ST_AsGeoJson(geog geography, maxdecimaldigits int4 DEFAULT 15, options int4 DEFAULT 0)
        RETURNS text
-       AS 'SELECT _ST_AsGeoJson(1, $1, $2, $3)'
+       AS $$ SELECT _ST_AsGeoJson(1, $1, $2, $3); $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 -- ST_AsGeoJson(version, geography, precision,options)
-CREATE OR REPLACE FUNCTION ST_AsGeoJson(int4, geography, int4, int4)
+-- Changed: 2.0.0 to use default args and named args
+CREATE OR REPLACE FUNCTION ST_AsGeoJson(gj_version int4, geog geography, maxdecimaldigits int4 DEFAULT 15, options int4 DEFAULT 0)
        RETURNS text
-       AS 'SELECT _ST_AsGeoJson($1, $2, $3, $4)'
+       AS $$ SELECT _ST_AsGeoJson($1, $2, $3, $4); $$
        LANGUAGE 'SQL' IMMUTABLE STRICT;
 
 -- ---------- ---------- ---------- ---------- ---------- ---------- ----------
index 2b6c3cdc3e6e993f9ed50d4b73f01eadfd59ebe2..1acb5f3ed9c4c119db9828e3005b80682c29cf64 100644 (file)
@@ -3218,40 +3218,18 @@ CREATE OR REPLACE FUNCTION _ST_AsGeoJson(int4, geometry, int4, int4)
        AS 'MODULE_PATHNAME','LWGEOM_asGeoJson'\r
        LANGUAGE 'C' IMMUTABLE STRICT;\r
 \r
--- ST_AsGeoJson(geom, precision) / version=1 options=0\r
-CREATE OR REPLACE FUNCTION ST_AsGeoJson(geometry, int4)\r
-       RETURNS TEXT\r
-       AS 'SELECT _ST_AsGeoJson(1, $1, $2, 0)'\r
-       LANGUAGE 'SQL' IMMUTABLE STRICT;\r
-\r
--- ST_AsGeoJson(geom) / precision=15 version=1 options=0\r
-CREATE OR REPLACE FUNCTION ST_AsGeoJson(geometry)\r
-       RETURNS TEXT\r
-       AS 'SELECT _ST_AsGeoJson(1, $1, 15, 0)'\r
-       LANGUAGE 'SQL' IMMUTABLE STRICT;\r
-\r
--- ST_AsGeoJson(version, geom) / precision=15 options=0\r
-CREATE OR REPLACE FUNCTION ST_AsGeoJson(int4, geometry)\r
-       RETURNS TEXT\r
-       AS 'SELECT _ST_AsGeoJson($1, $2, 15, 0)'\r
-       LANGUAGE 'SQL' IMMUTABLE STRICT;\r
-\r
--- ST_AsGeoJson(version, geom, precision) / options=0\r
-CREATE OR REPLACE FUNCTION ST_AsGeoJson(int4, geometry, int4)\r
-       RETURNS TEXT\r
-       AS 'SELECT _ST_AsGeoJson($1, $2, $3, 0)'\r
-       LANGUAGE 'SQL' IMMUTABLE STRICT;\r
-\r
 -- ST_AsGeoJson(geom, precision, options) / version=1\r
-CREATE OR REPLACE FUNCTION ST_AsGeoJson(geometry, int4, int4)\r
+-- Changed 2.0.0 to use default args and named args\r
+CREATE OR REPLACE FUNCTION ST_AsGeoJson(geom geometry, maxdecimaldigits int4 DEFAULT 15, options int4 DEFAULT 0)\r
        RETURNS TEXT\r
-       AS 'SELECT _ST_AsGeoJson(1, $1, $2, $3)'\r
+       AS $$ SELECT _ST_AsGeoJson(1, $1, $2, $3); $$\r
        LANGUAGE 'SQL' IMMUTABLE STRICT;\r
 \r
 -- ST_AsGeoJson(version, geom, precision,options)\r
-CREATE OR REPLACE FUNCTION ST_AsGeoJson(int4, geometry, int4, int4)\r
+-- Changed 2.0.0 to use default args and named args\r
+CREATE OR REPLACE FUNCTION ST_AsGeoJson(gj_version int4, geom geometry, maxdecimaldigits int4 DEFAULT 15, options int4 DEFAULT 0)\r
        RETURNS TEXT\r
-       AS 'SELECT _ST_AsGeoJson($1, $2, $3, $4)'\r
+       AS $$ SELECT _ST_AsGeoJson($1, $2, $3, $4); $$\r
        LANGUAGE 'SQL' IMMUTABLE STRICT;\r
 \r
 ------------------------------------------------------------------------\r
index 919f8558306240f2b7a71c2fbd025150ef6e933f..b50e38591c9e2599fdebc28cd239ccf4e0605239 100644 (file)
@@ -27,6 +27,14 @@ DROP FUNCTION IF EXISTS box2d_overlap(box2d, box2d);
 DROP FUNCTION IF EXISTS box2d_same(box2d, box2d);
 DROP FUNCTION IF EXISTS box2d_intersects(box2d, box2d);
 DROP FUNCTION IF EXISTS st_area(geography); -- this one changed to use default parameters
+DROP FUNCTION IF EXISTS ST_AsGeoJson(geometry); -- this one changed to use default args 
+DROP FUNCTION IF EXISTS ST_AsGeoJson(geography); -- this one changed to use default args 
+DROP FUNCTION IF EXISTS ST_AsGeoJson(geometry,int4); -- this one changed to use default args 
+DROP FUNCTION IF EXISTS ST_AsGeoJson(geography,int4); -- this one changed to use default args 
+DROP FUNCTION IF EXISTS ST_AsGeoJson(int4,geometry); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(int4,geography); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(int4,geometry,int4); -- this one changed to use default args
+DROP FUNCTION IF EXISTS ST_AsGeoJson(int4,geography,int4); -- this one changed to use default args
 DROP FUNCTION IF EXISTS st_asgml(geometry); -- changed to use default args
 DROP FUNCTION IF EXISTS st_asgml(geometry, int4);  -- changed to use default args
 DROP FUNCTION IF EXISTS st_asgml(int4, geometry);  -- changed to use default args