v1.1: GeoJSON Polygon coordinates are one level too shallow, so no Curb Zone, Area or Space geometry validates
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 85/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- json, yaml
- Ambito
- api
Direzione di ricerca
Inizia con Shared Data Models/geoJSON_polygon.yaml e Shared Data Models/geoJSON_linestring.yaml, poi esamina come curb_zone.yaml li combina con oneOf. Convalida gli esempi LineString e Polygon dell’issue rispetto allo schema geometrico di Curb Zone usando JSON Schema 2020-12. Il lavoro è completato quando entrambi gli esempi vengono convalidati e lo schema di poligono condiviso richiede coordinate a livello di anello e specifica il tipo di geometria.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
Shared Data Models/geoJSON_polygon.yaml types coordinates with $ref: ./coordinates.yaml, which is an array of [lon, lat] positions. That is LineString depth. In GeoJSON (RFC 7946 §3.1.6) a Polygon's coordinates are an array of linear rings, each ring an array of positions, so there is one more level of nesting.
This has two effects:
- A valid GeoJSON Polygon fails. Curb Area (
curb_area.yaml), Curb Space (curb_space.yaml) and Curb Objectobject_shapeall usegeoJSON_polygon.yaml, so none of them accept a real polygon. - A valid GeoJSON LineString also fails for Curb Zones.
curb_zone.yamldefinesgeometryasoneOf: [geoJSON_polygon, geoJSON_linestring]. Neither schema constrainstype, and both now accept an array of positions, so a LineString matches both branches andoneOfrejects it. Meanwhile a correct Polygon matches neither.
So today there is no geometry a Curb Zone can carry that validates, even though the spec says "A two-dimensional polygon is preferred, but a LineString is acceptable."
Reproduction
Validating the Curb Zone geometry schema from APIs/Curbs API.yaml (JSON Schema 2020-12, Python jsonschema 4.x):
| Geometry | Current schema | With proposed change |
|---|---|---|
Valid LineString {"type":"LineString","coordinates":[[-104.9536,39.7225],[-104.9535,39.7225]]} |
fails ("valid under each of" both oneOf branches) | passes |
Valid Polygon {"type":"Polygon","coordinates":[[[-104.9536,39.7225],[-104.9535,39.7225],[-104.9535,39.7226],[-104.9536,39.7225]]]} |
fails | passes |
I hit this while creating a CDS 1.1 feed for sample curb zones in Denver. The feed passes once the change below is applied, and fails only on these geometry errors without it.
Proposed change
Shared Data Models/geoJSON_polygon.yaml, give coordinates the ring level and pin type:
title: GeoJSON Polygon
x-stoplight:
id: qbu8vzmedfno6
type: object
description: The spatial extent of this curb feature and is represented as a GeoJSON geometry of type "Polygon" as defined in RFC 7946 3.1.6.
properties:
type:
type: string
x-stoplight:
id: o1fhr414qhn9t
description: A GeoJSON type.
enum:
- Polygon
example: Polygon
coordinates:
type: array
x-stoplight:
id: 9qlsbndcs89pk
description: An array of linear rings. The first ring is the exterior boundary and any others are holes. Each ring is a closed array of at least four positions, and each position is [longitude, latitude].
minItems: 1
items:
type: array
minItems: 4
items:
type: array
minItems: 2
maxItems: 2
items:
type: number
required:
- type
- coordinates
Shared Data Models/geoJSON_linestring.yaml, pin type so the Curb Zone oneOf can tell the two apart:
type:
type: string
description: A GeoJSON type.
enum:
- LineString
example: LineString
- Lingua principale
- JavaScript
- Stelle
- 7
- Fork
- 0
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di openmobilityfoundation/cds-openapi
-
TODO: Update the text table for event_purpose.yamlForse di nuovo libera @michael-danko-passport l’ha presa 1154 giorni fa e non c’è nessuna pull request aperta. Aperta
openmobilityfoundation/cds-openapi#7 · 1 commento · 1 assegnatario ·
-
Implement 501 status codeAperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 32/100
openmobilityfoundation/cds-openapi#2 · 1 commento ·
-
documentation
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
openmobilityfoundation/cds-openapi#5 · 4 commenti ·
Tutte le issue di openmobilityfoundation/cds-openapi
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
pedroapfilho/localveil#120 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
ImpactMojo/ImpactMojo#1385 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Seeed-Studio/wiki-documents#5974 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno