Permalink panel - hslayers/hslayers-ng GitHub Wiki

Share map

The sharing panel allows the user to share the map as a simple image, obtained by copying the map view, or as an permalink, preserving the layers and structure of the map composition, allowing another user to further process the map. Sharing is also instantly available on a variety of social networks, such as Twitter, Skype, Facebook, and more.

Share map (permalink) panel

Config parameters

List of useful config parameters for the permalink panel can be found here:

default_layers

permalinkLocation

permalinkLocation.origin

permalinkLocation.pathname

project_name

social_hashtag

Enable/disable

import {HsConfig} from 'hslayers-ng/config';
@Component({
  selector: 'your-app-component',
  templateUrl: 'your-app-component.html',
})
export class YourAppComponent {
  constructor(hsConfig: HsConfig) {
    this.HsConfig.update({
      panelsEnabled: {
        permalink: true //(true by default)
      }
    });
  }
}

If not using HslayersModule containing all components

Add HsShareModule import:

import {HsShareModule} from 'hslayers-ng/components/share';
@NgModule({
  imports: [HsShareModule],
})
export class YourAppModule {}

Add HsShareComponent component:

import {HsShareModule} from 'hslayers-ng/components/share';
import {HsLayoutService } from 'hslayers-ng/core';
@Component({
  selector: 'your-app-component',
  templateUrl: 'your-app-component.html',
})
export class YourAppComponent {
  constructor(hsLayoutService: HsLayoutService) {
    hsLayoutService.createPanel(HsShareComponent, {});
  }
}