{"id":18507838,"url":"https://github.com/espadrine/spash","last_synced_at":"2025-04-09T03:31:34.033Z","repository":{"id":57367004,"uuid":"62331752","full_name":"espadrine/spash","owner":"espadrine","description":"Universal spacetime locator. Map every location in the observable universe to a string.","archived":false,"fork":false,"pushed_at":"2018-02-26T09:50:41.000Z","size":23,"stargazers_count":11,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T22:37:59.721Z","etag":null,"topics":["altitude","geolocation","hash","latitude","longitude","spacetime"],"latest_commit_sha":null,"homepage":"https://espadrine.github.io/spash/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/espadrine.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-30T17:58:10.000Z","updated_at":"2021-07-20T21:43:17.000Z","dependencies_parsed_at":"2022-08-23T20:11:06.184Z","dependency_job_id":null,"html_url":"https://github.com/espadrine/spash","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espadrine%2Fspash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espadrine%2Fspash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espadrine%2Fspash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/espadrine%2Fspash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/espadrine","download_url":"https://codeload.github.com/espadrine/spash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247973637,"owners_count":21026705,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["altitude","geolocation","hash","latitude","longitude","spacetime"],"created_at":"2024-11-06T15:12:34.402Z","updated_at":"2025-04-09T03:31:33.754Z","avatar_url":"https://github.com/espadrine.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Spash: Spacetime Hash\n\nMaps every location in the observable universe to a string of the form:\n\n    \u003cOrigin\u003e.\u003cHash\u003e[.\u003cTimeHash\u003e]\n\n(Example: `E.6BLH4goVfxs.oL9-D4`.)\n\n- Origin: IAU designation of a celestial object, percent-encoded as per reg-name\n  syntax in [RFC 3986][]; eg. `E` for Earth.\n- Hash: encoding of latitude, longitude, and distance to the radius of the\n  celestial object. With 12 characters, you can encode the precise position of a\n  single human in the ISS. With 11, the position of a room anywhere in the\n  world.\n- TimeHash: encoding of a [TCG][]-backed timestamp: the number of seconds since\n  the Unix Epoch at the centre of the celestial object if that object was not\n  there to cause gravitational time dilation. With 6 characters, you get\n  secondwise precision. It is optional.\n\n[RFC 3986]: https://tools.ietf.org/html/rfc3986\n[TCG]: https://en.wikipedia.org/wiki/Geocentric_Coordinate_Time\n\nThe hash is an unpadded [base64url][] string. Each character encodes 6 bits. Two of\nthem contribute to longitude, two to latitude, two to altitude. They alternate\nin this order, similar to [Geohash][]: one longitude bit, one latitude bit, one\naltitude bit, one longitude bit, and so on.\n\n[base64url]: https://tools.ietf.org/html/rfc4648\n\n# Geographic coordinates\n\nExtract separately the longitude bits and the latitude bits into two lists.\nThe range of the latitude goes from -90° (South Pole) to 90°. Longitude goes\nfrom -180° to 180°, with 0° at the [Prime Meridian][] and increasing eastward.\n\n[Prime Meridian]: https://en.wikipedia.org/wiki/Prime_Meridian\n\nEach bit determines whether the intended value is above / on (1) or below (0)\nthe previously defined range, starting with the full range. For instance, a\nstarting bit of 1 means that the longitude is between 0° and 180°. That includes\nmost of Europe, Africa, Asia and Oceania, but excludes America. If the fourth\nbit is 0, the longitude is between 0° and 90°.\n\n# Altitude\n\nExtract the altitude bits into its own list. It encodes an adjustment compared\nto the radius of the celestial object. For Earth, that radius is sea level, and\nthat adjustment is the altitude.\n\nThe minimum altitude is minus infinity, and the maximum altitude is infinity.\nThat allows encoding any altitude with arbitrary precision. An altitude lower\nthan the negative of the radius is treated to correspond to the center of the\ncelestial object.\n\nLet's introduce the following function, which maps values from -1 to 1 to real\nvalues.\n\n              ⎧ x / (x + 1)   if x \u003c 0\n    asig(x) = ⎨\n              ⎩ -x / (x - 1)  otherwise\n\nSimilarly to what happens with latitude and longitude information, each bit\ndetermines whether the intended value is above / on (1) or below (0) the\npreviously defined range, starting with a range from -1 to 1. The error range\nfor the altitude goes from `asig(lower bound)` to `asig(upper bound)`, in\nkilometers.\n\nThe center point of the spash should be defined as the point at the center of\nthe error ranges of the latitude, longitude and altitude that were decoded.\n\n# TimeHash\n\nExtract the time bits. It encodes an adjustment compared\nto the Unix Epoch ([ISO 8601][] `1970-01-01T00:00:00Z`) in seconds at the\ncenter of the celestial object, assuming the tracking of time is unaffected by\ngravitational time dilation.\n\n[ISO 8601]: https://en.wikipedia.org/wiki/ISO_8601\n\nThe minimum time is minus infinity, and the maximum time is infinity.\nThat allows encoding any time with arbitrary precision.\n\nSimilarly to what happens with latitude and longitude information, each bit\ndetermines whether the intended value is above / on (1) or below (0) the\npreviously defined range, starting with a range from -1 to 1. The error range\nfor the altitude goes from `asig(lower bound)` to `asig(upper bound)`, in\nTimeHashPeriod, a new unit defined as 0xffffffff (4294967295) seconds (which is\nroughly 136 years).\n\nThe center point of the TimeHash should be defined as the point at the center of\nthe error range of the time that was decoded.\n\n# Pros and Cons\n\nGeohash alone cannot distinguish between levels in a building, or between an\nunderground tunnel and the road above it, or between the ISS and whichever\nlocation it is hovering above. A spash can. It can easily separate rooms in a\nbuilding. Note however that most mobile phones have a precision of tens of\nmeters; unless your device has a precision on the order of the meter, you won't\nbe able to produce or identify a room from a spash. It would still identify the\ndifference between a mountain tunnel and the ground, or between rough areas of a\nskyscraper.\n\nSpashes allow arbitrary precision. On the flip side, a given spash can describe\na location too precisely: there can be multiple valid spashes for the same\nlocation. When choosing a spash for your location, make it precise enough that\nyour target location is unambiguous from standing at the center point of the\nspash.\n\nA spash's substring describes a less precise location of the same position. That\nmeans that spashes with a common substring are close: they have an upper bound\nto their distance. However, two extremely distinct spashes can specify locations\nthat are extremely close, especially at the poles and way up in space.\n\nIdeally, we would want the error volume associated with a spash to be a ball.\nHowever, it is more like a curved box. However, this design gave good\napproximations and maintains simplicity.\n\n# Use-cases\n\n- Universal distributed locator for physical places.\n- Travel industry: this locator can be used to specify any station in the\n  universe, regardless of type, without needing a central authority to name\n  them. Any system for finding a station will simply take the one that is\n  closest to the queried station.\n- Locators for arbitrary, cross-building or cross-city meeting points. The old\n  way of specifying the address and the room number is not as convenient as\n  decoding the bits of a spash with a [RFC 2289][]-like 4096 word list,\n  producing 6 short words for every room. Besides, if you forgot the last word,\n  you will still end up close by.\n- Compact transmission of aircraft, rocket or space station location.\n\n[RFC 2289]: http://tools.ietf.org/html/rfc2289\n\n# Contribute\n\nImplement it in your own language. Send me a tweet to your code [@espadrine][].\n\n[@espadrine]: https://twitter.com/espadrine\n\nHere is a list of known implementations:\n\n- [npm spash](https://www.npmjs.com/package/spash)\n\n---\n\nInspired by [Geohash][].\n\nLicense: [CC0][].\n\n[Geohash]: http://geohash.org\n[CC0]: https://creativecommons.org/publicdomain/zero/1.0/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fespadrine%2Fspash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fespadrine%2Fspash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fespadrine%2Fspash/lists"}