-
Notifications
You must be signed in to change notification settings - Fork 36
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
Rationale for not supporting empty geometries? #89
Comments
Here is what the spec says:
It seems that maybe we should support |
+1, the
This is unexpected/breaking for me moving to pydantic |
I have been working on an update to address this. Unfortunately the WKT functions were based on the constraints and caused some issues. So I ended up down a bit of a rabbit hole. |
🤔 with #100 I though we fixed this but correct me if I'm wrong @eseglem but we do not support Point(type="Point", coordinates=[])
ValidationError: 2 validation errors for Point
coordinates
wrong tuple length 0, expected 2 (type=value_error.tuple.length; actual_length=0; expected_length=2)
coordinates
wrong tuple length 0, expected 3 (type=value_error.tuple.length; actual_length=0; expected_length=3) LineString(type="LineString", coordinates=[])
---------------------------------------------------------------------------
ValidationError Traceback (most recent call last)
Input In [8], in <cell line: 1>()
----> 1 LineString(type="LineString", coordinates=[])
ValidationError: 1 validation error for LineString
coordinates
ensure this value has at least 2 items (type=value_error.list.min_items; limit_value=2) from geojson_pydantic import MultiPoint
MultiPoint(type="MultiPoint", coordinates=[]) |
@vincentsarago Correct. The spec says a point requires x and y. Whereas multi point is an array of points. So the array can be empty but a point can't. A point can still be null though. And a line string requires 2 points, but a multi line string is an array of line strings with no length requirement. It should all match up with the json schema linked above. I checked the schema and spec multiple times to make sure everything lined up. |
👍 |
thanks folks! |
Hi there! Just wondering if it is a deliberate decision that empty geometries don't pass validation because these constrained lists:
geojson-pydantic/geojson_pydantic/types.py
Lines 13 to 19 in 6a32302
e.g:
Empty geometries seem to be permitted per the geojson spec
The text was updated successfully, but these errors were encountered: