rationale rewrite, fix readme refs and add library supportt

This commit is contained in:
dskvr 2024-04-23 19:45:24 +02:00
parent 2a936105a4
commit 74ccfd92f7
2 changed files with 26 additions and 13 deletions

33
115.md
View File

@ -1,4 +1,4 @@
# NIP-XYZ: Yet Another Geo Tag (YAGT) # NIP-115: Yet Another Geo Tag
`draft` `optional` `draft` `optional`
@ -10,11 +10,12 @@ The core aim of this NIP is to establish a unified and efficient method for geoc
## Rationale ## Rationale
Developing a dedicated geotagging NIP offers several advantages over the general application of NIP-32 for geographical data: Developing a dedicated geotagging NIP offers several advantages over the general application of NIP-32 for geographical data:
- **Simplicity and Clarity:** Using NIP-32 for geodata can lead to verbose and complex labels, making them challenging to understand. This NIP simplifies expression. - **Full ISO-3166 support** NIP-115 is an objective, non-opinionated complete implementation of ISO-3166 that is compatible with nostr filters with no known collisions.
- **Handling ISO Standards:** The complexity added by ISO-3166-3 country code changes when using NIP-32 is streamlined in this NIP by simply labeling the channge as countryCode, thus making both publishing and filtering more straightforward. - **Lean** Value types are implicit and have a significantly smaller footprint compared to explicit value typing.
- **Intuitive** Enables shallow usage of standard without ISO-3166 domain knowledge.
- **Handles ISO-3166-3 "changes":** The complexity added by ISO-3166-3 country code changes when using NIP-32 is streamlined in this NIP by simply labeling the channge as countryCode, thus making both publishing and filtering more straightforward.
- **Significance of Geodata:** Given its ubiquity, importance and diversity, geodata warrants its own specific letter designations and detailed specifications within nostr. - **Significance of Geodata:** Given its ubiquity, importance and diversity, geodata warrants its own specific letter designations and detailed specifications within nostr.
- **Backwards compatibility** In the event a country has a code change, events from both before and after the change are discoverable - **Backwards compatibility** In the event a country has a code change, events from both before and after the change are discoverable
- **Lean** Value types are implicit and do not bloat tag size.
## Schema ## Schema
``` ```
@ -31,7 +32,7 @@ _`x` axis is ISO-3166 value type, and `y` axis is draft_
## Markers ## Markers
Standards are assigned to human readable labels instead of labeling content with standards, which complicates both publishing and filtering. Standards are assigned to human readable markers instead explicit standard-specific language, which simplifies both publishing, filtering and readability.
_See above table for draft/value type compatiblity_ _See above table for draft/value type compatiblity_
| marker | alpha-2 | alpha-3 | alpha-4 | numeric | | marker | alpha-2 | alpha-3 | alpha-4 | numeric |
|-------------|---------|---------|---------|---------| |-------------|---------|---------|---------|---------|
@ -45,10 +46,22 @@ Filter collisions have been mitigated as much as possible.
# Best Practices # Best Practices
- `alpha-2` codes take prominence, other codes **MAY** optionally be included for system compatiblity. - `alpha-2` codes take prominence, other codes **MAY** optionally be included for system compatiblity.
- When publishing, if a country has an `ISO-3166-3` "change", `IO-3166-3:alpha-4` **SHOULD** be included (hint for parsing case) - When publishing, if a country has an `ISO-3166-3` "change", `ISO-3166-3:alpha-4` **SHOULD** be included (hint for parsing case)
- When publishing, if a country has an `ISO-3166-3` "change", the `ISO-3166-1` **SHOULD NOT** be included - When publishing, if a country has an `ISO-3166-3` "change", the `ISO-3166-1` **SHOULD NOT** be included
- When filtering, if a country has an `ISO-3166-3` "change", both the `ISO-3166-1` and `ISO-3166-3` code(s) **SHOULD** be included for most complete results. - When filtering, if a country has an `ISO-3166-3` "change", both the `ISO-3166-1` and `ISO-3166-3` code(s) **SHOULD** be included for most complete results.
# ISO-3166 Library Support
_Many languages have multiple library options, only a single one is linked for each language_
| | drafts | alpha-2 | alpha-3 | alpha-4 | numeric |
|--------------------------------------------------------------------|--------|---------|---------|------------|---------|
| [JS/TS](https://www.npmjs.com/package/iso-3166) | 1/2/3 | ✓ | ✓ | composable | ✓ |
| [GO](https://github.com/biter777/countries) | 1/2/3 | ✓ | ✓ | composable | ✓ |
| [Rust](https://github.com/rust-iso/rust_iso3166) | 1/2/3 | ✓ | ✓ | composable | ✓ |
| [Swift](https://github.com/funky-monkey/IsoCountryCodes) | 1 | ✓ | ✓ | composable | ✓ |
| [Java](https://github.com/TakahikoKawasaki/CountryCode) | 1 | ✓ | ✓ | composable | ✓ |
| [Clojure](https://github.com/totakke/clj-iso3166) | 1 | ✓ | ✓ | composable | ✓ |
| [Ruby](https://github.com/countries/countries/) | 1 | ✓ | ✓ | composable | ✓ |
## Examples ## Examples
### Minimal Example ### Minimal Example
@ -67,10 +80,10 @@ _Note: Antiquated ISO-3166-1 codes are included for example purposes_
[ [
[ "G", "AI", "countryCode" ], //ISO-3166-1 alpha-2 [ "G", "AI", "countryCode" ], //ISO-3166-1 alpha-2
[ "G", "AIA", "countryCode" ], //ISO-3166-1 alpha-3 [ "G", "AIA", "countryCode" ], //ISO-3166-1 alpha-3
[ "G", "262", "countryCode" ], //ISO-3166-1 numeric [ "G", "262", "countryCode" ], //ISO-3166-1 numeric
[ "G", "DJ", "countryCode" ], //ISO-3166-3 alpha-2 "change" [ "G", "DJ", "countryCode" ], //ISO-3166-3 alpha-2 "change"
[ "G", "DJI", "countryCode" ], //ISO-3166-3 alpha-3 "change" [ "G", "DJI", "countryCode" ], //ISO-3166-3 alpha-3 "change"
[ "G", "AIDJ", "countryCode" ], //ISO-3166-3 alpha-4 "change [ "G", "AIDJ", "countryCode" ], //ISO-3166-3 alpha-4 change hint
[ "G", "AI", "regionCode" ], //ISO-3166-2 regionCode alpha-2 (subdivision) [ "G", "AI", "regionCode" ], //ISO-3166-2 regionCode alpha-2 (subdivision)
[ "G", "019", "regionCode" ], //ISO-3166-2 regionCode numeric (subdivision) [ "G", "019", "regionCode" ], //ISO-3166-2 regionCode numeric (subdivision)
[ "G", "419", "subRegionCode" ], //ISO-3166-2 subRegionCode numeric (subdivision) [ "G", "419", "subRegionCode" ], //ISO-3166-2 subRegionCode numeric (subdivision)
@ -80,8 +93,8 @@ _Note: Antiquated ISO-3166-1 codes are included for example purposes_
``` ```
### Filter ### Filter
_Effective for events where **countryCode** `G` is either `AI` or `DJ`_ _Effective for events where **countryCode** `G` is either `AI` (antiquated `ISO-3166-1`) or `DJ` (`ISO-3166-3` change)_
``` ```
{ "#G": ["AI", "AIDJ"] } { "#G": ["AI", "DJ"] }
``` ```

View File

@ -214,14 +214,14 @@ Please update these lists when proposing NIPs introducing new event kinds.
| `p` | pubkey (hex) | relay URL, petname | [01](01.md), [02](02.md) | | `p` | pubkey (hex) | relay URL, petname | [01](01.md), [02](02.md) |
| `a` | coordinates to an event | relay URL | [01](01.md) | | `a` | coordinates to an event | relay URL | [01](01.md) |
| `d` | identifier | -- | [01](01.md) | | `d` | identifier | -- | [01](01.md) |
| `g` | geotags: geohash, ISO-3166 | -- | [52](52.md), [115](115.md) | | `g` | geohash | -- | [52](52.md) |
| `G` | geotag namespace | -- | [115](115.md) | | `G` | ISO-3166 (alpha-2/3/4, numeric) | -- | [115](115.md) |
| `i` | identity | proof | [39](39.md) | | `i` | identity | proof | [39](39.md) |
| `k` | kind number (string) | -- | [18](18.md), [25](25.md), [72](72.md) | | `k` | kind number (string) | -- | [18](18.md), [25](25.md), [72](72.md) |
| `l` | label, label namespace | annotations | [32](32.md) | | `l` | label, label namespace | annotations | [32](32.md) |
| `L` | label namespace | -- | [32](32.md) | | `L` | label namespace | -- | [32](32.md) |
| `m` | MIME type | -- | [94](94.md) | | `m` | MIME type | -- | [94](94.md) |
| `q` | event id (hex) | relay URL | [18](18.md) | | `q` | event id (hex) | relay URL | [18](18.md) |
| `r` | a reference (URL, etc) | petname | | | `r` | a reference (URL, etc) | petname | |
| `r` | relay url | marker | [65](65.md) | | `r` | relay url | marker | [65](65.md) |
| `t` | hashtag | -- | | | `t` | hashtag | -- | |