Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] FeatureCollection is valid when it contains any geojson object that is valid #220

Open
KS-HTK opened this issue Sep 29, 2023 · 0 comments

Comments

@KS-HTK
Copy link

KS-HTK commented Sep 29, 2023

import geojson

gj = geojson.FeatureCollection([geojson.Point((0, 0))])
print(gj.is_valid)
print(gj.errors())

gj2 = geojson.FeatureCollection([geojson.Point((0, 0), True)])
print(gj2.is_valid)
print(gj2.errors())

gj3 = geojson.FeatureCollection([geojson.FeatureCollection([geojson.Point((0, 0))])])
print(gj3.is_valid)
print(gj3.errors())

All three FeatureCollections above return is_valid as True even though all of them are invalid.
The geojson specification section 3.3 states that a FeatureCollections feature list should ONLY contain Features.
Point is a geometry and storing those should be done in a GeometryCollection and third is a FeatureCollection that is in its self invalid inside a FeatureCollection. Even if the inside FeatureCollection was valid the outside one should be invalid.

FeatureCollection validation should be revised to cause an error if anything but valid Features are in the feature list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant