parseUrlHash
Reads the shareable state from a location hash such as
#map=12.35/-26.20410/28.04730/90&basemap=osm-liberty.
This is a function exported by @mapcairn/core, checked against version 0.2.0.
Signature
import { parseUrlHash } from "@mapcairn/core";
function parseUrlHash(hash: string): UrlStateValue;
Parameters
hash(string)
Returns
UrlStateValue
Remarks
Tolerant by design, because hashes are typed, pasted and edited.
Each part is checked on its own and dropped when unusable: the view needs
a zoom of 0 to 24, a latitude within 90 and a longitude within 180 (the
bearing is optional and wrapped into [0, 360)); a basemap id may only use
lowercase letters, digits and hyphens. Unknown parameters are ignored and
the first occurrence of a parameter wins. The leading # is optional.