Changeset 8868

Show
Ignore:
Timestamp:
01/18/12 06:17:11 (4 months ago)
Author:
strk
Message:

Add ST_Summary(geography), "G" flag (#1277), document (#649)

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/doc/reference_accessor.xml

    r8484 r8868  
    20792079                <refname>ST_Summary</refname> 
    20802080 
    2081                 <refpurpose>Returns a text summary of the contents of the 
    2082                 <varname>ST_Geometry</varname>. 
     2081                <refpurpose> 
     2082Returns a text summary of the contents of the geometry. 
    20832083                </refpurpose> 
    20842084          </refnamediv> 
     
    20882088                  <funcprototype> 
    20892089                        <funcdef>text <function>ST_Summary</function></funcdef> 
    2090  
    20912090                        <paramdef><type>geometry </type> <parameter>g</parameter></paramdef> 
    20922091                  </funcprototype> 
     2092                  <funcprototype> 
     2093                        <funcdef>text <function>ST_Summary</function></funcdef> 
     2094                        <paramdef><type>geography </type> <parameter>g</parameter></paramdef> 
     2095                  </funcprototype> 
    20932096                </funcsynopsis> 
    20942097          </refsynopsisdiv> 
     
    20982101 
    20992102                <para>Returns a text summary of the contents of the geometry.</para> 
     2103 
     2104                <para> 
     2105                  Flags shown square brackets after the geometry type 
     2106                  have the following meaning: 
     2107                  <itemizedlist> 
     2108                    <listitem><para>M: has M ordinate</para></listitem> 
     2109                    <listitem><para>Z: has Z ordinate</para></listitem> 
     2110                    <listitem><para>B: has a cached bounding box</para></listitem> 
     2111                    <listitem><para>G: is geodetic (geography)</para></listitem> 
     2112                  </itemizedlist> 
     2113                </para> 
     2114 
    21002115                <para>&Z_support;</para> 
    2101  
    2102           </refsection> 
    2103  
    2104           <refsection> 
    2105                 <title>Examples</title> 
    2106  
    2107                 <programlisting>SELECT ST_Summary(ST_GeomFromText('LINESTRING(0 0, 1 1)')) As good_line, 
    2108         ST_Summary(ST_GeomFromText('POLYGON((0 0, 1 1, 1 2, 1 1, 0 0))')) As bad_poly 
    2109 --results 
    2110           good_line       |        bad_poly 
    2111 ----------------------+------------------------- 
    2112                                           | 
    2113 Line[B] with 2 points : Polygon[B] with 1 rings 
    2114                                           :    ring 0 has 5 points 
    2115                                           : 
    2116  
    2117 --3d polygon 
    2118 SELECT ST_Summary(ST_GeomFromEWKT('LINESTRING(0 0 1, 1 1 1)')) As good_line, 
    2119         ST_Summary(ST_GeomFromEWKT('POLYGON((0 0 1, 1 1 2, 1 2 3, 1 1 1, 0 0 1))')) As poly 
    2120  
    2121 --results 
    2122           good_line       |        poly 
    2123 ----------------------+------------------------- 
    2124                                           | 
    2125 Line[ZB] with 2 points : Polygon[ZB] with 1 rings 
    2126                                           :    ring 0 has 5 points 
    2127                                           : 
     2116                <para>Availability: 1.2.2 - 2.0.0 added support for geography</para> 
     2117 
     2118          </refsection> 
     2119 
     2120          <refsection> 
     2121                <title>Examples</title> 
     2122 
     2123                <programlisting> 
     2124=# SELECT ST_Summary(ST_GeomFromText('LINESTRING(0 0, 1 1)')) as geom, 
     2125        ST_Summary(ST_GeogFromText('POLYGON((0 0, 1 1, 1 2, 1 1, 0 0))')) geog; 
     2126            geom             |          geog     
     2127-----------------------------+-------------------------- 
     2128 LineString[B] with 2 points | Polygon[BG] with 1 rings 
     2129                             :    ring 0 has 5 points 
     2130                             : 
     2131(1 row) 
     2132 
     2133 
     2134=# SELECT ST_Summary(ST_GeogFromText('LINESTRING(0 0 1, 1 1 1)')) As geog_line, 
     2135        ST_Summary(ST_GeomFromText('POLYGON((0 0 1, 1 1 2, 1 2 3, 1 1 1, 0 0 1))')) As geom_poly; 
     2136; 
     2137           geog_line           |        geom_poly 
     2138-------------------------------+-------------------------- 
     2139 LineString[ZBG] with 2 points | Polygon[ZB] with 1 rings 
     2140                               :    ring 0 has 5 points 
     2141                               : 
     2142(1 row) 
    21282143 
    21292144</programlisting> 
     
    21342149 
    21352150                <para> 
     2151<xref linkend="PostGIS_DropBBox" />, 
     2152<xref linkend="PostGIS_AddBBox" />, 
     2153<xref linkend="ST_Force_3DM" />, 
     2154<xref linkend="ST_Force_3DZ" />, 
     2155<xref linkend="ST_Force_2D" />, 
     2156<xref linkend="geography" /> 
     2157                </para> 
     2158 
     2159                <para> 
     2160<xref linkend="ST_IsValid" />, 
    21362161<xref linkend="ST_IsValid" />, 
    21372162<xref linkend="ST_IsValidReason" />, 
    21382163<xref linkend="ST_IsValidDetail" /> 
    2139 </para> 
     2164                </para> 
    21402165          </refsection> 
    21412166        </refentry> 
  • trunk/liblwgeom/lwgeom_debug.c

    r8838 r8868  
    1818 
    1919/* Place to hold the ZM string used in other summaries */ 
    20 static char tflags[4]; 
     20static char tflags[5]; 
    2121 
    2222static char * 
    23 lwtype_zmflags(uint8_t flags) 
     23lwtype_flagchars(uint8_t flags) 
    2424{ 
    2525        int flagno = 0; 
     
    2727        if ( FLAGS_GET_M(flags) ) tflags[flagno++] = 'M'; 
    2828        if ( FLAGS_GET_BBOX(flags) ) tflags[flagno++] = 'B'; 
     29        if ( FLAGS_GET_GEODETIC(flags) ) tflags[flagno++] = 'G'; 
    2930        tflags[flagno] = '\0'; 
    3031 
     
    4243        char *result; 
    4344        char *pad=""; 
    44         char *zmflags = lwtype_zmflags(point->flags); 
     45        char *zmflags = lwtype_flagchars(point->flags); 
    4546 
    4647        result = (char *)lwalloc(128+offset); 
     
    5758        char *result; 
    5859        char *pad=""; 
    59         char *zmflags = lwtype_zmflags(line->flags); 
     60        char *zmflags = lwtype_flagchars(line->flags); 
    6061 
    6162        result = (char *)lwalloc(128+offset); 
     
    7778        int i; 
    7879        char *pad=""; 
    79         char *zmflags = lwtype_zmflags(col->flags); 
     80        char *zmflags = lwtype_flagchars(col->flags); 
    8081 
    8182        LWDEBUG(2, "lwcollection_summary called"); 
     
    113114        int i; 
    114115        char *pad=""; 
    115         char *zmflags = lwtype_zmflags(poly->flags); 
     116        char *zmflags = lwtype_flagchars(poly->flags); 
    116117 
    117118        LWDEBUG(2, "lwpoly_summary called"); 
  • trunk/postgis/geography.sql.in.c

    r8860 r8868  
    704704        LANGUAGE 'C' IMMUTABLE STRICT; 
    705705 
     706-- Availability: 2.0.0 
     707CREATE OR REPLACE FUNCTION ST_Summary(geography) 
     708        RETURNS text 
     709        AS 'MODULE_PATHNAME', 'LWGEOM_summary' 
     710        LANGUAGE 'C' IMMUTABLE STRICT; 
     711 
    706712         
    707713-----------------------------------------------------------------------------