New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

hslayers-cesium

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hslayers-cesium

HSLayers-NG 3D mapping library

latest
Source
npmnpm
Version
16.4.0
Version published
Maintainers
3
Created
Source

Hslayers-cesium

This library contains components to run HSLayers-NG user interface with Cesium 3D as the map renderer instead of, or in complement to, OpenLayers. See example

Installation

npm i hslayers-cesium

Usage

Import HsCesiumModule and add it to your AppModules imports:

import {HsCesiumModule} from 'hslayers-cesium';

@NgModule({
  declarations: [AppComponent],
  imports: [BrowserModule, HslayersModule, HsCesiumModule],

In your component attach the HslayersCesiumComponent to HSlayers-NG:

 constructor(
    public hsCesiumConfig: HsCesiumConfig,
    private hsLayoutService: HsLayoutService
  ) {
    ...  
ngOnInit(): void {
    this.hsLayoutService.mapSpaceRef.subscribe((mapSpace) => {
      if (mapSpace?.viewContainerRef) {
        mapSpace.viewContainerRef.createComponent(HslayersCesiumComponent);
      }
    });
  }

Set path to cesium assets in hsCesiumConfig:

    this.hsCesiumConfig.update({
      cesiumBase: 'assets/cesium/',

In your angular.json file copy cesium assets to the previously mentioned directory (See example):

 "assets": [
              {
                "glob": "**/*",
                "input": "./node_modules/hslayers-ng/assets",
                "output": "./assets/hslayers-ng/"
              },    
              {
                "glob": "**/*",
                "input": "./node_modules/cesium/Source/Assets",
                "output": "./assets/cesium/Assets"
              },
              {
                "glob": "**/*",
                "input": "./node_modules/cesium/Source/Widgets",
                "output": "./assets/cesium/Widgets"
              },
              {
                "glob": "**/*",
                "input": "./node_modules/cesium/Source/Workers",
                "output": "./assets/cesium/Workers"
              }
            ],
            "styles": [
              "node_modules/ol/ol.css",
              "node_modules/cesium/Build/Cesium/Widgets/widgets.css"
            ],

Use custom-webpack builder which is needed for Cesium

In angular.json

  "architect": {
        "build": {
          "builder": "@angular-builders/custom-webpack:browser",
          "options": {
            "customWebpackConfig": {
              "path": "custom-webpack.config.js"
            }
        ...
        "serve": {
          "builder": "@angular-builders/custom-webpack:dev-server",    

custom-webpack.config.js contents:

module.exports = {
  node: {
    // Resolve node module use of fs
    fs: 'empty',
    Buffer: false,
    http: 'empty',
    https: 'empty',
    zlib: 'empty',
  },
  module: {
    unknownContextCritical: false,
  },
};

Keywords

hslayers

FAQs

Package last updated on 23 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts