3.2. Layers. Raster

March 20, 2024 ยท View on GitHub

Theory

There are several ways to add GeoJSON to the map in NgwMap

Common:

  ngwMap.addLayer("TILE", {
    url:
      baseUrl + "/api/component/render/tile?z={z}&x={x}&y={y}&resource=" + 7149,
    attribution: `<a href=${
      baseUrl + "/resource/7141"
    } target="_blank">7142</a>`,
  });

Shortcut way:

  ngwMap.addTileLayer(
    baseUrl + "/api/component/render/tile?x={x}&y={y}&z={z}&resource=" + 7149
  );

All options are documented here.

The behavior of the layer and the ways of interacting with it are identical to the one in the example 3_1_layers_geojson.

Practice

To run this example, you need to execute these commands in the terminal:

npm i
npm start

Open http://localhost:8080.

LAUNCH in the codesandbox.io.

BACK TO CONTENT