- #4262, Document MULTISURFACE compatibility of ST_LineToCurve (Steven Ottens)
- #4276, ST_AsGeoJSON documentation refresh (Darafei Praliaskouski)
- #4292, ST_AsMVT: parse JSON numeric values with decimals as doubles (Raúl Marín)
+ - #4300, ST_AsMVTGeom: Always return the simplest geometry (Raúl Marín)
PostGIS 2.5.0
2018/09/23
* geom be lost? Sure, but your MVT renderer couldn't
* draw it anyways.
*/
-static void
+static inline LWGEOM *
lwgeom_to_basic_type(LWGEOM *geom, uint8 original_type)
{
+ LWGEOM *geom_out = geom;
if (lwgeom_get_type(geom) == COLLECTIONTYPE)
{
LWCOLLECTION *g = (LWCOLLECTION*)geom;
- LWCOLLECTION *gc = lwcollection_extract(g, original_type);
- *g = *gc;
+ geom_out = (LWGEOM *)lwcollection_extract(g, original_type);
}
+
+ /* If a collection only contains 1 geometry return than instead */
+ if (lwgeom_is_collection(geom_out))
+ {
+ LWCOLLECTION *g = (LWCOLLECTION *)geom_out;
+ if (g->ngeoms == 1)
+ {
+ geom_out = g->geoms[0];
+ }
+ }
+
+ geom_out->srid = geom->srid;
+ return geom_out;
}
/**
}
/* if geometry collection extract highest dimensional geometry type */
- if (lwgeom->type == COLLECTIONTYPE)
- lwgeom_to_basic_type(lwgeom, basic_type);
+ lwgeom = lwgeom_to_basic_type(lwgeom, basic_type);
if (basic_type != lwgeom_get_basic_type(lwgeom))
{
PG17|MULTIPOLYGON(((0 10,0 0,10 0,10 10,0 10),(1 9,9 9,9 1,1 1,1 9)),((2 8,2 2,8 2,8 8,2 8),(3 7,7 7,7 3,3 3,3 7)))
PG18|MULTIPOINT(1 9,3 8)
PG19|MULTIPOINT(25 4079,26 4078)
-PG20|MULTIPOINT(10 4086)
+PG20|POINT(10 4086)
PG21|LINESTRING(1 9,5 5)
PG22|
PG23|MULTILINESTRING((1 9,5 5),(2 2,5 5))
PG43 - OFF|MULTIPOLYGON(((5 5,-1 -1,11 -1,5 5)),((5 5,11 11,-1 11,5 5)))
PG44|
PG45|
-PG46|SRID=3857;MULTIPOLYGON(((3245 2224,3262 2030,3253 2158,3245 2224)))
+PG46|SRID=3857;POLYGON((3245 2224,3262 2030,3253 2158,3245 2224))
PG47|
TG1|GiEKBHRlc3QSDBICAAAYASIECTLePxoCYzEiAigBKIAgeAI=
TG2|GiMKBHRlc3QSDhICAAAYASIGETLePwIBGgJjMSICKAEogCB4Ag==
TU2
ERROR: pgis_asmvt_transfn: parameter row cannot be other than a rowtype
TU3|
-#3922|MULTIPOLYGON(((2613 3664,2615 3662,2616 3662,2617 3665,2615 3665,2615 3664,2613 3664)))
+#3922|POLYGON((2613 3664,2615 3662,2616 3662,2617 3665,2615 3665,2615 3664,2613 3664))
FI1|GicKBHRlc3QSDggBEgIAABgBIgQJMt4/GgJjMiIGCgRhYmNkKIAgeAI=
FI2|GicKBHRlc3QSDggBEgIAABgBIgQJMt4/GgJjMiIGCgRhYmNkKIAgeAI=
FI3|GicKBHRlc3QSDggBEgIAABgBIgQJMt4/GgJjMiIGCgRhYmNkKIAgeAI=