-
Notifications
You must be signed in to change notification settings - Fork 56
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
Correct the 'bbox' description for 3D geometries #88
Correct the 'bbox' description for 3D geometries #88
Conversation
@Jesus89 do you know how the json schema needs to be updated for this? (now it harcoded 4 items, but it needs to be 4 or 6) |
I think we can use oneOf and allow both options. If at some point, we include an explicit param for 3D, the If-Then-Else condition could be used too. |
A proposal: {
"bbox": {
"type": "array",
"description": "Bounding Box of the geometries in the file, formatted according to RFC 7946, section 5.",
"oneOf": [
{
"items": [
{
"type": "number",
"description": "The westmost constant longitude line that bounds the rectangle (xmin)."
},
{
"type": "number",
"description": "The minimum constant latitude line that bounds the rectangle (ymin)."
},
{
"type": "number",
"description": "The eastmost constant longitude line that bounds the rectangle (xmax)."
},
{
"type": "number",
"description": "The maximum constant latitude line that bounds the rectangle (ymax)."
}
],
"minItems": 4,
"additionalItems": false
},
{
"items": [
{
"type": "number",
"description": "The westmost constant longitude line that bounds the parallelepiped (xmin)."
},
{
"type": "number",
"description": "The minimum constant latitude line that bounds the parallelepiped (ymin)."
},
{
"type": "number",
"description": "The minimum constant altitude line that bounds the parallelepiped (zmin)."
},
{
"type": "number",
"description": "The eastmost constant longitude line that bounds the parallelepiped (xmax)."
},
{
"type": "number",
"description": "The maximum constant latitude line that bounds the parallelepiped (ymax)."
},
{
"type": "number",
"description": "The maximum constant altitude line that bounds the parallelepiped (zmax)."
}
],
"minItems": 6,
"additionalItems": false
}
]
}
} |
Note that we should review the items' descriptions because of the CRS. |
Given that we split up the 2D and 3D case in the schema, it probably wouldn't hurt to set
+1. Also, I feel like we need to discuss or document whether this bbox is in OGC:WGS84 or in the native CRS of the data. Right now the spec says:
But looking at RFC 7946, section 5, that says:
If I interpret that correctly, if data is saved as
which is contrary to the JSON schema at least. And I think most often bboxes are |
Per some of the CRS related discussions, and a desire to support non CRS-aware readers, it seems important that the axis order of the bounds object remains constant regardless of CRS: [xmin, ymin, xmax, ymax] or [xmin, ymin, zmin, xmax, ymax, zmax]. So it seems the right thing to do is remove the reference to the RFC, and simply state the expected order. |
Our specification is very explicit about axis order, which is always the same regardless of the CRS you use: geoparquet/format-specs/geoparquet.md Lines 124 to 128 in a3c1212
So I don't think there is any ambiguity for the bbox following "axis order of the geometries", as this is always the same. But it would indeed be useful to clarify that the bbox is always in the same coordinate system as the data. |
And the reference to the GeoJSON spec is I think still useful to refer to for the handling of antimeridian, poles, etc |
The discussion is a bit split, but see my last comment at #92 (comment). |
Ah, I was remembering that comment but then couldn't figure out where I saw it. I think if we're not feeling sure about it then we should just hold off for now. See how 3d data in geoparquet plays out and wait for someone to make the case. I'll push out the milestone on this one. |
This PR creates an inconsistency, since the referenced GeoJSON specification does explicitly ask for the bbox to include all used dimensions. To prevent confusion it might be good to explicitly call out that deviation. |
Consensus on call 9/24 seems to be we should just align with GeoJSON and do the same thing they do. @jorisvandenbossche to update the schema. |
I think the schema can be greatly simplified as the descriptions are just annotations anyway and are not used for validation. I assume 2D and 3D is allowed. So something like: {
"description": "Bounding Box of the geometries in the file, formatted according to RFC 7946, section 5.",
"type":"array",
"items":{
"type":"number"
},
"oneOf":[
{
"description": "2D bbox consisting of (xmin, ymin, xmax, ymax)",
"minItems":4,
"maxItems":4
},
{
"description": "3D bbox consisting of (xmin, ymin, zmin, xmax, ymax, zmax)",
"minItems":6,
"maxItems":6
}
]
} |
format-specs/schema.json
Outdated
"description": "2D bbox consisting of (xmin, ymin, xmax, ymax)", | ||
"minItems": 4, | ||
"maxItems": 4, | ||
"additionalItems": false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The additionalItems doesn't add anything (actually, it is ignored), you can remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes, the additionalItems was only needed when using the prefixItems (and except that it would still had to be changed to items: false for the latest version)
format-specs/schema.json
Outdated
"description": "3D bbox consisting of (xmin, ymin, zmin, xmax, ymax, zmax)", | ||
"minItems": 6, | ||
"maxItems": 6, | ||
"additionalItems": false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The additionalItems doesn't add anything, you can remove this.
"items": { | ||
"type": "number" | ||
}, | ||
"oneOf": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's cool; didn't know you could separate items
and the oneOf
declarations
GeoJSON does not require that geometries have only 2 or 3 dimensions. It recommends avoiding more than 3, but doesn't forbid it (see the "SHOULD NOT" in Section 3.1.1.). In addition, the Update: suggested change in #144 |
We only allow 2D or 3D geometries, at the moment (although that is a bit hidden in the description of the "encoding" keyword): geoparquet/format-specs/geoparquet.md Line 113 in 085bb6f
So that means in practice you can only have 4 or 6 values for the bbox? |
I completely missed that. |
In #45 we explicitly allowed 3D geometries, but in that PR I forgot to update the
bbox
description to reflect this.