break;
case LINETYPE:
lwl = (LWLINE *)lwgeom;
+ if ( lwl->points->npoints == 1 ) {
+ /* Duplicate point, to make geos-friendly */
+ lwl->points = ptarray_addPoint(lwl->points,
+ getPoint_internal(lwl->points, 0),
+ FLAGS_NDIMS(lwl->points->flags),
+ lwl->points->npoints);
+ }
sq = ptarray_to_GEOSCoordSeq(lwl->points);
g = GEOSGeom_createLineString(sq);
if ( ! g )
else
{
sq = ptarray_to_GEOSCoordSeq(lwpoly->rings[0]);
+ /* TODO: check ring for being closed and fix if not */
shell = GEOSGeom_createLinearRing(sq);
if ( ! shell ) return NULL;
/*lwerror("LWGEOM2GEOS: exception during polygon shell conversion"); */
select '#1398a', st_astext(st_snaptogrid(st_project('POINT(-120 45)'::geography, 100000, radians(45))::geometry,0.000001));
select '#1398b', st_astext(st_snaptogrid(st_project('POINT(20 85)'::geography, 2000000, radians(0.1))::geometry,0.000001));
+-- #1543
+with inp as ( select
+'0105000000020000000102000000040000000000000000000000000000000000000000000000000024400000000000000000000000000000244000000000000024400000000000000000000000000000000001020000000100000000000000000000000000000000000000'
+::geometry as g )
+select '#1543', st_astext(g), st_astext(st_buildarea(g)) from inp;
+
-- Clean up
DELETE FROM spatial_ref_sys;
#304
#304.a|21
#304.b|1
-#408|IllegalArgumentException: point array must contain 0 or >1 elements
-NOTICE: IllegalArgumentException: point array must contain 0 or >1 elements
+#408|Too few points in geometry component[2310341.45565344 4836396.65124226]
+NOTICE: Too few points in geometry component at or near point 2310341.4556534393 4836396.6512422552
#408.1|f
-#408.2|IllegalArgumentException: point array must contain 0 or >1 elements
+#408.2|Too few points in geometry component[0 0]
NOTICE: IllegalArgumentException: Invalid number of points in LinearRing found 2 - must be 0 or >= 4
#408.3|f
#408.4|IllegalArgumentException: Invalid number of points in LinearRing found 2 - must be 0 or >= 4
#1042|2
#1398a|POINT(-119.093153 45.632669)
#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))