Skip to content

Valid geojson with GeometryCollection fails to parse #7

@ihazbackup

Description

@ihazbackup

The example geojson (Simply 1 feature of GeometryCollection with 2 geometries and 1 feature with 1 geometry)

{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"GeometryCollection","geometries":[{"type":"LineString","coordinates":[[8.56536626815796,50.099440987635006],[8.56654644012451,50.10014295549277],[8.56757640838623,50.099179467568035],[8.56854200363159,50.0995235726227]]},{"type":"Polygon","coordinates":[[[8.56665372848511,50.10123029716223],[8.56746912002563,50.10052834523708],[8.56946468353271,50.10151933320046],[8.56864929199219,50.102124926864064],[8.56665372848511,50.10123029716223]]]}]},"properties":{"id":1552761}},{"type":"Feature","geometry":{"type":"LineString","coordinates":[[8.569207191467285,50.09993649542588],[8.570473194122314,50.10063845602318],[8.571674823760986,50.09979885488693],[8.57259750366211,50.099977787510454]]},"properties":null}]}

Code is simply Geo::JSON->from_json($geojson_string);

The error:
Reference [{"coordinates" => 'ARRAY(0x556306d46d48)',"type" => "LineSt...] did not pass type constraint "ArrayRef[Geometry]" (in $args->{"geometries"}) at /home/christian/perl5/perlbrew/perls/perl-5.22.3/lib/site_perl/5.22.3/Geo/JSON.pm line 45 Reference [{"coordinates" => 'ARRAY(0x556306d46d48)',"type" => "LineSt...] did not pass type constraint "ArrayRef[Geometry]" (in $args->{"geometries"}) "ArrayRef[Geometry]" constrains each value in the array with "Geometry" "Geometry" is a subtype of "Object" Reference {"coordinates" => ['ARRAY(0x556306d475b0)','ARRAY(0x556306d4...} did not pass type constraint "Object" (in $args->{"geometries"}->[0]) "Object" is defined as: (Scalar::Util::blessed($_))

The same geojson string put into http://geojsonlint.com/ is valid and shows the correct geometries on the map

The error seems to happen with GeometryCollection accompanied with 1 or more geometry outside it

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