Appearance
ConeLayer
ts
import { Map } from "maplibre-gl";
import { ThreeGISMap } from "@jodvf/three-gis-map";
import * as maplibregl from "maplibre-gl";
const container = document.createElement("div");
container.style.width = "100%";
container.style.height = "100%";
document.body.appendChild(container);
const map = new Map({
container: container,
style:
"https://api.maptiler.com/maps/b01b290f-bdf7-452e-9a34-f6e300dacc4f/style.json?key=MNqni2pVxL0GkkL0hgYb", // stylesheet location
maxPitch: 85,
center: [104.07410531052449, 30.656418650992663],
pitch: 50,
zoom: 2.5
});
window.maplibregl = maplibregl;
const joGISThree = new ThreeGISMap(map, maplibregl, {
projection: "EPSG:3857"
});
joGISThree.on("jogisthree.load", () => {
addConeLayer();
});
function addConeLayer() {
const coneLayer = joGISThree.addLayer({
type: "cone",
id: "cone-layer",
minzoom: 2,
radius: 100000,
altitude: 250000,
height: 150000
});
coneLayer.setData({
type: "FeatureCollection",
features: [
{
type: "Feature",
geometry: {
type: "Point",
coordinates: [104.08510531052449, 30.636418650992663]
},
properties: {}
},
{
type: "Feature",
geometry: {
type: "Point",
coordinates: [91.132212, 29.660361]
},
properties: {}
},
{
type: "Feature",
geometry: {
type: "Point",
coordinates: [126.55, 43.83]
},
properties: {}
}
]
});
const coneLayer1 = joGISThree.addLayer({
type: "cone",
id: "cone-layer1",
minzoom: 2,
radius: 100000,
altitude: 250000,
height: 150000,
color: "#dc6767"
});
coneLayer1.setData({
type: "FeatureCollection",
features: [
{
type: "Feature",
geometry: {
type: "Point",
coordinates: [91.132212, 29.660361]
},
properties: {}
}
]
});
const coneLayer2 = joGISThree.addLayer({
type: "cone",
id: "cone-layer2",
minzoom: 2,
radius: 100000,
altitude: 250000,
height: 150000,
color: "#72dc67"
});
coneLayer2.setData({
type: "FeatureCollection",
features: [
{
type: "Feature",
geometry: {
type: "Point",
coordinates: [126.55, 43.83]
},
properties: {}
}
]
});
}
