-
Notifications
You must be signed in to change notification settings - Fork 35
Add optional GeoJSON geometry schema and design guidance to Commonalities #594
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
Draft
sergiobrisio
wants to merge
3
commits into
camaraproject:main
Choose a base branch
from
sergiobrisio:feature/geojson-alternative-schema
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| # GeoJSON Geometry Model (Optional) – Commonalities Guidance | ||
|
|
||
| This document introduces an **optional GeoJSON (RFC 7946)** geometry model for CAMARA APIs that require spatial comparison or GIS-native capabilities. | ||
|
sergiobrisio marked this conversation as resolved.
Outdated
|
||
|
|
||
| The intention is **not** to replace the existing CAMARA `Area` datatype, but to provide an additional model when needed, | ||
| without impacting existing and future CAMARA APIs that only require simple Circle or Polygon structures. | ||
|
|
||
| --- | ||
|
|
||
| ## 1. Motivation | ||
|
|
||
| Some CAMARA APIs currently perform **geometric comparisons**, such as: | ||
|
|
||
| - checking containment (within) | ||
| - checking intersection / overlap | ||
| - computing an intersection area | ||
| - determining coverage relationships | ||
|
|
||
| These are best handled using **GIS-native geometry models**, which already exist in spatial databases and GIS engines. | ||
|
|
||
| The current CAMARA `Area` model (Circle / Polygon using custom JSON) is sufficient for *simple* APIs that only **return** an area. | ||
|
sergiobrisio marked this conversation as resolved.
Outdated
|
||
| However, APIs performing **spatial predicates** benefit from using a standard format. | ||
|
|
||
| --- | ||
|
|
||
| ## 2. Proposal | ||
|
|
||
| Introduce an **optional** geometry type: | ||
| ```json | ||
| GeoJSONGeometry: | ||
| type: object | ||
| description: RFC 7946 GeoJSON geometry object | ||
| ``` | ||
|
|
||
| --- | ||
|
|
||
| APIs MAY choose whether to use: | ||
|
|
||
| - **CAMARA `Area` (Circle/Polygon)** → for simple location-returning APIs | ||
| - **`GeoJSONGeometry`** → for APIs requiring spatial search, geometric comparisons, or integration with GIS engines | ||
|
|
||
| This proposal: | ||
| - does **not** require any existing API to change | ||
| - does **not** mandate a `oneOf` with both models | ||
| - keeps Area/Circle/Polygon fully valid | ||
| - lets each API initiative decide independently which model is appropriate. | ||
|
|
||
| --- | ||
| ## 3. Why Optional GeoJSON? | ||
|
|
||
| ### 3.1 CAMARA principles | ||
| CAMARA aims to provide **simple, developer-friendly APIs**. | ||
| Many APIs do not need full GIS capability, and forcing GeoJSON adoption would add | ||
| unnecessary complexity. | ||
|
|
||
| ### 3.2 When to use CAMARA Area | ||
| Use the existing `Area` / `Circle` / `Polygon` types when an API only needs to: | ||
|
|
||
| - return a device location area | ||
| - represent coarse-grained coverage | ||
| - pass a simple geometric boundary without geometric computations | ||
|
|
||
| ### 3.3 When GeoJSON helps | ||
| Use GeoJSON when an API must perform: | ||
|
|
||
| - overlap detection | ||
| - containment verification | ||
| - geometric search among multiple areas | ||
| - distance or coverage evaluation | ||
| - spatial indexing through GIS engines | ||
|
|
||
| GeoJSON aligns with existing mature stacks such as PostGIS, Oracle Spatial, | ||
| SQL Server Geography, GeoServer, Elasticsearch, MongoDB, and others. | ||
|
|
||
| --- | ||
|
|
||
| ## 4. Circles in GeoJSON | ||
|
|
||
| GeoJSON does not define a `Circle` type, consistent with GIS industry practice. | ||
| Common approaches include: | ||
|
|
||
| - **Polygon approximation** (recommended and universally supported) | ||
| - **Feature(Point) + radius** as a convenience input extension | ||
| - Optional `"type": "Circle"` as a non-standard hint, internally converted to polygon | ||
|
|
||
| All approaches result in a Polygon for authoritative spatial operations. | ||
|
|
||
| --- | ||
|
|
||
| ## 5. API Design Guidance | ||
|
|
||
| To avoid fragmentation and keep APIs simple, the following guidance is recommended: | ||
|
|
||
| - **Simple APIs** | ||
| (that only *return* an area) | ||
| → SHOULD use the existing CAMARA `Area` datatype. | ||
|
|
||
| - **APIs requiring geometric comparison** | ||
| (containment, overlap, match rate, coverage, spatial search) | ||
| → SHOULD consider using the optional `GeoJSONGeometry` datatype. | ||
|
|
||
| - **Each API initiative remains autonomous** | ||
| No API is required to support both models. | ||
| API designers choose the most suitable model for their scenario. | ||
|
|
||
| --- | ||
|
|
||
| ## 6. Summary | ||
|
|
||
| This proposal provides: | ||
|
|
||
| - a **non-breaking**, optional extension | ||
| - better support for APIs with spatial logic | ||
| - reuse of GIS-native capabilities | ||
| - continued simplicity for basic APIs | ||
| - a unified geometry model across CAMARA when spatial search is needed | ||
|
|
||
| No changes are required in existing API definitions unless they choose to adopt GeoJSON. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.