Skip to content

forceCreate arg not usable when creating new Polygon from JSON coordinates field #5

Open
@brandonb927

Description

It seems as though, after attempting to use this fork to parse Twitter API GeoJSON data from this page (which parses fine in the original version of geoPHP), I am unable to use it for my use case. The coordinates in the example below are ripped directly from the Twitter API docs.

$json = "{
    \"coordinates\": [
        [
            [-74.026675, 40.683935],
            [-74.026675, 40.877483],
            [-73.910408, 40.877483],
            [-73.910408, 40.3935]
        ]
    ],
    \"type\": \"Polygon\"
}";

geoPHP::load(json_decode($json, true), 'json'); // <= This throws and exception with 'Cannot create Polygon: contains non-closed ring'

My understanding of the new Polygon class is that the constructor allows passing of a param 'forceCreate' => true to allow the Polygon to resolve itself to the start point, however there is no way to pass this arg through from geoPHP::load.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions