← Back to Main

Share Function Demo

This page demonstrates the share functionality using URL parameters with data-shared present on the map div.

How It Works:
  • Configuration Merging: The map uses the base configuration defined in data-config OR data-config-url on the map div. URL parameters selectively update specific properties without replacing the entire config.
  • Share Button: The Share button appears automatically because data-shared attribute is present on the map div.
  • URL Parameters: When applying a share URL, the following properties are updated:
    • p - Projection (e.g., 3857, 3978)
    • z - Zoom level
    • c - Center coordinates (lon,lat in EPSG:4326)
    • b - Basemap options (basemapId, shaded, labeled)
    • keys - Layer UUIDs to add (comma-separated)
  • Layer Behavior: Layers from URL parameters (keys) are appended to existing layers defined in data-config OR data-config-url. Base config layers are preserved, not replaced.
  • Example: If the base config has layer A, and the URL has keys=B,C, the final map will display layers A, B, and C.
Static Demo Share URL
Clipboard Share URL