@geolonia/maps-core 0.7.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -159,6 +159,9 @@ const map = new GeoloniaMap({
159
159
  geojson: 'https://example.com/data.geojson',
160
160
  cluster: true,
161
161
  clusterColor: '#ff0000',
162
+ choropleth: 'value', // Color polygons by a property (see below)
163
+ heatmap: 'weight', // Draw points as a heatmap (see below)
164
+ circle: { size: 'weight', color: 'category' }, // Size and color points (see below)
162
165
  simpleVector: 'my-tileset', // Vector tile URL or tileset ID
163
166
  '3d': false,
164
167
  errorMessage: undefined, // Message shown when the map fails to initialize
@@ -183,6 +186,34 @@ new GeoloniaMap({ container: '#map', errorMessage: 'Sorry, the map is unavailabl
183
186
  new GeoloniaMap({ container: '#map', errorMessage: false });
184
187
  ```
185
188
 
189
+ #### `choropleth`, `heatmap` and `circle`
190
+
191
+ Style the `geojson` data by the values of its properties, without writing MapLibre expressions.
192
+
193
+ ```typescript
194
+ // Color polygons by `value`. The range defaults to the min and max of the data.
195
+ new GeoloniaMap({ container: '#map', geojson, choropleth: 'value' });
196
+ new GeoloniaMap({
197
+ container: '#map',
198
+ geojson,
199
+ choropleth: { property: 'value', colors: ['#FFF2CC', '#B3261E'], range: [0, 100] },
200
+ });
201
+
202
+ // Draw points as a heatmap. `true` weights every point equally.
203
+ new GeoloniaMap({ container: '#map', geojson, heatmap: 'weight' });
204
+
205
+ // Size points by `weight` and color them by `category`.
206
+ // Numeric values get a color ramp, other values one color per category.
207
+ new GeoloniaMap({ container: '#map', geojson, circle: { size: 'weight', color: 'category' } });
208
+ ```
209
+
210
+ - These options take precedence over simplestyle properties such as `fill` and `marker-color`. Features without a numeric value fall back to the simplestyle look.
211
+ - `heatmap` and `circle` turn clustering off. `heatmap` also hides the point markers. `circle` draws every point as a circle, including points with `marker-symbol`, and hides the icons and titles.
212
+ - The range and categories are computed again when the GeoJSON is loaded from a URL or replaced with `updateData()`.
213
+ - `colors` is optional. The defaults are Geolonia's orange ramp and a categorical palette.
214
+ - With `choropleth`, polygons without a `fill-opacity` property are drawn at 0.7 opacity instead of 1, so that the base map shows through.
215
+ - With `circle.color`, a property is treated as numeric only when every value is a number. Numeric strings such as `"12"` count as categories. Objects and arrays are not colored.
216
+
186
217
  #### `transformRequest`
187
218
 
188
219
  Works like MapLibre's `transformRequest`, and is also called for the requests that maps-core rewrites itself: Geolonia sources (`api.geolonia.com` and the Geolonia tile hosts) and Geolonia sprites. For those, the function receives the URL after maps-core has added `key` and `sessionId`, so the parameters are kept as long as you build on the URL you are given.
@@ -226,6 +257,7 @@ GeoJSON visualization based on [simplestyle-spec](https://github.com/mapbox/simp
226
257
  import { SimpleStyle } from '@geolonia/maps-core';
227
258
 
228
259
  const ss = new SimpleStyle(geojson, { cluster: true });
260
+ // Also accepts `choropleth`, `heatmap` and `circle` (see GeoloniaMap options)
229
261
  ss.addTo(map).fitBounds();
230
262
  ```
231
263
 
@@ -253,6 +285,7 @@ keyring.setStage('v1');
253
285
  npm install
254
286
  npm run build # ESM + DTS
255
287
  npm run test # Vitest unit tests
288
+ npm run build:umd # UMD bundle (dist/umd/), required by e2e/umd.spec.ts
256
289
  npm run e2e # Playwright E2E tests
257
290
  npm run lint # Biome
258
291
  npm run dev # Vite dev server (example/)
@@ -217,6 +217,7 @@ type GeoloniaMapOptions = MapOptions & {
217
217
  /**
218
218
  * ズームと回転のコントロール。`true` / `false`、または表示位置
219
219
  * (`'top-right'`、`'bottom-left'` など)を指定する。
220
+ * コンパスは地図の傾きも表し、クリックすると向きと傾きの両方を戻す。
220
221
  * @defaultValue `true`
221
222
  */
222
223
  navigationControl?: boolean | ControlPosition;
@@ -255,6 +256,25 @@ type GeoloniaMapOptions = MapOptions & {
255
256
  * @defaultValue `'#ff0000'`
256
257
  */
257
258
  clusterColor?: string;
259
+ /**
260
+ * `geojson` のポリゴンを、プロパティの値で塗り分ける(コロプレス)。
261
+ * プロパティ名の文字列、または {@link ChoroplethOptions} を指定する。
262
+ * 地物の simplestyle の `fill` より優先する。地物に `fill-opacity` がないときの不透明度は、
263
+ * 背景の地図が透けるよう 1 ではなく 0.7 にする。
264
+ */
265
+ choropleth?: string | ChoroplethOptions;
266
+ /**
267
+ * `geojson` のポイントをヒートマップで描く。`true` で重みなし、
268
+ * プロパティ名の文字列でその値を重みにする。{@link HeatmapOptions} も指定できる。
269
+ * 指定するとクラスタリングとポイントのマーカーは表示しない。
270
+ */
271
+ heatmap?: boolean | string | HeatmapOptions;
272
+ /**
273
+ * `geojson` のポイントの円の大きさと色を、プロパティの値で変える。
274
+ * 指定するとクラスタリングは行わず、`marker-symbol` を持つポイントも円で描く(アイコンとタイトルは表示しない)。
275
+ * 地物の simplestyle の `marker-color` より優先する。
276
+ */
277
+ circle?: CircleOptions;
258
278
  /** SimpleStyle Vector で表示するベクトルタイルの URL または論理名。 */
259
279
  simpleVector?: string;
260
280
  /**
@@ -270,6 +290,47 @@ type GeoloniaMapOptions = MapOptions & {
270
290
  */
271
291
  errorMessage?: string | false;
272
292
  };
293
+ /**
294
+ * {@link GeoloniaMapOptions.choropleth} の詳細な指定。
295
+ */
296
+ type ChoroplethOptions = {
297
+ /** 塗り分けに使うプロパティ名。値が数値の地物だけを塗り分ける。 */
298
+ property: string;
299
+ /**
300
+ * 値の小さい側から大きい側へ並べた色。値の範囲に等間隔で割り当て、間は補間する。
301
+ * @defaultValue `['#FFF2CC', '#FFAB40', '#EA5C0D', '#B3261E']`
302
+ */
303
+ colors?: string[];
304
+ /** 色を割り当てる値の範囲 `[最小, 最大]`。省略するとデータの最小値と最大値を使う。 */
305
+ range?: [number, number];
306
+ };
307
+ /**
308
+ * {@link GeoloniaMapOptions.heatmap} の詳細な指定。
309
+ */
310
+ type HeatmapOptions = {
311
+ /** 重みに使うプロパティ名。データの最小値を 0、最大値を 1 として扱う。省略するとすべて同じ重み。 */
312
+ weight?: string;
313
+ /**
314
+ * 密度の低い側から高い側へ並べた色。密度 0 は透明になる。
315
+ * @defaultValue `['#FABF3D', '#FFAB40', '#EA5C0D', '#B3261E']`
316
+ */
317
+ colors?: string[];
318
+ };
319
+ /**
320
+ * {@link GeoloniaMapOptions.circle} の指定。
321
+ */
322
+ type CircleOptions = {
323
+ /** 円の大きさに使うプロパティ名。データの範囲を半径 3 から 11 ピクセルに対応させる。 */
324
+ size?: string;
325
+ /**
326
+ * 円の色に使うプロパティ名。値がすべて数値なら連続した色に、
327
+ * そうでなければ値ごとに別の色にする。`"12"` のような数字の文字列もカテゴリとして扱う。
328
+ * オブジェクトや配列の値は色分けしない。
329
+ */
330
+ color?: string;
331
+ /** `color` に使う色。数値なら小さい側から大きい側へ、カテゴリなら出現順に割り当てる。 */
332
+ colors?: string[];
333
+ };
273
334
 
274
335
  type GetImageCallback = (error?: Error | null, image?: HTMLImageElement | ImageBitmap | null, expiry?: ExpiryData | null) => void;
275
336
  /**
@@ -660,6 +721,7 @@ declare class SimpleStyle {
660
721
  private geojson;
661
722
  private map;
662
723
  private options;
724
+ private heatmap;
663
725
  private _eventHandlers;
664
726
  /**
665
727
  * SimpleStyle を作成します。
@@ -741,9 +803,26 @@ declare class SimpleStyle {
741
803
  * `marker-size`(`small`、`large`、その他)に応じて円の半径やラベルのオフセットを変え、
742
804
  * `marker-color`、`stroke`、`title`、`text-color` などの simplestyle プロパティを反映します。
743
805
  * あわせて円レイヤーとシンボルレイヤーの双方に {@link SimpleStyle.setPopup | setPopup} でポップアップを設定します。
806
+ * `circle` オプションを指定したときは、`marker-symbol` の有無にかかわらずすべてのポイントを円で描き、
807
+ * シンボルレイヤーは追加しません。
744
808
  * 通常は {@link SimpleStyle.addTo | addTo} から呼び出されます。
745
809
  */
746
810
  setPointGeometries(): void;
811
+ /**
812
+ * ポイントのヒートマップレイヤーを設定します。
813
+ *
814
+ * `heatmap` オプションを指定したときに、ポイントのマーカーとクラスターの代わりに使います。
815
+ * 重みは {@link SimpleStyle.applyDataDrivenPaint | applyDataDrivenPaint} がデータに合わせて設定します。
816
+ * 通常は {@link SimpleStyle.addTo | addTo} から呼び出されます。
817
+ */
818
+ setHeatmap(): void;
819
+ /**
820
+ * `choropleth`、`heatmap`、`circle` オプションの式を、現在のデータに合わせて設定します。
821
+ *
822
+ * 値の範囲やカテゴリはデータから求めるため、{@link SimpleStyle.addTo | addTo} と
823
+ * {@link SimpleStyle.updateData | updateData} のたびに呼び出します。
824
+ */
825
+ applyDataDrivenPaint(): void;
747
826
  /**
748
827
  * 指定したレイヤーにクリックでポップアップを表示するイベントハンドラーを設定します。
749
828
  *
@@ -890,4 +969,5 @@ declare class SimpleStyleVector {
890
969
 
891
970
  declare const VERSION: string;
892
971
 
893
- export { CustomAttributionControl, DEFAULT_STAGE, GeoloniaControl, GeoloniaMap, type GeoloniaMapOptions, GeoloniaMarker, SimpleStyle, SimpleStyleVector, VERSION as coreVersion, getLang, getStyle, isGeoloniaTilesHost, keyring };
972
+ export { CustomAttributionControl, DEFAULT_STAGE, GeoloniaControl, GeoloniaMap, GeoloniaMarker, SimpleStyle, SimpleStyleVector, VERSION as coreVersion, getLang, getStyle, isGeoloniaTilesHost, keyring };
973
+ export type { ChoroplethOptions, CircleOptions, GeoloniaMapOptions, HeatmapOptions };
package/dist/npm/index.js CHANGED
@@ -538,6 +538,134 @@ import bbox from "@turf/bbox";
538
538
  import turfCenter from "@turf/center";
539
539
  import * as maplibregl3 from "maplibre-gl";
540
540
 
541
+ // src/lib/data-driven.ts
542
+ var SEQUENTIAL_COLORS = ["#FFF2CC", "#FFAB40", "#EA5C0D", "#B3261E"];
543
+ var HEATMAP_COLORS = ["#FABF3D", "#FFAB40", "#EA5C0D", "#B3261E"];
544
+ var CATEGORICAL_COLORS = [
545
+ "#EA5C0D",
546
+ "#2B6CB0",
547
+ "#FABF3D",
548
+ "#5B8C2A",
549
+ "#9A5B1E",
550
+ "#7A4FA0",
551
+ "#E8402F",
552
+ "#6B7280"
553
+ ];
554
+ var CIRCLE_RADIUS_RANGE = [3, 11];
555
+ function colorsOr(colors, defaults) {
556
+ return colors?.length ? colors : defaults;
557
+ }
558
+ function normalizeChoropleth(option) {
559
+ if (!option) return void 0;
560
+ return typeof option === "string" ? { property: option } : option;
561
+ }
562
+ function normalizeHeatmap(option) {
563
+ if (!option) return void 0;
564
+ if (option === true) return {};
565
+ return typeof option === "string" ? { weight: option } : option;
566
+ }
567
+ function numericRange(features, property) {
568
+ let min = Number.POSITIVE_INFINITY;
569
+ let max = Number.NEGATIVE_INFINITY;
570
+ for (const f of features) {
571
+ const v = f.properties?.[property];
572
+ if (typeof v !== "number" || !Number.isFinite(v)) continue;
573
+ if (v < min) min = v;
574
+ if (v > max) max = v;
575
+ }
576
+ return min <= max ? [min, max] : void 0;
577
+ }
578
+ function interpolate(property, range, outputs) {
579
+ const [min, max] = range;
580
+ if (!(min < max) || outputs.length < 2) return outputs[outputs.length - 1];
581
+ const stops = outputs.flatMap((out, i) => [
582
+ min + (max - min) * i / (outputs.length - 1),
583
+ out
584
+ ]);
585
+ return [
586
+ "interpolate",
587
+ ["linear"],
588
+ ["get", property],
589
+ ...stops
590
+ ];
591
+ }
592
+ function whenNumber(property, expr, fallback) {
593
+ return [
594
+ "case",
595
+ ["==", ["typeof", ["get", property]], "number"],
596
+ expr,
597
+ fallback
598
+ ];
599
+ }
600
+ function sequentialColor(property, features, colors, fallback, range) {
601
+ const r = range ?? numericRange(features, property);
602
+ if (!r) return fallback;
603
+ return whenNumber(property, interpolate(property, r, colors), fallback);
604
+ }
605
+ function choroplethColor(option, features, fallback) {
606
+ return sequentialColor(
607
+ option.property,
608
+ features,
609
+ colorsOr(option.colors, SEQUENTIAL_COLORS),
610
+ fallback,
611
+ option.range
612
+ );
613
+ }
614
+ function heatmapWeight(option, features) {
615
+ if (!option.weight) return 1;
616
+ const range = numericRange(features, option.weight);
617
+ if (!range || !(range[0] < range[1])) return 1;
618
+ return whenNumber(
619
+ option.weight,
620
+ interpolate(option.weight, range, [0, 1]),
621
+ 0
622
+ );
623
+ }
624
+ function heatmapColor(option) {
625
+ const colors = colorsOr(option.colors, HEATMAP_COLORS);
626
+ const stops = colors.flatMap((c, i) => [(i + 1) / colors.length, c]);
627
+ return [
628
+ "interpolate",
629
+ ["linear"],
630
+ ["heatmap-density"],
631
+ 0,
632
+ "rgba(0, 0, 0, 0)",
633
+ ...stops
634
+ ];
635
+ }
636
+ function circleRadius(option, features, fallback) {
637
+ if (!option.size) return fallback;
638
+ const range = numericRange(features, option.size);
639
+ if (!range) return fallback;
640
+ return whenNumber(
641
+ option.size,
642
+ interpolate(option.size, range, CIRCLE_RADIUS_RANGE),
643
+ fallback
644
+ );
645
+ }
646
+ function circleColor(option, features, fallback) {
647
+ const property = option.color;
648
+ if (!property) return fallback;
649
+ const values = features.map((f) => f.properties?.[property]).filter((v) => ["string", "number", "boolean"].includes(typeof v));
650
+ if (values.length === 0) return fallback;
651
+ if (values.every((v) => typeof v === "number")) {
652
+ return sequentialColor(
653
+ property,
654
+ features,
655
+ colorsOr(option.colors, SEQUENTIAL_COLORS),
656
+ fallback
657
+ );
658
+ }
659
+ const colors = colorsOr(option.colors, CATEGORICAL_COLORS);
660
+ const categories = [...new Set(values.map(String))];
661
+ return [
662
+ "match",
663
+ ["to-string", ["get", property]],
664
+ ...categories.flatMap((c, i) => [c, colors[i % colors.length]]),
665
+ fallback
666
+ ];
667
+ }
668
+
541
669
  // src/lib/keyring.ts
542
670
  var DEFAULT_STAGE = "v1";
543
671
  var _apiKey, _stage, _isGeoloniaStyle;
@@ -823,6 +951,24 @@ var textColor = "#000000";
823
951
  var textHaloColor = "#FFFFFF";
824
952
  var backgroundColor = "rgba(255, 0, 0, 0.4)";
825
953
  var strokeColor = "#FFFFFF";
954
+ var polygonFillColor = [
955
+ "string",
956
+ ["get", "fill"],
957
+ backgroundColor
958
+ ];
959
+ var pointRadius = [
960
+ "case",
961
+ ["==", "small", ["get", "marker-size"]],
962
+ 7,
963
+ ["==", "large", ["get", "marker-size"]],
964
+ 13,
965
+ 9
966
+ ];
967
+ var pointColor = [
968
+ "string",
969
+ ["get", "marker-color"],
970
+ backgroundColor
971
+ ];
826
972
  var template = {
827
973
  type: "FeatureCollection",
828
974
  features: []
@@ -846,10 +992,10 @@ var SimpleStyle = class {
846
992
  id: "geolonia-simple-style",
847
993
  cluster: true,
848
994
  heatmap: false,
849
- // TODO: It should support heatmap.
850
995
  clusterColor: "#ff0000",
851
996
  ...options
852
997
  };
998
+ this.heatmap = normalizeHeatmap(this.options.heatmap);
853
999
  }
854
1000
  /**
855
1001
  * 表示中のデータを新しい GeoJSON で差し替えます。
@@ -880,6 +1026,7 @@ var SimpleStyle = class {
880
1026
  features: points
881
1027
  }
882
1028
  );
1029
+ this.applyDataDrivenPaint();
883
1030
  return this;
884
1031
  }
885
1032
  /**
@@ -924,7 +1071,7 @@ var SimpleStyle = class {
924
1071
  type: "FeatureCollection",
925
1072
  features: points
926
1073
  },
927
- cluster: this.options.cluster,
1074
+ cluster: this.options.cluster && !this.heatmap && !this.options.circle,
928
1075
  clusterMaxZoom: 14,
929
1076
  clusterRadius: 50
930
1077
  });
@@ -973,8 +1120,13 @@ var SimpleStyle = class {
973
1120
  "text-allow-overlap": false
974
1121
  }
975
1122
  });
976
- this.setPointGeometries();
977
- this.setCluster();
1123
+ if (this.heatmap) {
1124
+ this.setHeatmap();
1125
+ } else {
1126
+ this.setPointGeometries();
1127
+ this.setCluster();
1128
+ }
1129
+ this.applyDataDrivenPaint();
978
1130
  return this;
979
1131
  }
980
1132
  /**
@@ -1018,8 +1170,12 @@ var SimpleStyle = class {
1018
1170
  source: this.options.id,
1019
1171
  filter: ["==", "$type", "Polygon"],
1020
1172
  paint: {
1021
- "fill-color": ["string", ["get", "fill"], backgroundColor],
1022
- "fill-opacity": ["number", ["get", "fill-opacity"], 1],
1173
+ "fill-color": polygonFillColor,
1174
+ "fill-opacity": [
1175
+ "number",
1176
+ ["get", "fill-opacity"],
1177
+ this.options.choropleth ? 0.7 : 1
1178
+ ],
1023
1179
  "fill-outline-color": ["string", ["get", "stroke"], strokeColor]
1024
1180
  }
1025
1181
  });
@@ -1060,30 +1216,28 @@ var SimpleStyle = class {
1060
1216
  * `marker-size`(`small`、`large`、その他)に応じて円の半径やラベルのオフセットを変え、
1061
1217
  * `marker-color`、`stroke`、`title`、`text-color` などの simplestyle プロパティを反映します。
1062
1218
  * あわせて円レイヤーとシンボルレイヤーの双方に {@link SimpleStyle.setPopup | setPopup} でポップアップを設定します。
1219
+ * `circle` オプションを指定したときは、`marker-symbol` の有無にかかわらずすべてのポイントを円で描き、
1220
+ * シンボルレイヤーは追加しません。
1063
1221
  * 通常は {@link SimpleStyle.addTo | addTo} から呼び出されます。
1064
1222
  */
1065
1223
  setPointGeometries() {
1224
+ const circleOnly = !!this.options.circle;
1066
1225
  this.map.addLayer({
1067
1226
  id: `${this.options.id}-circle-points`,
1068
1227
  type: "circle",
1069
1228
  source: `${this.options.id}-points`,
1070
- filter: ["all", ["!has", "point_count"], ["!has", "marker-symbol"]],
1229
+ filter: circleOnly ? ["!has", "point_count"] : ["all", ["!has", "point_count"], ["!has", "marker-symbol"]],
1071
1230
  paint: {
1072
- "circle-radius": [
1073
- "case",
1074
- ["==", "small", ["get", "marker-size"]],
1075
- 7,
1076
- ["==", "large", ["get", "marker-size"]],
1077
- 13,
1078
- 9
1079
- ],
1080
- "circle-color": ["string", ["get", "marker-color"], backgroundColor],
1231
+ "circle-radius": pointRadius,
1232
+ "circle-color": pointColor,
1081
1233
  "circle-opacity": ["number", ["get", "fill-opacity"], 1],
1082
1234
  "circle-stroke-width": ["number", ["get", "stroke-width"], 1],
1083
1235
  "circle-stroke-color": ["string", ["get", "stroke"], strokeColor],
1084
1236
  "circle-stroke-opacity": ["number", ["get", "stroke-opacity"], 1]
1085
1237
  }
1086
1238
  });
1239
+ this.setPopup(this.map, `${this.options.id}-circle-points`);
1240
+ if (circleOnly) return;
1087
1241
  this.map.addLayer({
1088
1242
  id: `${this.options.id}-symbol-points`,
1089
1243
  type: "symbol",
@@ -1117,9 +1271,73 @@ var SimpleStyle = class {
1117
1271
  ]
1118
1272
  }
1119
1273
  });
1120
- this.setPopup(this.map, `${this.options.id}-circle-points`);
1121
1274
  this.setPopup(this.map, `${this.options.id}-symbol-points`);
1122
1275
  }
1276
+ /**
1277
+ * ポイントのヒートマップレイヤーを設定します。
1278
+ *
1279
+ * `heatmap` オプションを指定したときに、ポイントのマーカーとクラスターの代わりに使います。
1280
+ * 重みは {@link SimpleStyle.applyDataDrivenPaint | applyDataDrivenPaint} がデータに合わせて設定します。
1281
+ * 通常は {@link SimpleStyle.addTo | addTo} から呼び出されます。
1282
+ */
1283
+ setHeatmap() {
1284
+ this.map.addLayer({
1285
+ id: `${this.options.id}-heatmap`,
1286
+ type: "heatmap",
1287
+ source: `${this.options.id}-points`,
1288
+ paint: {
1289
+ "heatmap-weight": 1,
1290
+ "heatmap-intensity": ["interpolate", ["linear"], ["zoom"], 9, 1, 14, 3],
1291
+ "heatmap-radius": 22,
1292
+ "heatmap-opacity": 0.85,
1293
+ "heatmap-color": heatmapColor(this.heatmap ?? {})
1294
+ }
1295
+ });
1296
+ }
1297
+ /**
1298
+ * `choropleth`、`heatmap`、`circle` オプションの式を、現在のデータに合わせて設定します。
1299
+ *
1300
+ * 値の範囲やカテゴリはデータから求めるため、{@link SimpleStyle.addTo | addTo} と
1301
+ * {@link SimpleStyle.updateData | updateData} のたびに呼び出します。
1302
+ */
1303
+ applyDataDrivenPaint() {
1304
+ if (!this.map) return;
1305
+ const id = this.options.id;
1306
+ const features = this.geojson.features;
1307
+ const set = (layer, name, value) => {
1308
+ if (this.map.getLayer(layer)) {
1309
+ this.map.setPaintProperty(layer, name, value);
1310
+ }
1311
+ };
1312
+ const choropleth = normalizeChoropleth(this.options.choropleth);
1313
+ if (choropleth) {
1314
+ set(
1315
+ `${id}-polygon`,
1316
+ "fill-color",
1317
+ choroplethColor(choropleth, features, polygonFillColor)
1318
+ );
1319
+ }
1320
+ if (this.heatmap) {
1321
+ set(
1322
+ `${id}-heatmap`,
1323
+ "heatmap-weight",
1324
+ heatmapWeight(this.heatmap, features)
1325
+ );
1326
+ }
1327
+ const circle = this.options.circle;
1328
+ if (circle) {
1329
+ set(
1330
+ `${id}-circle-points`,
1331
+ "circle-radius",
1332
+ circleRadius(circle, features, pointRadius)
1333
+ );
1334
+ set(
1335
+ `${id}-circle-points`,
1336
+ "circle-color",
1337
+ circleColor(circle, features, pointColor)
1338
+ );
1339
+ }
1340
+ }
1123
1341
  /**
1124
1342
  * 指定したレイヤーにクリックでポップアップを表示するイベントハンドラーを設定します。
1125
1343
  *
@@ -1256,7 +1474,8 @@ var SimpleStyle = class {
1256
1474
  `${id}-polygon`,
1257
1475
  `${id}-linestring`,
1258
1476
  `${id}-clusters`,
1259
- `${id}-cluster-count`
1477
+ `${id}-cluster-count`,
1478
+ `${id}-heatmap`
1260
1479
  ];
1261
1480
  for (const layerId of layerIds) {
1262
1481
  if (this.map.getLayer(layerId)) {
@@ -1855,6 +2074,9 @@ var GeoloniaMap = class extends maplibregl5.Map {
1855
2074
  "geojson",
1856
2075
  "cluster",
1857
2076
  "clusterColor",
2077
+ "choropleth",
2078
+ "heatmap",
2079
+ "circle",
1858
2080
  "simpleVector",
1859
2081
  "3d",
1860
2082
  "errorMessage"
@@ -1886,7 +2108,7 @@ var GeoloniaMap = class extends maplibregl5.Map {
1886
2108
  const nav = parseControlOption(options.navigationControl ?? true);
1887
2109
  if (nav.enabled) {
1888
2110
  this.addControl(
1889
- new maplibregl5.NavigationControl(),
2111
+ new maplibregl5.NavigationControl({ visualizePitch: true }),
1890
2112
  nav.position
1891
2113
  );
1892
2114
  }
@@ -1969,7 +2191,10 @@ var GeoloniaMap = class extends maplibregl5.Map {
1969
2191
  if (options.geojson) {
1970
2192
  const ss = new SimpleStyle(options.geojson, {
1971
2193
  cluster: options.cluster !== false,
1972
- clusterColor: options.clusterColor || "#ff0000"
2194
+ clusterColor: options.clusterColor || "#ff0000",
2195
+ choropleth: options.choropleth,
2196
+ heatmap: options.heatmap,
2197
+ circle: options.circle
1973
2198
  });
1974
2199
  ss.addTo(this);
1975
2200
  if (!options.center) {
@@ -2079,7 +2304,7 @@ var GeoloniaMap = class extends maplibregl5.Map {
2079
2304
  };
2080
2305
 
2081
2306
  // src/version.ts
2082
- var VERSION = "0.7.0";
2307
+ var VERSION = "0.8.0";
2083
2308
  export {
2084
2309
  attribution_default as CustomAttributionControl,
2085
2310
  DEFAULT_STAGE,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geolonia/maps-core",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "module": "dist/npm/index.js",
6
6
  "types": "dist/npm/index.d.ts",
@@ -20,26 +20,26 @@
20
20
  "@turf/bbox": "^7.4.0",
21
21
  "@turf/center": "^7.4.0",
22
22
  "pmtiles": "^4.5.0",
23
- "sanitize-html": "^2.17.7",
23
+ "sanitize-html": "^2.18.1",
24
24
  "tinycolor2": "^1.4.1"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "maplibre-gl": "^6.0.0"
28
28
  },
29
29
  "devDependencies": {
30
- "@biomejs/biome": "^2.5.14",
31
- "@playwright/test": "^1.63.0",
30
+ "@biomejs/biome": "^2.5.15",
31
+ "@playwright/test": "^1.64.1",
32
32
  "@types/sanitize-html": "^2.16.1",
33
33
  "@types/tinycolor2": "^1.4.6",
34
- "@vitest/coverage-v8": "^5.0.3",
34
+ "@vitest/coverage-v8": "^5.0.5",
35
35
  "esbuild": "^0.28.2",
36
- "jsdom": "^30.1.1",
37
- "maplibre-gl": "6.11.2",
38
- "tsup": "^8",
36
+ "jsdom": "^30.1.3",
37
+ "maplibre-gl": "6.15.0",
38
+ "tsup": "^9",
39
39
  "typedoc": "^0.28.20",
40
- "typedoc-plugin-markdown": "^4.13.1",
41
- "typescript": "^5.8",
42
- "vite": "^8.3.1",
40
+ "typedoc-plugin-markdown": "^4.14.0",
41
+ "typescript": "^6.0",
42
+ "vite": "^8.3.4",
43
43
  "vitest": "^5.0.2"
44
44
  },
45
45
  "scripts": {