@basemaps/cli-vector 8.2.0 → 8.3.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.
Files changed (45) hide show
  1. package/build/cli/cli.analyse.js +1 -1
  2. package/build/cli/cli.create.js +7 -3
  3. package/build/cli/cli.create.js.map +1 -1
  4. package/build/cli/cli.extract.js +1 -1
  5. package/build/cli/cli.extract.js.map +1 -1
  6. package/build/cli/cli.join.js +2 -2
  7. package/build/cli/cli.join.js.map +1 -1
  8. package/build/generalization/generalization.d.ts +2 -1
  9. package/build/generalization/generalization.js +31 -22
  10. package/build/generalization/generalization.js.map +1 -1
  11. package/build/modify/layers/place_labels.js +3 -8
  12. package/build/modify/layers/place_labels.js.map +1 -1
  13. package/build/modify/layers/pois.js +8 -3
  14. package/build/modify/layers/pois.js.map +1 -1
  15. package/build/modify/layers/public_transport.js +1 -13
  16. package/build/modify/layers/public_transport.js.map +1 -1
  17. package/build/modify/layers/{water_polygons.d.ts → water.d.ts} +2 -2
  18. package/build/modify/layers/{water_polygons.js → water.js} +12 -15
  19. package/build/modify/layers/water.js.map +1 -0
  20. package/build/modify/modify.js +3 -2
  21. package/build/modify/modify.js.map +1 -1
  22. package/build/modify/shared.d.ts +3 -0
  23. package/build/modify/shared.js +20 -5
  24. package/build/modify/shared.js.map +1 -1
  25. package/build/schema-loader/parser.d.ts +8 -0
  26. package/build/schema-loader/parser.js +1 -0
  27. package/build/schema-loader/parser.js.map +1 -1
  28. package/build/schema-loader/schema.d.ts +2 -0
  29. package/build/schema-loader/schema.loader.d.ts +3 -1
  30. package/build/schema-loader/schema.loader.js +9 -2
  31. package/build/schema-loader/schema.loader.js.map +1 -1
  32. package/build/stac.js +1 -1
  33. package/build/stac.js.map +1 -1
  34. package/build/transform/nztm.d.ts +4 -0
  35. package/build/transform/nztm.js +13 -0
  36. package/build/transform/nztm.js.map +1 -0
  37. package/build/transform/ogr2ogr.d.ts +3 -1
  38. package/build/transform/ogr2ogr.js +24 -1
  39. package/build/transform/ogr2ogr.js.map +1 -1
  40. package/build/transform/tippecanoe.d.ts +2 -1
  41. package/build/transform/tippecanoe.js +6 -5
  42. package/build/transform/tippecanoe.js.map +1 -1
  43. package/dist/index.cjs +438 -381
  44. package/package.json +5 -5
  45. package/build/modify/layers/water_polygons.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -80329,9 +80329,9 @@ var ulid2 = __toESM(require_index_umd(), 1);
80329
80329
  var CliInfo = {
80330
80330
  // Detect unlinked packages looks for this string since its a package name, slightly work around it
80331
80331
  package: "@basemaps/cli",
80332
- version: "v8.2.0",
80333
- hash: "69195be692efa914369fa854d3bae16355dc0dc8",
80334
- buildId: "15601557572-1"
80332
+ version: "v8.3.0",
80333
+ hash: "fe8bbf9d0a3ca2f590505924f227a6d9da0ea5a8",
80334
+ buildId: "15719849199-1"
80335
80335
  };
80336
80336
  var CliDate = (/* @__PURE__ */ new Date()).toISOString();
80337
80337
  var CliId = ulid2.ulid();
@@ -86795,57 +86795,6 @@ function toFeatureMultiPolygon(coordinates, properties = {}) {
86795
86795
  };
86796
86796
  }
86797
86797
 
86798
- // ../linzjs-geojson/build/multipolygon/area.js
86799
- var Area = {
86800
- /**
86801
- * Calculate the cartesian area of a ring using the shoelace formula.
86802
- * Assumes the ring is well-formed and simple (i.e. not self-intersecting).
86803
- * @param ring The ring to calculate the area of.
86804
- * @returns The area of the ring.
86805
- */
86806
- ring(ring) {
86807
- let total = 0;
86808
- for (let i = 0; i < ring.length - 1; i++)
86809
- total += ring[i][0] * ring[i + 1][1] - ring[i][1] * ring[i + 1][0];
86810
- return total / 2;
86811
- },
86812
- /**
86813
- * Calculate the cartesian area of a polygon using the shoelace formula.
86814
- * Assumes the polygon is well-formed and simple (i.e. not self-intersecting).
86815
- *
86816
- * [GeoJSON Polygons][1] are an array of rings, where the first ring is the
86817
- * exterior, and any subsequent rings are interior rings (holes).
86818
- * The coordinates of the exterior ring are ordered counterclockwise,
86819
- * while the coordinates of interior rings are ordered clockwise.
86820
- * Area.ring() gives a negative area value for these clockwise interior rings,
86821
- * hence adding the area of all rings together gives the valid area of the
86822
- * polygon, as adding the negative area of the interior rings subtracts it
86823
- * from the positive area of the exterior ring.
86824
- *
86825
- * [1]: https://datatracker.ietf.org/doc/html/rfc7946#section-3.1.6
86826
- * @param poly The polygon to calculate the area of.
86827
- * @returns The area of the polygon.
86828
- */
86829
- polygon(poly) {
86830
- let total = 0;
86831
- for (const ring of poly)
86832
- total += Area.ring(ring);
86833
- return total;
86834
- },
86835
- /**
86836
- * Calculate the cartesian area of a multipolygon using the shoelace formula.
86837
- * Assumes the multipolygon is well-formed and simple (i.e. not self-intersecting).
86838
- * @param multipoly The polygon to calculate the area of.
86839
- * @returns The area of the polygon.
86840
- */
86841
- multiPolygon(multipoly) {
86842
- let total = 0;
86843
- for (const poly of multipoly)
86844
- total += Area.polygon(poly);
86845
- return total;
86846
- }
86847
- };
86848
-
86849
86798
  // ../linzjs-geojson/build/multipolygon/clipped.js
86850
86799
  var import_lineclip = __toESM(require_lineclip(), 1);
86851
86800
  var import_polygon_clipping = __toESM(require_polygon_clipping_cjs(), 1);
@@ -87399,48 +87348,6 @@ Object.defineProperty(Projection, "AllowedFloatingError", {
87399
87348
  value: 1e-8
87400
87349
  });
87401
87350
 
87402
- // ../geo/build/proj/projection.loader.js
87403
- var ProjectionLoader = class {
87404
- /**
87405
- * Ensure that a projection EPSG code is avialable for use in Proj4js
87406
- *
87407
- * If its not already loaded, lookup definition from spatialreference.org
87408
- * @param code
87409
- */
87410
- static async load(code) {
87411
- if (Projection.tryGet(code) != null)
87412
- return Epsg.get(code);
87413
- const url = `https://spatialreference.org/ref/epsg/${code}/ogcwkt/`;
87414
- const res = await this._fetch(url);
87415
- if (!res.ok)
87416
- throw new Error("Failed to load projection information for:" + code);
87417
- let epsg = Epsg.tryGet(code);
87418
- if (epsg == null)
87419
- epsg = new Epsg(code);
87420
- const text = await res.text();
87421
- Projection.define(epsg, text);
87422
- return epsg;
87423
- }
87424
- };
87425
- Object.defineProperty(ProjectionLoader, "_fetch", {
87426
- enumerable: true,
87427
- configurable: true,
87428
- writable: true,
87429
- value: fetch
87430
- });
87431
-
87432
- // ../geo/build/proj/tile.set.name.js
87433
- var TileSetName;
87434
- (function(TileSetName2) {
87435
- TileSetName2["aerial"] = "aerial";
87436
- })(TileSetName || (TileSetName = {}));
87437
-
87438
- // ../geo/build/quad.key.js
87439
- var CHAR_0 = "0".charCodeAt(0);
87440
- var CHAR_1 = "1".charCodeAt(0);
87441
- var CHAR_2 = "2".charCodeAt(0);
87442
- var CHAR_3 = "3".charCodeAt(0);
87443
-
87444
87351
  // ../geo/build/xy.order.js
87445
87352
  function getXyOrder(epsg) {
87446
87353
  const code = typeof epsg === "number" ? epsg : epsg.code;
@@ -87726,25 +87633,25 @@ var TileMatrixSet = class {
87726
87633
  }
87727
87634
  };
87728
87635
 
87729
- // ../geo/build/tms/citm2000.js
87730
- var Citm2000Tmst = {
87636
+ // ../geo/build/tms/google.js
87637
+ var GoogleTmst = {
87731
87638
  type: "TileMatrixSetType",
87732
- title: "Debug tile matrix for EPSG:3793",
87733
- abstract: "",
87734
- identifier: "CITM2000Quad",
87735
- supportedCRS: "https://www.opengis.net/def/crs/EPSG/0/3793",
87639
+ title: "Google Maps Compatible for the World",
87640
+ identifier: "WebMercatorQuad",
87736
87641
  boundingBox: {
87737
87642
  type: "BoundingBoxType",
87738
- crs: "https://www.opengis.net/def/crs/EPSG/0/3793",
87739
- lowerCorner: [5051234111622438e-9, 3.4301543757978342e6],
87740
- upperCorner: [5207777145550478e-9, 3.5866974097258747e6]
87643
+ crs: "http://www.opengis.net/def/crs/EPSG/0/3857",
87644
+ lowerCorner: [-200375083427892e-7, -200375083427892e-7],
87645
+ upperCorner: [200375083427892e-7, 200375083427892e-7]
87741
87646
  },
87647
+ supportedCRS: "https://www.opengis.net/def/crs/EPSG/0/3857",
87648
+ wellKnownScaleSet: "https://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",
87742
87649
  tileMatrix: [
87743
87650
  {
87744
87651
  type: "TileMatrixType",
87745
87652
  identifier: "0",
87746
- scaleDenominator: 218391509386217e-8,
87747
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87653
+ scaleDenominator: 559082264028717e-6,
87654
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87748
87655
  tileWidth: 256,
87749
87656
  tileHeight: 256,
87750
87657
  matrixWidth: 1,
@@ -87753,8 +87660,8 @@ var Citm2000Tmst = {
87753
87660
  {
87754
87661
  type: "TileMatrixType",
87755
87662
  identifier: "1",
87756
- scaleDenominator: 109195754693108e-8,
87757
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87663
+ scaleDenominator: 279541132014358e-6,
87664
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87758
87665
  tileWidth: 256,
87759
87666
  tileHeight: 256,
87760
87667
  matrixWidth: 2,
@@ -87763,8 +87670,8 @@ var Citm2000Tmst = {
87763
87670
  {
87764
87671
  type: "TileMatrixType",
87765
87672
  identifier: "2",
87766
- scaleDenominator: 545978.773465544,
87767
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87673
+ scaleDenominator: 139770566007179e-6,
87674
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87768
87675
  tileWidth: 256,
87769
87676
  tileHeight: 256,
87770
87677
  matrixWidth: 4,
@@ -87773,8 +87680,8 @@ var Citm2000Tmst = {
87773
87680
  {
87774
87681
  type: "TileMatrixType",
87775
87682
  identifier: "3",
87776
- scaleDenominator: 272989.386732772,
87777
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87683
+ scaleDenominator: 698852830035897e-7,
87684
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87778
87685
  tileWidth: 256,
87779
87686
  tileHeight: 256,
87780
87687
  matrixWidth: 8,
@@ -87783,8 +87690,8 @@ var Citm2000Tmst = {
87783
87690
  {
87784
87691
  type: "TileMatrixType",
87785
87692
  identifier: "4",
87786
- scaleDenominator: 136494.693366386,
87787
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87693
+ scaleDenominator: 349426415017948e-7,
87694
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87788
87695
  tileWidth: 256,
87789
87696
  tileHeight: 256,
87790
87697
  matrixWidth: 16,
@@ -87793,8 +87700,8 @@ var Citm2000Tmst = {
87793
87700
  {
87794
87701
  type: "TileMatrixType",
87795
87702
  identifier: "5",
87796
- scaleDenominator: 68247.346683193,
87797
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87703
+ scaleDenominator: 174713207508974e-7,
87704
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87798
87705
  tileWidth: 256,
87799
87706
  tileHeight: 256,
87800
87707
  matrixWidth: 32,
@@ -87803,8 +87710,8 @@ var Citm2000Tmst = {
87803
87710
  {
87804
87711
  type: "TileMatrixType",
87805
87712
  identifier: "6",
87806
- scaleDenominator: 34123.6733415964,
87807
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87713
+ scaleDenominator: 873566037544871e-8,
87714
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87808
87715
  tileWidth: 256,
87809
87716
  tileHeight: 256,
87810
87717
  matrixWidth: 64,
@@ -87813,8 +87720,8 @@ var Citm2000Tmst = {
87813
87720
  {
87814
87721
  type: "TileMatrixType",
87815
87722
  identifier: "7",
87816
- scaleDenominator: 17061.8366707982,
87817
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87723
+ scaleDenominator: 436783018772435e-8,
87724
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87818
87725
  tileWidth: 256,
87819
87726
  tileHeight: 256,
87820
87727
  matrixWidth: 128,
@@ -87823,8 +87730,8 @@ var Citm2000Tmst = {
87823
87730
  {
87824
87731
  type: "TileMatrixType",
87825
87732
  identifier: "8",
87826
- scaleDenominator: 8530.91833539913,
87827
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87733
+ scaleDenominator: 218391509386217e-8,
87734
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87828
87735
  tileWidth: 256,
87829
87736
  tileHeight: 256,
87830
87737
  matrixWidth: 256,
@@ -87833,8 +87740,8 @@ var Citm2000Tmst = {
87833
87740
  {
87834
87741
  type: "TileMatrixType",
87835
87742
  identifier: "9",
87836
- scaleDenominator: 4265.45916769956,
87837
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87743
+ scaleDenominator: 109195754693108e-8,
87744
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87838
87745
  tileWidth: 256,
87839
87746
  tileHeight: 256,
87840
87747
  matrixWidth: 512,
@@ -87843,8 +87750,8 @@ var Citm2000Tmst = {
87843
87750
  {
87844
87751
  type: "TileMatrixType",
87845
87752
  identifier: "10",
87846
- scaleDenominator: 2132.72958384978,
87847
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87753
+ scaleDenominator: 545978.773465544,
87754
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87848
87755
  tileWidth: 256,
87849
87756
  tileHeight: 256,
87850
87757
  matrixWidth: 1024,
@@ -87853,8 +87760,8 @@ var Citm2000Tmst = {
87853
87760
  {
87854
87761
  type: "TileMatrixType",
87855
87762
  identifier: "11",
87856
- scaleDenominator: 1066.36479192489,
87857
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87763
+ scaleDenominator: 272989.386732772,
87764
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87858
87765
  tileWidth: 256,
87859
87766
  tileHeight: 256,
87860
87767
  matrixWidth: 2048,
@@ -87863,8 +87770,8 @@ var Citm2000Tmst = {
87863
87770
  {
87864
87771
  type: "TileMatrixType",
87865
87772
  identifier: "12",
87866
- scaleDenominator: 533.182395962445,
87867
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87773
+ scaleDenominator: 136494.693366386,
87774
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87868
87775
  tileWidth: 256,
87869
87776
  tileHeight: 256,
87870
87777
  matrixWidth: 4096,
@@ -87873,8 +87780,8 @@ var Citm2000Tmst = {
87873
87780
  {
87874
87781
  type: "TileMatrixType",
87875
87782
  identifier: "13",
87876
- scaleDenominator: 266.591197981222,
87877
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87783
+ scaleDenominator: 68247.346683193,
87784
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87878
87785
  tileWidth: 256,
87879
87786
  tileHeight: 256,
87880
87787
  matrixWidth: 8192,
@@ -87883,8 +87790,8 @@ var Citm2000Tmst = {
87883
87790
  {
87884
87791
  type: "TileMatrixType",
87885
87792
  identifier: "14",
87886
- scaleDenominator: 133.295598990611,
87887
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87793
+ scaleDenominator: 34123.6733415964,
87794
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87888
87795
  tileWidth: 256,
87889
87796
  tileHeight: 256,
87890
87797
  matrixWidth: 16384,
@@ -87893,8 +87800,8 @@ var Citm2000Tmst = {
87893
87800
  {
87894
87801
  type: "TileMatrixType",
87895
87802
  identifier: "15",
87896
- scaleDenominator: 66.6477994953056,
87897
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87803
+ scaleDenominator: 17061.8366707982,
87804
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87898
87805
  tileWidth: 256,
87899
87806
  tileHeight: 256,
87900
87807
  matrixWidth: 32768,
@@ -87903,294 +87810,396 @@ var Citm2000Tmst = {
87903
87810
  {
87904
87811
  type: "TileMatrixType",
87905
87812
  identifier: "16",
87906
- scaleDenominator: 33.3238997476528,
87907
- topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
87813
+ scaleDenominator: 8530.91833539913,
87814
+ topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87908
87815
  tileWidth: 256,
87909
87816
  tileHeight: 256,
87910
87817
  matrixWidth: 65536,
87911
87818
  matrixHeight: 65536
87912
- }
87913
- ],
87914
- $generated: {
87915
- package: "@basemaps/cli",
87916
- version: "v7.14.0-4-g2766010d",
87917
- hash: "2766010d8d2bb8b673f6bcbef2fe2636f2e0f4ea",
87918
- createdAt: "2025-02-10T20:34:46.643Z"
87919
- },
87920
- $options: {
87921
- sourceTileMatrix: "WebMercatorQuad",
87922
- zoomOffset: 8
87923
- }
87924
- };
87925
- var Citm2000Tms = new TileMatrixSet(Citm2000Tmst);
87926
-
87927
- // ../geo/build/tms/google.js
87928
- var GoogleTmst = {
87929
- type: "TileMatrixSetType",
87930
- title: "Google Maps Compatible for the World",
87931
- identifier: "WebMercatorQuad",
87932
- boundingBox: {
87933
- type: "BoundingBoxType",
87934
- crs: "http://www.opengis.net/def/crs/EPSG/0/3857",
87935
- lowerCorner: [-200375083427892e-7, -200375083427892e-7],
87936
- upperCorner: [200375083427892e-7, 200375083427892e-7]
87937
- },
87938
- supportedCRS: "https://www.opengis.net/def/crs/EPSG/0/3857",
87939
- wellKnownScaleSet: "https://www.opengis.net/def/wkss/OGC/1.0/GoogleMapsCompatible",
87940
- tileMatrix: [
87819
+ },
87941
87820
  {
87942
87821
  type: "TileMatrixType",
87943
- identifier: "0",
87944
- scaleDenominator: 559082264028717e-6,
87822
+ identifier: "17",
87823
+ scaleDenominator: 4265.45916769956,
87945
87824
  topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87946
87825
  tileWidth: 256,
87947
87826
  tileHeight: 256,
87948
- matrixWidth: 1,
87949
- matrixHeight: 1
87827
+ matrixWidth: 131072,
87828
+ matrixHeight: 131072
87950
87829
  },
87951
87830
  {
87952
87831
  type: "TileMatrixType",
87953
- identifier: "1",
87954
- scaleDenominator: 279541132014358e-6,
87832
+ identifier: "18",
87833
+ scaleDenominator: 2132.72958384978,
87955
87834
  topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87956
87835
  tileWidth: 256,
87957
87836
  tileHeight: 256,
87958
- matrixWidth: 2,
87959
- matrixHeight: 2
87837
+ matrixWidth: 262144,
87838
+ matrixHeight: 262144
87960
87839
  },
87961
87840
  {
87962
87841
  type: "TileMatrixType",
87963
- identifier: "2",
87964
- scaleDenominator: 139770566007179e-6,
87842
+ identifier: "19",
87843
+ scaleDenominator: 1066.36479192489,
87965
87844
  topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87966
87845
  tileWidth: 256,
87967
87846
  tileHeight: 256,
87968
- matrixWidth: 4,
87969
- matrixHeight: 4
87847
+ matrixWidth: 524288,
87848
+ matrixHeight: 524288
87970
87849
  },
87971
87850
  {
87972
87851
  type: "TileMatrixType",
87973
- identifier: "3",
87974
- scaleDenominator: 698852830035897e-7,
87852
+ identifier: "20",
87853
+ scaleDenominator: 533.182395962445,
87975
87854
  topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87976
87855
  tileWidth: 256,
87977
87856
  tileHeight: 256,
87978
- matrixWidth: 8,
87979
- matrixHeight: 8
87857
+ matrixWidth: 1048576,
87858
+ matrixHeight: 1048576
87980
87859
  },
87981
87860
  {
87982
87861
  type: "TileMatrixType",
87983
- identifier: "4",
87984
- scaleDenominator: 349426415017948e-7,
87862
+ identifier: "21",
87863
+ scaleDenominator: 266.591197981222,
87985
87864
  topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87986
87865
  tileWidth: 256,
87987
87866
  tileHeight: 256,
87988
- matrixWidth: 16,
87989
- matrixHeight: 16
87867
+ matrixWidth: 2097152,
87868
+ matrixHeight: 2097152
87990
87869
  },
87991
87870
  {
87992
87871
  type: "TileMatrixType",
87993
- identifier: "5",
87994
- scaleDenominator: 174713207508974e-7,
87872
+ identifier: "22",
87873
+ scaleDenominator: 133.295598990611,
87995
87874
  topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
87996
87875
  tileWidth: 256,
87997
87876
  tileHeight: 256,
87998
- matrixWidth: 32,
87999
- matrixHeight: 32
87877
+ matrixWidth: 4194304,
87878
+ matrixHeight: 4194304
88000
87879
  },
88001
87880
  {
88002
87881
  type: "TileMatrixType",
88003
- identifier: "6",
88004
- scaleDenominator: 873566037544871e-8,
87882
+ identifier: "23",
87883
+ scaleDenominator: 66.6477994953056,
88005
87884
  topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88006
87885
  tileWidth: 256,
88007
87886
  tileHeight: 256,
88008
- matrixWidth: 64,
88009
- matrixHeight: 64
87887
+ matrixWidth: 8388608,
87888
+ matrixHeight: 8388608
88010
87889
  },
88011
87890
  {
88012
87891
  type: "TileMatrixType",
88013
- identifier: "7",
88014
- scaleDenominator: 436783018772435e-8,
87892
+ identifier: "24",
87893
+ scaleDenominator: 33.3238997476528,
88015
87894
  topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88016
87895
  tileWidth: 256,
88017
87896
  tileHeight: 256,
88018
- matrixWidth: 128,
88019
- matrixHeight: 128
88020
- },
87897
+ matrixWidth: 16777216,
87898
+ matrixHeight: 16777216
87899
+ }
87900
+ ]
87901
+ };
87902
+ var GoogleTms = new TileMatrixSet(GoogleTmst);
87903
+
87904
+ // ../geo/build/location.transform.js
87905
+ function isGoogle(tms) {
87906
+ return tms.identifier === GoogleTms.identifier;
87907
+ }
87908
+ function locationTransform(location, tileMatrix, targetTileMatrix) {
87909
+ if (tileMatrix.identifier === targetTileMatrix.identifier)
87910
+ return location;
87911
+ if (!isGoogle(tileMatrix) && !isGoogle(targetTileMatrix)) {
87912
+ throw new Error("Either tileMatrix or targetTileMatrix must be GoogleTms");
87913
+ }
87914
+ const coords = Projection.get(tileMatrix).fromWgs84([location.lon, location.lat]);
87915
+ const point = tileMatrix.sourceToPixels(coords[0], coords[1], Math.round(location.zoom));
87916
+ const tile = { x: point.x / tileMatrix.tileSize, y: point.y / tileMatrix.tileSize, z: Math.round(location.zoom) };
87917
+ const source = targetTileMatrix.tileToSource(tile);
87918
+ const lonLat = Projection.get(targetTileMatrix).toWgs84([source.x, source.y]);
87919
+ return { lon: Math.round(lonLat[0] * 1e8) / 1e8, lat: Math.round(lonLat[1] * 1e8) / 1e8, zoom: location.zoom };
87920
+ }
87921
+ function projectFeature(f, targetTileMatrix) {
87922
+ if (f.geometry.type === "Polygon") {
87923
+ for (const poly of f.geometry.coordinates) {
87924
+ for (const coord of poly) {
87925
+ const output = locationTransform({ lat: coord[1], lon: coord[0], zoom: targetTileMatrix.maxZoom }, targetTileMatrix, GoogleTms);
87926
+ coord[0] = output.lon;
87927
+ coord[1] = output.lat;
87928
+ }
87929
+ }
87930
+ } else if (f.geometry.type === "MultiPolygon") {
87931
+ for (const multiPoly of f.geometry.coordinates) {
87932
+ for (const poly of multiPoly) {
87933
+ for (const coord of poly) {
87934
+ const output = locationTransform({ lat: coord[1], lon: coord[0], zoom: targetTileMatrix.maxZoom }, targetTileMatrix, GoogleTms);
87935
+ coord[0] = output.lon;
87936
+ coord[1] = output.lat;
87937
+ }
87938
+ }
87939
+ }
87940
+ } else if (f.geometry.type === "Point") {
87941
+ const coord = f.geometry.coordinates;
87942
+ const output = locationTransform({ lat: coord[1], lon: coord[0], zoom: targetTileMatrix.maxZoom }, targetTileMatrix, GoogleTms);
87943
+ coord[0] = output.lon;
87944
+ coord[1] = output.lat;
87945
+ } else if (f.geometry.type === "MultiLineString") {
87946
+ for (const line of f.geometry.coordinates) {
87947
+ for (const coord of line) {
87948
+ const output = locationTransform({ lat: coord[1], lon: coord[0], zoom: targetTileMatrix.maxZoom }, targetTileMatrix, GoogleTms);
87949
+ coord[0] = output.lon;
87950
+ coord[1] = output.lat;
87951
+ }
87952
+ }
87953
+ } else if (f.geometry.type === "LineString") {
87954
+ for (const coord of f.geometry.coordinates) {
87955
+ const output = locationTransform({ lat: coord[1], lon: coord[0], zoom: targetTileMatrix.maxZoom }, targetTileMatrix, GoogleTms);
87956
+ coord[0] = output.lon;
87957
+ coord[1] = output.lat;
87958
+ }
87959
+ } else {
87960
+ throw new Error(`Geometry feature type: ${f.geometry.type} not supported`);
87961
+ }
87962
+ }
87963
+
87964
+ // ../geo/build/proj/projection.loader.js
87965
+ var ProjectionLoader = class {
87966
+ /**
87967
+ * Ensure that a projection EPSG code is avialable for use in Proj4js
87968
+ *
87969
+ * If its not already loaded, lookup definition from spatialreference.org
87970
+ * @param code
87971
+ */
87972
+ static async load(code) {
87973
+ if (Projection.tryGet(code) != null)
87974
+ return Epsg.get(code);
87975
+ const url = `https://spatialreference.org/ref/epsg/${code}/ogcwkt/`;
87976
+ const res = await this._fetch(url);
87977
+ if (!res.ok)
87978
+ throw new Error("Failed to load projection information for:" + code);
87979
+ let epsg = Epsg.tryGet(code);
87980
+ if (epsg == null)
87981
+ epsg = new Epsg(code);
87982
+ const text = await res.text();
87983
+ Projection.define(epsg, text);
87984
+ return epsg;
87985
+ }
87986
+ };
87987
+ Object.defineProperty(ProjectionLoader, "_fetch", {
87988
+ enumerable: true,
87989
+ configurable: true,
87990
+ writable: true,
87991
+ value: fetch
87992
+ });
87993
+
87994
+ // ../geo/build/proj/tile.set.name.js
87995
+ var TileSetName;
87996
+ (function(TileSetName2) {
87997
+ TileSetName2["aerial"] = "aerial";
87998
+ })(TileSetName || (TileSetName = {}));
87999
+
88000
+ // ../geo/build/quad.key.js
88001
+ var CHAR_0 = "0".charCodeAt(0);
88002
+ var CHAR_1 = "1".charCodeAt(0);
88003
+ var CHAR_2 = "2".charCodeAt(0);
88004
+ var CHAR_3 = "3".charCodeAt(0);
88005
+
88006
+ // ../geo/build/tms/citm2000.js
88007
+ var Citm2000Tmst = {
88008
+ type: "TileMatrixSetType",
88009
+ title: "Debug tile matrix for EPSG:3793",
88010
+ abstract: "",
88011
+ identifier: "CITM2000Quad",
88012
+ supportedCRS: "https://www.opengis.net/def/crs/EPSG/0/3793",
88013
+ boundingBox: {
88014
+ type: "BoundingBoxType",
88015
+ crs: "https://www.opengis.net/def/crs/EPSG/0/3793",
88016
+ lowerCorner: [5051234111622438e-9, 3.4301543757978342e6],
88017
+ upperCorner: [5207777145550478e-9, 3.5866974097258747e6]
88018
+ },
88019
+ tileMatrix: [
88021
88020
  {
88022
88021
  type: "TileMatrixType",
88023
- identifier: "8",
88022
+ identifier: "0",
88024
88023
  scaleDenominator: 218391509386217e-8,
88025
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88024
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88026
88025
  tileWidth: 256,
88027
88026
  tileHeight: 256,
88028
- matrixWidth: 256,
88029
- matrixHeight: 256
88027
+ matrixWidth: 1,
88028
+ matrixHeight: 1
88030
88029
  },
88031
88030
  {
88032
88031
  type: "TileMatrixType",
88033
- identifier: "9",
88032
+ identifier: "1",
88034
88033
  scaleDenominator: 109195754693108e-8,
88035
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88034
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88036
88035
  tileWidth: 256,
88037
88036
  tileHeight: 256,
88038
- matrixWidth: 512,
88039
- matrixHeight: 512
88037
+ matrixWidth: 2,
88038
+ matrixHeight: 2
88040
88039
  },
88041
88040
  {
88042
88041
  type: "TileMatrixType",
88043
- identifier: "10",
88042
+ identifier: "2",
88044
88043
  scaleDenominator: 545978.773465544,
88045
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88044
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88046
88045
  tileWidth: 256,
88047
88046
  tileHeight: 256,
88048
- matrixWidth: 1024,
88049
- matrixHeight: 1024
88047
+ matrixWidth: 4,
88048
+ matrixHeight: 4
88050
88049
  },
88051
88050
  {
88052
88051
  type: "TileMatrixType",
88053
- identifier: "11",
88052
+ identifier: "3",
88054
88053
  scaleDenominator: 272989.386732772,
88055
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88054
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88056
88055
  tileWidth: 256,
88057
88056
  tileHeight: 256,
88058
- matrixWidth: 2048,
88059
- matrixHeight: 2048
88057
+ matrixWidth: 8,
88058
+ matrixHeight: 8
88060
88059
  },
88061
88060
  {
88062
88061
  type: "TileMatrixType",
88063
- identifier: "12",
88062
+ identifier: "4",
88064
88063
  scaleDenominator: 136494.693366386,
88065
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88064
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88066
88065
  tileWidth: 256,
88067
88066
  tileHeight: 256,
88068
- matrixWidth: 4096,
88069
- matrixHeight: 4096
88067
+ matrixWidth: 16,
88068
+ matrixHeight: 16
88070
88069
  },
88071
88070
  {
88072
88071
  type: "TileMatrixType",
88073
- identifier: "13",
88072
+ identifier: "5",
88074
88073
  scaleDenominator: 68247.346683193,
88075
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88074
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88076
88075
  tileWidth: 256,
88077
88076
  tileHeight: 256,
88078
- matrixWidth: 8192,
88079
- matrixHeight: 8192
88077
+ matrixWidth: 32,
88078
+ matrixHeight: 32
88080
88079
  },
88081
88080
  {
88082
88081
  type: "TileMatrixType",
88083
- identifier: "14",
88082
+ identifier: "6",
88084
88083
  scaleDenominator: 34123.6733415964,
88085
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88084
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88086
88085
  tileWidth: 256,
88087
88086
  tileHeight: 256,
88088
- matrixWidth: 16384,
88089
- matrixHeight: 16384
88087
+ matrixWidth: 64,
88088
+ matrixHeight: 64
88090
88089
  },
88091
88090
  {
88092
88091
  type: "TileMatrixType",
88093
- identifier: "15",
88092
+ identifier: "7",
88094
88093
  scaleDenominator: 17061.8366707982,
88095
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88094
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88096
88095
  tileWidth: 256,
88097
88096
  tileHeight: 256,
88098
- matrixWidth: 32768,
88099
- matrixHeight: 32768
88097
+ matrixWidth: 128,
88098
+ matrixHeight: 128
88100
88099
  },
88101
88100
  {
88102
88101
  type: "TileMatrixType",
88103
- identifier: "16",
88102
+ identifier: "8",
88104
88103
  scaleDenominator: 8530.91833539913,
88105
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88104
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88106
88105
  tileWidth: 256,
88107
88106
  tileHeight: 256,
88108
- matrixWidth: 65536,
88109
- matrixHeight: 65536
88107
+ matrixWidth: 256,
88108
+ matrixHeight: 256
88110
88109
  },
88111
88110
  {
88112
88111
  type: "TileMatrixType",
88113
- identifier: "17",
88112
+ identifier: "9",
88114
88113
  scaleDenominator: 4265.45916769956,
88115
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88114
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88116
88115
  tileWidth: 256,
88117
88116
  tileHeight: 256,
88118
- matrixWidth: 131072,
88119
- matrixHeight: 131072
88117
+ matrixWidth: 512,
88118
+ matrixHeight: 512
88120
88119
  },
88121
88120
  {
88122
88121
  type: "TileMatrixType",
88123
- identifier: "18",
88122
+ identifier: "10",
88124
88123
  scaleDenominator: 2132.72958384978,
88125
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88124
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88126
88125
  tileWidth: 256,
88127
88126
  tileHeight: 256,
88128
- matrixWidth: 262144,
88129
- matrixHeight: 262144
88127
+ matrixWidth: 1024,
88128
+ matrixHeight: 1024
88130
88129
  },
88131
88130
  {
88132
88131
  type: "TileMatrixType",
88133
- identifier: "19",
88132
+ identifier: "11",
88134
88133
  scaleDenominator: 1066.36479192489,
88135
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88134
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88136
88135
  tileWidth: 256,
88137
88136
  tileHeight: 256,
88138
- matrixWidth: 524288,
88139
- matrixHeight: 524288
88137
+ matrixWidth: 2048,
88138
+ matrixHeight: 2048
88140
88139
  },
88141
88140
  {
88142
88141
  type: "TileMatrixType",
88143
- identifier: "20",
88142
+ identifier: "12",
88144
88143
  scaleDenominator: 533.182395962445,
88145
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88144
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88146
88145
  tileWidth: 256,
88147
88146
  tileHeight: 256,
88148
- matrixWidth: 1048576,
88149
- matrixHeight: 1048576
88147
+ matrixWidth: 4096,
88148
+ matrixHeight: 4096
88150
88149
  },
88151
88150
  {
88152
88151
  type: "TileMatrixType",
88153
- identifier: "21",
88152
+ identifier: "13",
88154
88153
  scaleDenominator: 266.591197981222,
88155
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88154
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88156
88155
  tileWidth: 256,
88157
88156
  tileHeight: 256,
88158
- matrixWidth: 2097152,
88159
- matrixHeight: 2097152
88157
+ matrixWidth: 8192,
88158
+ matrixHeight: 8192
88160
88159
  },
88161
88160
  {
88162
88161
  type: "TileMatrixType",
88163
- identifier: "22",
88162
+ identifier: "14",
88164
88163
  scaleDenominator: 133.295598990611,
88165
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88164
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88166
88165
  tileWidth: 256,
88167
88166
  tileHeight: 256,
88168
- matrixWidth: 4194304,
88169
- matrixHeight: 4194304
88167
+ matrixWidth: 16384,
88168
+ matrixHeight: 16384
88170
88169
  },
88171
88170
  {
88172
88171
  type: "TileMatrixType",
88173
- identifier: "23",
88172
+ identifier: "15",
88174
88173
  scaleDenominator: 66.6477994953056,
88175
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88174
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88176
88175
  tileWidth: 256,
88177
88176
  tileHeight: 256,
88178
- matrixWidth: 8388608,
88179
- matrixHeight: 8388608
88177
+ matrixWidth: 32768,
88178
+ matrixHeight: 32768
88180
88179
  },
88181
88180
  {
88182
88181
  type: "TileMatrixType",
88183
- identifier: "24",
88182
+ identifier: "16",
88184
88183
  scaleDenominator: 33.3238997476528,
88185
- topLeftCorner: [-200375083427892e-7, 200375083427892e-7],
88184
+ topLeftCorner: [5207777145550478e-9, 3.4301543757978342e6],
88186
88185
  tileWidth: 256,
88187
88186
  tileHeight: 256,
88188
- matrixWidth: 16777216,
88189
- matrixHeight: 16777216
88187
+ matrixWidth: 65536,
88188
+ matrixHeight: 65536
88190
88189
  }
88191
- ]
88190
+ ],
88191
+ $generated: {
88192
+ package: "@basemaps/cli",
88193
+ version: "v7.14.0-4-g2766010d",
88194
+ hash: "2766010d8d2bb8b673f6bcbef2fe2636f2e0f4ea",
88195
+ createdAt: "2025-02-10T20:34:46.643Z"
88196
+ },
88197
+ $options: {
88198
+ sourceTileMatrix: "WebMercatorQuad",
88199
+ zoomOffset: 8
88200
+ }
88192
88201
  };
88193
- var GoogleTms = new TileMatrixSet(GoogleTmst);
88202
+ var Citm2000Tms = new TileMatrixSet(Citm2000Tmst);
88194
88203
 
88195
88204
  // ../geo/build/tms/nztm2000.js
88196
88205
  var Nztm20002 = __toESM(require_src3(), 1);
@@ -90402,7 +90411,8 @@ var zLayer = z.object({
90402
90411
  attributes: zAttributes.optional(),
90403
90412
  style: zStyling,
90404
90413
  simplify: z.array(zSimplify).optional(),
90405
- tippecanoe: z.array(z.string()).optional()
90414
+ tippecanoe: z.array(z.string()).optional(),
90415
+ includeDerivedArea: z.boolean().optional()
90406
90416
  });
90407
90417
  var zSchema = z.object({
90408
90418
  name: z.string(),
@@ -90416,13 +90426,15 @@ var zSchema = z.object({
90416
90426
  // src/schema-loader/schema.loader.ts
90417
90427
  var LARGE_LAYER_SIZE = 1024 * 1024 * 1024;
90418
90428
  var SchemaLoader = class {
90419
- constructor(path4, logger, cache) {
90429
+ constructor(path4, tileMatrix, logger, cache) {
90420
90430
  __publicField(this, "path");
90421
90431
  __publicField(this, "logger");
90422
90432
  __publicField(this, "schemas", []);
90433
+ __publicField(this, "tileMatrix");
90423
90434
  __publicField(this, "cache");
90424
90435
  this.path = path4;
90425
90436
  this.logger = logger;
90437
+ this.tileMatrix = tileMatrix;
90426
90438
  this.cache = cache;
90427
90439
  }
90428
90440
  /**
@@ -90476,7 +90488,7 @@ var SchemaLoader = class {
90476
90488
  const configHash = sha256base58(JSON.stringify({ name: schema.name, layer, version: CliInfo.version }));
90477
90489
  if (this.cache != null) {
90478
90490
  const fileName = isLdsFile ? `${layer.id}_${layer.version}_${configHash}.mbtiles` : `${layer.id}_${configHash}.mbtiles`;
90479
- const path4 = new URL(`${layer.id}/${fileName}`, this.cache);
90491
+ const path4 = new URL(`${this.tileMatrix.projection.code}/${layer.id}/${fileName}`, this.cache);
90480
90492
  const exists = await Fsa.exists(path4);
90481
90493
  const cache = {
90482
90494
  fileName,
@@ -90547,7 +90559,7 @@ var VectorStac = class {
90547
90559
  stac_version: "1.0.0",
90548
90560
  stac_extensions: [],
90549
90561
  geometry: null,
90550
- bbox: [-180, -90, 180, 90],
90562
+ bbox: tileMatrix.extent.toBbox(),
90551
90563
  links: [
90552
90564
  { href: `./${filename}.json`, rel: "self" },
90553
90565
  { href: "./collection.json", rel: "collection" },
@@ -90697,7 +90709,7 @@ var ExtractCommand = (0, import_cmd_ts2.command)({
90697
90709
  if (tileMatrix == null)
90698
90710
  throw new Error(`Tile matrix ${args.tileMatrix} is not supported`);
90699
90711
  logger.info({ schema: args.schema }, "Extract: Start");
90700
- const schemaLoader = new SchemaLoader(args.schema, logger, cache);
90712
+ const schemaLoader = new SchemaLoader(args.schema, tileMatrix, logger, cache);
90701
90713
  const schemas = await schemaLoader.load();
90702
90714
  const smallLayers = [];
90703
90715
  const largeLayers = [];
@@ -90992,14 +91004,8 @@ function handleLayerPlaceLabels(feature, logger) {
90992
91004
  logger.trace({}, "HandlePlaceLabels:End");
90993
91005
  return newFeature;
90994
91006
  }
90995
- if (zoomLevel < storedFeature.tippecanoe.minzoom) {
90996
- storedFeature.tippecanoe.minzoom = zoomLevel;
90997
- PlaceLabelsFeatures.set(label, storedFeature);
90998
- }
90999
- if (zoomLevel > storedFeature.tippecanoe.maxzoom) {
91000
- storedFeature.tippecanoe.maxzoom = zoomLevel;
91001
- PlaceLabelsFeatures.set(label, storedFeature);
91002
- }
91007
+ storedFeature.tippecanoe.minzoom = zoomLevel;
91008
+ storedFeature.tippecanoe.maxzoom = zoomLevel;
91003
91009
  logger.trace({}, "HandlePlaceLabels:End");
91004
91010
  return storedFeature;
91005
91011
  }
@@ -91061,22 +91067,6 @@ function convertStyleToKind(style, minzoom) {
91061
91067
  return "";
91062
91068
  }
91063
91069
 
91064
- // src/modify/layers/pois.ts
91065
- function handleLayerPois(feature, logger) {
91066
- logger.trace({}, "HandlePois:Start");
91067
- feature = structuredClone(feature);
91068
- if (feature.properties["building"] === "building") {
91069
- const bldgUse = feature.properties["bldg_use"];
91070
- if (bldgUse == null) {
91071
- logger.trace({}, "HandlePois:End");
91072
- return null;
91073
- }
91074
- feature.properties["building"] = bldgUse;
91075
- }
91076
- logger.trace({}, "HandlePois:End");
91077
- return feature;
91078
- }
91079
-
91080
91070
  // ../../node_modules/tinyqueue/index.js
91081
91071
  var TinyQueue = class {
91082
91072
  constructor(data = [], compare = (a, b) => a < b ? -1 : a > b ? 1 : 0) {
@@ -91262,40 +91252,6 @@ function getSegDistSq(px, py, a, b) {
91262
91252
  return dx * dx + dy * dy;
91263
91253
  }
91264
91254
 
91265
- // src/modify/layers/public_transport.ts
91266
- var polylabel2 = polylabel;
91267
- function handleLayerPublicTransport(feature, options, logger) {
91268
- logger.trace({}, "HandlePublicTransport:Start");
91269
- const kind = options.layer.tags["kind"];
91270
- switch (kind) {
91271
- case "aerodrome":
91272
- feature = handleKindAerodrome(feature, logger);
91273
- break;
91274
- }
91275
- logger.trace({}, "HandlePublicTransport:End");
91276
- return feature;
91277
- }
91278
- function handleKindAerodrome(feature, logger) {
91279
- logger.trace({}, "HandleKindAerodrome:Start");
91280
- feature = structuredClone(feature);
91281
- const coordinates = getCoordinates(feature.geometry, logger);
91282
- const inaccessibilityPole = polylabel2(coordinates);
91283
- const point = { type: "Point", coordinates: inaccessibilityPole };
91284
- feature.geometry = point;
91285
- logger.trace({}, "HandleKindAerodrome:End");
91286
- return feature;
91287
- }
91288
- function getCoordinates(geometry, logger) {
91289
- switch (geometry.type) {
91290
- case "MultiPolygon":
91291
- return geometry.coordinates[0];
91292
- case "Polygon":
91293
- return geometry.coordinates;
91294
- }
91295
- logger.error({ type: geometry.type }, "Unsupported geometry type");
91296
- throw new Error("Unsupported geometry type");
91297
- }
91298
-
91299
91255
  // src/modify/consts.ts
91300
91256
  var MajorHighWays = /* @__PURE__ */ new Set([
91301
91257
  "1",
@@ -91321,19 +91277,22 @@ var MajorHighWays = /* @__PURE__ */ new Set([
91321
91277
  ]);
91322
91278
 
91323
91279
  // src/modify/shared.ts
91280
+ var polylabel2 = polylabel;
91324
91281
  function handleRoadFeature(feature, options, logger) {
91325
91282
  logger.trace({}, "HandleRoadFeature:Start");
91326
91283
  feature = structuredClone(feature);
91327
91284
  const highwayNum = feature.properties["hway_num"];
91328
- if (typeof highwayNum === "string") {
91285
+ if (highwayNum != null && typeof highwayNum === "string") {
91329
91286
  const kind = "motorway";
91330
91287
  feature.properties["kind"] = kind;
91331
91288
  const ref = highwayNum;
91332
91289
  feature.properties["ref"] = ref;
91333
91290
  logger.trace({ kind, ref }, "new/overidden tags");
91334
- const minzoom = MajorHighWays.has(highwayNum) ? 2 : 8;
91335
- feature.tippecanoe.minzoom = minzoom;
91336
- logger.trace({ minzoom }, "overidden styles");
91291
+ if (feature.tippecanoe.minzoom < 8) {
91292
+ const minzoom = MajorHighWays.has(highwayNum) ? feature.tippecanoe.maxzoom : 8;
91293
+ feature.tippecanoe.minzoom = minzoom;
91294
+ logger.trace({ minzoom }, "overidden styles");
91295
+ }
91337
91296
  logger.trace({}, "HandleRoadFeature:End");
91338
91297
  return feature;
91339
91298
  }
@@ -91351,6 +91310,61 @@ function handleRoadFeature(feature, options, logger) {
91351
91310
  logger.trace({}, "HandleRoadFeature:End");
91352
91311
  return feature;
91353
91312
  }
91313
+ function getCoordinates(geometry, logger) {
91314
+ switch (geometry.type) {
91315
+ case "MultiPolygon":
91316
+ return geometry.coordinates[0];
91317
+ case "Polygon":
91318
+ return geometry.coordinates;
91319
+ }
91320
+ logger.error({ type: geometry.type }, "Unsupported geometry type");
91321
+ throw new Error("Unsupported geometry type");
91322
+ }
91323
+
91324
+ // src/modify/layers/pois.ts
91325
+ function handleLayerPois(feature, logger) {
91326
+ logger.trace({}, "HandlePois:Start");
91327
+ feature = structuredClone(feature);
91328
+ if (feature.properties["building"] === "building") {
91329
+ const bldgUse = feature.properties["bldg_use"];
91330
+ if (bldgUse == null) {
91331
+ logger.trace({}, "HandlePois:End");
91332
+ return null;
91333
+ }
91334
+ feature.properties["building"] = bldgUse;
91335
+ if (feature.geometry.type === "Polygon" || feature.geometry.type === "MultiPolygon") {
91336
+ const coordinates = getCoordinates(feature.geometry, logger);
91337
+ const inaccessibilityPole = polylabel2(coordinates);
91338
+ const point = { type: "Point", coordinates: inaccessibilityPole };
91339
+ feature.geometry = point;
91340
+ }
91341
+ }
91342
+ logger.trace({}, "HandlePois:End");
91343
+ return feature;
91344
+ }
91345
+
91346
+ // src/modify/layers/public_transport.ts
91347
+ function handleLayerPublicTransport(feature, options, logger) {
91348
+ logger.trace({}, "HandlePublicTransport:Start");
91349
+ const kind = options.layer.tags["kind"];
91350
+ switch (kind) {
91351
+ case "aerodrome":
91352
+ feature = handleKindAerodrome(feature, logger);
91353
+ break;
91354
+ }
91355
+ logger.trace({}, "HandlePublicTransport:End");
91356
+ return feature;
91357
+ }
91358
+ function handleKindAerodrome(feature, logger) {
91359
+ logger.trace({}, "HandleKindAerodrome:Start");
91360
+ feature = structuredClone(feature);
91361
+ const coordinates = getCoordinates(feature.geometry, logger);
91362
+ const inaccessibilityPole = polylabel2(coordinates);
91363
+ const point = { type: "Point", coordinates: inaccessibilityPole };
91364
+ feature.geometry = point;
91365
+ logger.trace({}, "HandleKindAerodrome:End");
91366
+ return feature;
91367
+ }
91354
91368
 
91355
91369
  // src/modify/layers/street_labels.ts
91356
91370
  function handleLayerStreetLabels(feature, options, logger) {
@@ -91416,9 +91430,9 @@ function handleKindTrack(feature, logger) {
91416
91430
  return feature;
91417
91431
  }
91418
91432
 
91419
- // src/modify/layers/water_polygons.ts
91433
+ // src/modify/layers/water.ts
91420
91434
  var LargeLakeSize = 4e6;
91421
- function handleLayerWaterPolygons(feature, options, logger) {
91435
+ function handleLayerWater(feature, options, logger) {
91422
91436
  logger.trace({}, "HandleWaterPolygons:Start");
91423
91437
  feature = structuredClone(feature);
91424
91438
  const kind = options.layer.tags["kind"];
@@ -91448,15 +91462,14 @@ function handleKindWater(feature, logger) {
91448
91462
  feature.properties["name"] = grpName;
91449
91463
  logger.trace({ name: grpName }, "new/overidden tags");
91450
91464
  }
91451
- let area = 0;
91452
- if (feature.geometry.type === "MultiPolygon") {
91453
- area = Area.multiPolygon(feature.geometry.coordinates);
91454
- } else if (feature.geometry.type === "Polygon") {
91455
- area = Area.polygon(feature.geometry.coordinates);
91456
- }
91457
- const minzoom = area >= LargeLakeSize ? 1 : 9;
91458
- feature.tippecanoe.minzoom = minzoom;
91459
- logger.trace({ minzoom }, "overidden styles");
91465
+ if (feature.properties["water"] === "lake") {
91466
+ const aera = feature.properties["_derived_area"];
91467
+ if (aera != null && Number(aera) >= LargeLakeSize) {
91468
+ feature.tippecanoe.minzoom = 1;
91469
+ } else {
91470
+ feature.tippecanoe.minzoom = 9;
91471
+ }
91472
+ }
91460
91473
  logger.trace({}, "HandleKindWater:End");
91461
91474
  return feature;
91462
91475
  }
@@ -91465,7 +91478,7 @@ function handleKindRiver(feature, options, logger) {
91465
91478
  feature = structuredClone(feature);
91466
91479
  if (options.layer.style.minZoom < 11) {
91467
91480
  const name = feature.properties["name"];
91468
- if (name === "") {
91481
+ if (name === "" && feature.tippecanoe.minzoom < 11) {
91469
91482
  const minzoom = 11;
91470
91483
  feature.tippecanoe.minzoom = minzoom;
91471
91484
  logger.trace({ minzoom }, "overidden styles");
@@ -91501,7 +91514,8 @@ function modifyFeature(feature, options, logger) {
91501
91514
  modifiedFeature = handleLayerStreets(feature, options, logger);
91502
91515
  break;
91503
91516
  case "water_polygons":
91504
- modifiedFeature = handleLayerWaterPolygons(feature, options, logger);
91517
+ case "water_lines":
91518
+ modifiedFeature = handleLayerWater(feature, options, logger);
91505
91519
  break;
91506
91520
  default:
91507
91521
  modifiedFeature = structuredClone(feature);
@@ -91510,6 +91524,17 @@ function modifyFeature(feature, options, logger) {
91510
91524
  return modifiedFeature;
91511
91525
  }
91512
91526
 
91527
+ // src/transform/nztm.ts
91528
+ function transformNdJson(feature) {
91529
+ projectFeature(feature, Nztm2000QuadTms);
91530
+ }
91531
+ function transformZoom(z2, tileMatrix) {
91532
+ if (tileMatrix.identifier === Nztm2000QuadTms.identifier)
91533
+ return Math.max(0, z2 - 2);
91534
+ else
91535
+ return z2;
91536
+ }
91537
+
91513
91538
  // src/util.ts
91514
91539
  var import_node_fs3 = require("fs");
91515
91540
  var import_fs4 = require("fs");
@@ -91626,7 +91651,7 @@ function simplify(points, tolerance, highestQuality) {
91626
91651
  }
91627
91652
 
91628
91653
  // src/generalization/generalization.ts
91629
- async function generalize(input, output, options, logger) {
91654
+ async function generalize(input, output, tileMatrix, options, logger) {
91630
91655
  logger.info({}, "Generalize:Start");
91631
91656
  const fileStream = await createReadStreamSafe(input.pathname);
91632
91657
  const simplify2 = options.layer.simplify;
@@ -91640,20 +91665,23 @@ async function generalize(input, output, options, logger) {
91640
91665
  for await (const line of rl) {
91641
91666
  if (line === "")
91642
91667
  continue;
91668
+ const feature = JSON.parse(line);
91669
+ if (tileMatrix.identifier === "NZTM2000Quad")
91670
+ transformNdJson(feature);
91643
91671
  inputCount++;
91644
91672
  if (simplify2 != null) {
91645
91673
  for (const s of simplify2) {
91646
- const feature = tag(options, line, s, logger);
91647
- if (feature == null)
91674
+ const vectorGeofeature = tag(tileMatrix, options, feature, s, logger);
91675
+ if (vectorGeofeature == null)
91648
91676
  continue;
91649
- writeStream.write(JSON.stringify(feature) + "\n");
91677
+ writeStream.write(JSON.stringify(vectorGeofeature) + "\n");
91650
91678
  outputCount++;
91651
91679
  }
91652
91680
  } else {
91653
- const feature = tag(options, line, null, logger);
91654
- if (feature == null)
91681
+ const vectorGeofeature = tag(tileMatrix, options, feature, null, logger);
91682
+ if (vectorGeofeature == null)
91655
91683
  continue;
91656
- writeStream.write(JSON.stringify(feature) + "\n");
91684
+ writeStream.write(JSON.stringify(vectorGeofeature) + "\n");
91657
91685
  outputCount++;
91658
91686
  }
91659
91687
  }
@@ -91667,36 +91695,40 @@ async function generalize(input, output, options, logger) {
91667
91695
  logger.info({ inputCount, outputCount }, "Generalize:End");
91668
91696
  return metrics;
91669
91697
  }
91670
- function tag(options, line, simplify2, logger) {
91671
- const feature = {
91672
- ...JSON.parse(line),
91698
+ function tag(tileMatrix, options, feature, simplify2, logger) {
91699
+ const vectorGeofeature = {
91700
+ ...structuredClone(feature),
91673
91701
  tippecanoe: {
91674
91702
  layer: options.name,
91675
91703
  minzoom: options.layer.style.minZoom,
91676
91704
  maxzoom: options.layer.style.maxZoom
91677
91705
  }
91678
91706
  };
91679
- Object.entries(options.layer.tags).forEach(([key, value]) => feature.properties[key] = value);
91680
- const modifiedFeature = modifyFeature(feature, options, logger);
91681
- if (modifiedFeature == null) {
91682
- return null;
91683
- }
91707
+ Object.entries(options.layer.tags).forEach(([key, value]) => vectorGeofeature.properties[key] = value);
91684
91708
  if (simplify2 != null) {
91685
- modifiedFeature["tippecanoe"] = {
91709
+ vectorGeofeature["tippecanoe"] = {
91686
91710
  layer: options.name,
91687
91711
  minzoom: simplify2.style.minZoom,
91688
91712
  maxzoom: simplify2.style.maxZoom
91689
91713
  };
91690
91714
  if (simplify2.tolerance != null) {
91691
- const geom = modifiedFeature.geometry;
91715
+ const geom = vectorGeofeature.geometry;
91692
91716
  const type = geom.type;
91693
- const coordinates = simplifyFeature(type, geom, simplify2.tolerance);
91694
- if (coordinates == null) {
91717
+ const geometry = simplifyFeature(type, geom, simplify2.tolerance);
91718
+ if (geometry == null) {
91695
91719
  return null;
91696
91720
  }
91697
- modifiedFeature.geometry = coordinates;
91721
+ vectorGeofeature.geometry = geometry;
91698
91722
  }
91699
91723
  }
91724
+ const modifiedFeature = modifyFeature(vectorGeofeature, options, logger);
91725
+ if (modifiedFeature == null) {
91726
+ return null;
91727
+ }
91728
+ if (modifiedFeature.tippecanoe.maxzoom < modifiedFeature.tippecanoe.minzoom)
91729
+ return null;
91730
+ modifiedFeature.tippecanoe.minzoom = transformZoom(modifiedFeature.tippecanoe.minzoom, tileMatrix);
91731
+ modifiedFeature.tippecanoe.maxzoom = transformZoom(modifiedFeature.tippecanoe.maxzoom, tileMatrix);
91700
91732
  const cleanedFeature = removeAttributes(modifiedFeature, options);
91701
91733
  return cleanedFeature;
91702
91734
  }
@@ -91979,11 +92011,16 @@ var CommandExecution = class {
91979
92011
  };
91980
92012
 
91981
92013
  // src/transform/ogr2ogr.ts
91982
- async function ogr2ogrNDJson(input, output, logger) {
92014
+ async function ogr2ogrNDJson(input, output, layer, logger) {
91983
92015
  const cmd = Command.create("ogr2ogr");
91984
92016
  cmd.args.push("-f", "GeoJSONSeq");
91985
92017
  cmd.args.push(output.pathname);
91986
92018
  cmd.args.push("-t_srs", Epsg.Wgs84.toEpsgString());
92019
+ if (layer.includeDerivedArea) {
92020
+ const table = await getTableName(input, logger);
92021
+ cmd.args.push("-dialect", "SQLite");
92022
+ cmd.args.push("-sql", `SELECT *, ST_Area(geom) AS _derived_area FROM "${table}"`);
92023
+ }
91987
92024
  cmd.args.push(input.pathname);
91988
92025
  const res = await cmd.run();
91989
92026
  if (res.exitCode !== 0) {
@@ -91991,20 +92028,37 @@ async function ogr2ogrNDJson(input, output, logger) {
91991
92028
  throw new Error("Gdal failed to run");
91992
92029
  }
91993
92030
  }
92031
+ async function getTableName(input, logger) {
92032
+ const cmd = Command.create("ogrinfo");
92033
+ cmd.args.push("-ro");
92034
+ cmd.args.push("-q");
92035
+ cmd.args.push("-json");
92036
+ cmd.args.push(input.pathname);
92037
+ const res = await cmd.run();
92038
+ if (res.exitCode !== 0) {
92039
+ logger.fatal({ Gdal: res }, "Failure");
92040
+ throw new Error("Gdal failed to run");
92041
+ }
92042
+ const info = JSON.parse(res.stdout);
92043
+ if (info.layers == null || info.layers.length === 0) {
92044
+ throw new Error(`No layers found in ${input.pathname}`);
92045
+ }
92046
+ return info.layers[0].name;
92047
+ }
91994
92048
 
91995
92049
  // src/transform/tippecanoe.ts
91996
92050
  var import_path2 = __toESM(require("path"), 1);
91997
- async function tippecanoe(input, output, layer, logger) {
92051
+ async function tippecanoe(input, output, layer, tileMatrix, logger) {
91998
92052
  const cmd = Command.create("tippecanoe");
91999
92053
  cmd.args.push("--read-parallel");
92000
92054
  cmd.args.push("-s", Epsg.Wgs84.toEpsgString());
92001
92055
  if (layer.style != null) {
92002
- cmd.args.push(`-Z${layer.style.minZoom}`);
92003
- cmd.args.push(`-z${layer.style.maxZoom}`);
92056
+ cmd.args.push(`-Z${transformZoom(layer.style.minZoom, tileMatrix)}`);
92057
+ cmd.args.push(`-z${transformZoom(layer.style.maxZoom, tileMatrix)}`);
92004
92058
  if (layer.style.detail != null)
92005
92059
  cmd.args.push(`--full-detail=${layer.style.detail}`);
92006
92060
  } else {
92007
- cmd.args.push(`-z15`);
92061
+ cmd.args.push(`-z${transformZoom(15, tileMatrix)}`);
92008
92062
  }
92009
92063
  cmd.mount((0, import_path2.dirname)(input.pathname));
92010
92064
  cmd.mount((0, import_path2.dirname)(output.pathname));
@@ -92140,16 +92194,19 @@ async function createMbtilesFile({ stac, tmpPaths }, logger) {
92140
92194
  throw new Error(`Stac file missing linz_basemaps:options ${stac.id}`);
92141
92195
  const layer = options.layer;
92142
92196
  const shortbreadLayer = options.name;
92197
+ const tileMatrix = TileMatrixSets.find(options.tileMatrix);
92198
+ if (tileMatrix == null)
92199
+ throw new Error(`Tile matrix ${options.tileMatrix} is not supported`);
92143
92200
  logger.info({ shortbreadLayer, dataset: layer.name }, "CreateMbtilesFile: Start");
92144
92201
  logger.info({ source: tmpPaths.source.path, dataset: layer.name }, "[1/5] Convert source file to ndjson: Start");
92145
92202
  if (!await Fsa.exists(tmpPaths.ndjson)) {
92146
- await ogr2ogrNDJson(tmpPaths.source.path, tmpPaths.ndjson, logger);
92203
+ await ogr2ogrNDJson(tmpPaths.source.path, tmpPaths.ndjson, layer, logger);
92147
92204
  }
92148
92205
  logger.info({ destination: tmpPaths.ndjson, dataset: layer.name }, "[1/5] Convert source file to ndjson: End");
92149
92206
  logger.info({ source: tmpPaths.ndjson, dataset: layer.name }, "[2/5] Generalise ndjson features: Start");
92150
92207
  let metrics = null;
92151
92208
  if (!await Fsa.exists(tmpPaths.genNdjson)) {
92152
- metrics = await generalize(tmpPaths.ndjson, tmpPaths.genNdjson, options, logger);
92209
+ metrics = await generalize(tmpPaths.ndjson, tmpPaths.genNdjson, tileMatrix, options, logger);
92153
92210
  if (metrics.output === 0)
92154
92211
  throw new Error(`Failed to generalize ndjson file ${tmpPaths.ndjson.href}`);
92155
92212
  }
@@ -92159,7 +92216,7 @@ async function createMbtilesFile({ stac, tmpPaths }, logger) {
92159
92216
  "[3/5] Transform generalised ndjson into mbtiles: Start"
92160
92217
  );
92161
92218
  if (!await Fsa.exists(tmpPaths.mbtiles)) {
92162
- await tippecanoe(tmpPaths.genNdjson, tmpPaths.mbtiles, layer, logger);
92219
+ await tippecanoe(tmpPaths.genNdjson, tmpPaths.mbtiles, layer, tileMatrix, logger);
92163
92220
  }
92164
92221
  logger.info(
92165
92222
  { destination: tmpPaths.mbtiles, dataset: layer.name },
@@ -93234,7 +93291,7 @@ var JoinCommand = (0, import_cmd_ts4.command)({
93234
93291
  }
93235
93292
  if (isArgo()) {
93236
93293
  const target = new URL(`topographic/${CliId}/${args.filename}.tar.co`, bucketPath);
93237
- await Fsa.write(Fsa.toUrl("/tmp/target"), JSON.stringify([target]));
93294
+ await Fsa.write(Fsa.toUrl("/tmp/target"), urlToString(target));
93238
93295
  const mbTilesTarget = new URL(`topographic/${CliId}/${args.filename}.mbtiles`, bucketPath);
93239
93296
  await Fsa.write(Fsa.toUrl("/tmp/mbTilesTarget"), mbTilesTarget.toString());
93240
93297
  const analyseTarget = new URL(`topographic/${CliId}/`, bucketPath);
@@ -93789,7 +93846,7 @@ var AnalyseCommand = (0, import_cmd_ts5.command)({
93789
93846
  y: row.y,
93790
93847
  z: row.z,
93791
93848
  max: buffer.length,
93792
- link: `https://basemaps.linz.govt.nz/v1/tiles/topographic/WebMercatorQuad/${row.z}/${row.z}/${row.y}.pbf`
93849
+ link: `https://basemaps.linz.govt.nz/v1/tiles/topographic/WebMercatorQuad/${row.z}/${row.x}/${row.y}.pbf`
93793
93850
  };
93794
93851
  const dis = distribution(buffer.length);
93795
93852
  const value = distributionSum.get(dis);