From: Sandro Santilli Date: Fri, 18 Jan 2013 18:09:22 +0000 (+0000) Subject: Have ST_Summary advertise presence of known srid with an [S] flag X-Git-Tag: 2.1.0beta2~240 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b8b3a16c0dc3649f6ecfebb233693570cb32005a;p=postgis Have ST_Summary advertise presence of known srid with an [S] flag Closes #2178 git-svn-id: http://svn.osgeo.org/postgis/trunk@11004 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/NEWS b/NEWS index e146b602f..3f3e07cd2 100644 --- a/NEWS +++ b/NEWS @@ -112,6 +112,7 @@ PostGIS 2.1.0 variant of ST_SetValues(rast). - Proper support for raster band's isnodata flag in core API and loader. - Additional default values for parameters of ST_Aspect and ST_HillShade + - #2178, ST_Summary now advertises presence of known srid with an [S] flag * Fixes * diff --git a/liblwgeom/lwgeom_debug.c b/liblwgeom/lwgeom_debug.c index 2464645cc..97a69ead8 100644 --- a/liblwgeom/lwgeom_debug.c +++ b/liblwgeom/lwgeom_debug.c @@ -17,16 +17,17 @@ #include /* Place to hold the ZM string used in other summaries */ -static char tflags[5]; +static char tflags[6]; static char * -lwtype_flagchars(uint8_t flags) +lwgeom_flagchars(LWGEOM *lwg) { int flagno = 0; - if ( FLAGS_GET_Z(flags) ) tflags[flagno++] = 'Z'; - if ( FLAGS_GET_M(flags) ) tflags[flagno++] = 'M'; - if ( FLAGS_GET_BBOX(flags) ) tflags[flagno++] = 'B'; - if ( FLAGS_GET_GEODETIC(flags) ) tflags[flagno++] = 'G'; + if ( FLAGS_GET_Z(lwg->flags) ) tflags[flagno++] = 'Z'; + if ( FLAGS_GET_M(lwg->flags) ) tflags[flagno++] = 'M'; + if ( FLAGS_GET_BBOX(lwg->flags) ) tflags[flagno++] = 'B'; + if ( FLAGS_GET_GEODETIC(lwg->flags) ) tflags[flagno++] = 'G'; + if ( lwg->srid != SRID_UNKNOWN ) tflags[flagno++] = 'S'; tflags[flagno] = '\0'; LWDEBUGF(4, "Flags: %s - returning %p", flags, tflags); @@ -42,7 +43,7 @@ lwpoint_summary(LWPOINT *point, int offset) { char *result; char *pad=""; - char *zmflags = lwtype_flagchars(point->flags); + char *zmflags = lwgeom_flagchars((LWGEOM*)point); result = (char *)lwalloc(128+offset); @@ -57,7 +58,7 @@ lwline_summary(LWLINE *line, int offset) { char *result; char *pad=""; - char *zmflags = lwtype_flagchars(line->flags); + char *zmflags = lwgeom_flagchars((LWGEOM*)line); result = (char *)lwalloc(128+offset); @@ -78,7 +79,7 @@ lwcollection_summary(LWCOLLECTION *col, int offset) int i; static char *nl = "\n"; char *pad=""; - char *zmflags = lwtype_flagchars(col->flags); + char *zmflags = lwgeom_flagchars((LWGEOM*)col); LWDEBUG(2, "lwcollection_summary called"); @@ -116,7 +117,7 @@ lwpoly_summary(LWPOLY *poly, int offset) int i; char *pad=""; static char *nl = "\n"; - char *zmflags = lwtype_flagchars(poly->flags); + char *zmflags = lwgeom_flagchars((LWGEOM*)poly); LWDEBUG(2, "lwpoly_summary called"); diff --git a/regress/summary_expected b/regress/summary_expected index fe2ba7ddd..1a2c48529 100644 --- a/regress/summary_expected +++ b/regress/summary_expected @@ -1,14 +1,14 @@ T1|Point[] T1B|Point[B] -T1S|Point[] +T1S|Point[S] T1M|Point[M] T1Z|Point[Z] T1ZM|Point[ZM] T1ZMB|Point[ZMB] -T1ZMBS|Point[ZMB] +T1ZMBS|Point[ZMBS] T3|MultiPoint[B] with 1 elements Point[] -T4|MultiPoint[B] with 1 elements +T4|MultiPoint[BS] with 1 elements Point[] T5|GeometryCollection[B] with 2 elements MultiLineString[] with 2 elements @@ -16,7 +16,7 @@ T5|GeometryCollection[B] with 2 elements LineString[] with 2 points MultiPoint[] with 1 elements Point[] -T6|GeometryCollection[B] with 2 elements +T6|GeometryCollection[BS] with 2 elements MultiLineString[] with 2 elements LineString[] with 2 points LineString[] with 2 points diff --git a/regress/tickets_expected b/regress/tickets_expected index 7bcf711c9..ce3667b42 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -198,9 +198,9 @@ NOTICE: Coordinate values were coerced into range [-180 -90, 180 90] for GEOGRA #1398b|POINT(-160.137654 77.091608) #1543|MULTILINESTRING((0 0,10 0,10 10,0 0),(0 0))|POLYGON((0 0,10 10,10 0,0 0)) #1578|f|f -#1580.1|Point[B] +#1580.1|Point[BS] ERROR: transform: couldn't project point (180 90 0): tolerance condition error (-20) -#1580.3|Point[B] +#1580.3|Point[BS] #1596.1|public.road_pg.roads_geom SRID:3395 TYPE:POINT DIMS:2 ERROR: invalid SRID: 330000 not found in spatial_ref_sys #1596.3|3395 @@ -209,7 +209,7 @@ ERROR: invalid SRID: 999000 not found in spatial_ref_sys NOTICE: SRID value -1 converted to the officially unknown SRID value 0 #1596.6|public.road_pg.roads_geom SRID changed to 0 #1596.7|0 -#1596|Point[BG] +#1596|Point[BGS] #1695|MULTIPOLYGON EMPTY #1697.1|0 #1697.2|0