Skip to content

Polygon To WKT Not Returning Valid WKT #37

@byt3sage

Description

@byt3sage

So we seem to have suddenly developed a problem where converting a polygon to WKT gives not valid WKT and it's only recently started happening.

$polygon = new Polygon(
            [
                new LineString([
                    new Point(12.455363273620605, 41.90746728266806),
                    new Point(12.450309991836548, 41.906636872349075),
                    new Point(12.445632219314575, 41.90197359839437),
                    new Point(12.447413206100464, 41.90027269624499),
                    new Point(12.457906007766724, 41.90000118654431),
                    new Point(12.458517551422117, 41.90281205461268),
                    new Point(12.457584142684937, 41.903107507989986),
                    new Point(12.457734346389769, 41.905918239316286),
                    new Point(12.45572805404663, 41.90637337450963),
                    new Point(12.455363273620605, 41.90746728266806),
                ])
            ]
        );
    dd($polygon->toWkt());

This returns:

POLYGON(LINESTRING(POINT(41.907467282668, 12.455363273621),POINT(41.906636872349, 12.450309991837),POINT(41.901973598394, 12.445632219315),POINT(41.900272696245, 12.4474132061),POINT(41.900001186544, 12.457906007767),POINT(41.902812054613, 12.458517551422),POINT(41.90310750799, 12.457584142685),POINT(41.905918239316, 12.45773434639),POINT(41.90637337
451, 12.455728054047),POINT(41.907467282668, 12.455363273621)))

Which is not valid, it should return POLYGON() which this package has been doing previously.

Any ideas on how to resolve would be great!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions