@maptiler/client 1.0.2 → 1.1.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/.github/workflows/npm-publish.yml +0 -1
- package/dist/maptiler-client.cjs +465 -21
- package/dist/maptiler-client.cjs.map +1 -1
- package/dist/maptiler-client.d.ts +395 -2
- package/dist/maptiler-client.min.mjs +1 -1
- package/dist/maptiler-client.mjs +461 -22
- package/dist/maptiler-client.mjs.map +1 -1
- package/dist/maptiler-client.umd.js +465 -21
- package/dist/maptiler-client.umd.js.map +1 -1
- package/dist/maptiler-client.umd.min.js +1 -1
- package/docs/assets/custom.css +118 -0
- package/docs/assets/highlight.css +10 -10
- package/docs/assets/main.js +56 -52
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +23 -0
- package/docs/classes/{ClientConfig.html → config.ClientConfig.html} +34 -24
- package/docs/classes/{ServiceError.html → services_ServiceError.ServiceError.html} +26 -16
- package/docs/functions/language.getAutoLanguageGeocoding.html +60 -0
- package/docs/functions/services_simplify.default.html +65 -0
- package/docs/images/maptiler-logo-256.png +0 -0
- package/docs/index.html +118 -57
- package/docs/modules/config.html +71 -0
- package/docs/modules/language.html +71 -0
- package/docs/modules/services_ServiceError.html +61 -0
- package/docs/modules/services_coordinates.html +84 -0
- package/docs/modules/services_data.html +66 -0
- package/docs/modules/services_geocoding.html +76 -0
- package/docs/modules/services_geolocation.html +68 -0
- package/docs/modules/services_simplify.html +61 -0
- package/docs/modules/services_staticMaps.html +74 -0
- package/docs/modules.html +23 -83
- package/docs/types/config.FetchFunction.html +71 -0
- package/docs/types/language.LanguageGeocodingString.html +58 -0
- package/docs/types/services_coordinates.CoordinateExport.html +71 -0
- package/docs/types/services_coordinates.CoordinateGrid.html +69 -0
- package/docs/types/services_coordinates.CoordinateId.html +71 -0
- package/docs/types/services_coordinates.CoordinateSearch.html +93 -0
- package/docs/types/services_coordinates.CoordinateSearchResult.html +75 -0
- package/docs/types/services_coordinates.CoordinateTransformResult.html +76 -0
- package/docs/types/services_coordinates.CoordinateTransformation.html +89 -0
- package/docs/types/services_coordinates.CoordinatesSearchOptions.html +83 -0
- package/docs/types/services_coordinates.CoordinatesTransformOptions.html +85 -0
- package/docs/types/services_coordinates.XYZ.html +73 -0
- package/docs/types/services_data.GetDataOptions.html +64 -0
- package/docs/types/services_geocoding.Coordinates.html +60 -0
- package/docs/types/services_geocoding.FeatureHierarchy.html +71 -0
- package/docs/types/services_geocoding.GeocodingFeature.html +60 -0
- package/docs/types/services_geocoding.GeocodingOptions.html +79 -0
- package/docs/types/services_geocoding.GeocodingSearchResult.html +77 -0
- package/docs/types/services_geocoding.ReverseGeocodingOptions.html +71 -0
- package/docs/types/services_geolocation.GeolocationInfoOptions.html +65 -0
- package/docs/types/services_geolocation.GeolocationResult.html +128 -0
- package/docs/types/services_staticMaps.AutomaticStaticMapOptions.html +61 -0
- package/docs/types/services_staticMaps.BoundedStaticMapOptions.html +61 -0
- package/docs/types/services_staticMaps.CenteredStaticMapOptions.html +61 -0
- package/docs/types/{StaticMapBaseOptions.html → services_staticMaps.StaticMapBaseOptions.html} +26 -45
- package/docs/types/services_staticMaps.StaticMapMarker.html +61 -0
- package/docs/variables/config.config.html +58 -0
- package/docs/variables/{LanguageGeocoding.html → language.LanguageGeocoding.html} +20 -42
- package/docs/variables/services_coordinates.coordinates.html +110 -0
- package/docs/variables/services_data.data.html +80 -0
- package/docs/variables/{geocoding.html → services_geocoding.geocoding.html} +35 -53
- package/docs/variables/services_geolocation.geolocation.html +79 -0
- package/docs/variables/services_staticMaps.staticMaps.html +128 -0
- package/docsmd/README.md +143 -36
- package/docsmd/assets/custom.css +118 -0
- package/docsmd/classes/ClientConfig.md +5 -5
- package/docsmd/classes/MapStyleVariant.md +217 -0
- package/docsmd/classes/ReferenceMapStyle.md +169 -0
- package/docsmd/classes/ServiceError.md +3 -3
- package/examples/test-browser-umd.html +1 -1
- package/images/maptiler-logo-256.png +0 -0
- package/package.json +5 -5
- package/readme.md +65 -5
- package/src/index.ts +17 -0
- package/src/mapstyle.ts +841 -0
- package/src/services/staticMaps.ts +5 -4
- package/tsconfig.json +0 -1
- package/typedoc.css +118 -0
- package/typedoc.json +7 -3
- package/docs/types/AutomaticStaticMapOptions.html +0 -80
- package/docs/types/BoundedStaticMapOptions.html +0 -80
- package/docs/types/CenteredStaticMapOptions.html +0 -80
- package/docs/types/CoordinateExport.html +0 -85
- package/docs/types/CoordinateGrid.html +0 -83
- package/docs/types/CoordinateId.html +0 -85
- package/docs/types/CoordinateSearch.html +0 -107
- package/docs/types/CoordinateSearchResult.html +0 -89
- package/docs/types/CoordinateTransformResult.html +0 -90
- package/docs/types/CoordinateTransformation.html +0 -103
- package/docs/types/Coordinates.html +0 -78
- package/docs/types/CoordinatesSearchOptions.html +0 -97
- package/docs/types/CoordinatesTransformOptions.html +0 -99
- package/docs/types/FeatureHierarchy.html +0 -89
- package/docs/types/FetchFunction.html +0 -93
- package/docs/types/GeocodingFeature.html +0 -78
- package/docs/types/GeocodingOptions.html +0 -97
- package/docs/types/GeocodingSearchResult.html +0 -95
- package/docs/types/GeolocationInfoOptions.html +0 -87
- package/docs/types/GeolocationResult.html +0 -150
- package/docs/types/GetDataOptions.html +0 -87
- package/docs/types/LanguageGeocodingString.html +0 -80
- package/docs/types/ReverseGeocodingOptions.html +0 -89
- package/docs/types/StaticMapMarker.html +0 -80
- package/docs/types/XYZ.html +0 -87
- package/docs/variables/config.html +0 -80
- package/docs/variables/coordinates-1.html +0 -124
- package/docs/variables/data.html +0 -103
- package/docs/variables/geolocation.html +0 -101
- package/docs/variables/staticMaps.html +0 -147
- package/docsmd/images/JS-logo.svg +0 -4
- package/docsmd/images/TS-logo.svg +0 -6
- package/docsmd/images/maptiler-client-logo.afdesign +0 -0
- package/docsmd/images/maptiler-client-logo.svg +0 -75
- package/docsmd/images/maptiler-logo.svg +0 -23
- package/docsmd/images/screenshots/static-bounded-europe-1024.png +0 -0
- package/docsmd/images/screenshots/static-bounded-europe-2048.png +0 -0
- package/docsmd/images/screenshots/static-bounded-portugal-1024x2048.png +0 -0
- package/docsmd/images/screenshots/static-bounded-portugal-2048x2048.png +0 -0
- package/docsmd/images/screenshots/static-with-path.png +0 -0
package/dist/maptiler-client.mjs
CHANGED
|
@@ -438,6 +438,445 @@ const data = {
|
|
|
438
438
|
get
|
|
439
439
|
};
|
|
440
440
|
|
|
441
|
+
class MapStyleVariant {
|
|
442
|
+
constructor(name, variantType, id, referenceStyle, description, imageURL) {
|
|
443
|
+
this.name = name;
|
|
444
|
+
this.variantType = variantType;
|
|
445
|
+
this.id = id;
|
|
446
|
+
this.referenceStyle = referenceStyle;
|
|
447
|
+
this.description = description;
|
|
448
|
+
this.imageURL = imageURL;
|
|
449
|
+
}
|
|
450
|
+
getName() {
|
|
451
|
+
return this.name;
|
|
452
|
+
}
|
|
453
|
+
getFullName() {
|
|
454
|
+
return `${this.referenceStyle.getName()} ${this.name}`;
|
|
455
|
+
}
|
|
456
|
+
getType() {
|
|
457
|
+
return this.variantType;
|
|
458
|
+
}
|
|
459
|
+
getId() {
|
|
460
|
+
return this.id;
|
|
461
|
+
}
|
|
462
|
+
getDescription() {
|
|
463
|
+
return this.description;
|
|
464
|
+
}
|
|
465
|
+
getReferenceStyle() {
|
|
466
|
+
return this.referenceStyle;
|
|
467
|
+
}
|
|
468
|
+
hasVariant(variantType) {
|
|
469
|
+
return this.referenceStyle.hasVariant(variantType);
|
|
470
|
+
}
|
|
471
|
+
getVariant(variantType) {
|
|
472
|
+
return this.referenceStyle.getVariant(variantType);
|
|
473
|
+
}
|
|
474
|
+
getVariants() {
|
|
475
|
+
return this.referenceStyle.getVariants().filter((v) => v !== this);
|
|
476
|
+
}
|
|
477
|
+
getImageURL() {
|
|
478
|
+
return this.imageURL;
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
class ReferenceMapStyle {
|
|
482
|
+
constructor(name, id) {
|
|
483
|
+
this.name = name;
|
|
484
|
+
this.id = id;
|
|
485
|
+
this.variants = {};
|
|
486
|
+
this.orderedVariants = [];
|
|
487
|
+
}
|
|
488
|
+
getName() {
|
|
489
|
+
return this.name;
|
|
490
|
+
}
|
|
491
|
+
getId() {
|
|
492
|
+
return this.id;
|
|
493
|
+
}
|
|
494
|
+
addVariant(v) {
|
|
495
|
+
this.variants[v.getType()] = v;
|
|
496
|
+
this.orderedVariants.push(v);
|
|
497
|
+
}
|
|
498
|
+
hasVariant(variantType) {
|
|
499
|
+
return variantType in this.variants;
|
|
500
|
+
}
|
|
501
|
+
getVariant(variantType) {
|
|
502
|
+
return variantType in this.variants ? this.variants[variantType] : this.orderedVariants[0];
|
|
503
|
+
}
|
|
504
|
+
getVariants() {
|
|
505
|
+
return Object.values(this.variants);
|
|
506
|
+
}
|
|
507
|
+
getDefaultVariant() {
|
|
508
|
+
return this.orderedVariants[0];
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
const mapStylePresetList = [
|
|
512
|
+
{
|
|
513
|
+
referenceStyleID: "STREETS",
|
|
514
|
+
name: "Streets",
|
|
515
|
+
description: "",
|
|
516
|
+
variants: [
|
|
517
|
+
{
|
|
518
|
+
id: "streets-v2",
|
|
519
|
+
name: "Default",
|
|
520
|
+
variantType: "DEFAULT",
|
|
521
|
+
description: "",
|
|
522
|
+
imageURL: ""
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
id: "streets-v2-dark",
|
|
526
|
+
name: "Dark",
|
|
527
|
+
variantType: "DARK",
|
|
528
|
+
description: "",
|
|
529
|
+
imageURL: ""
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
id: "streets-v2-light",
|
|
533
|
+
name: "Light",
|
|
534
|
+
variantType: "LIGHT",
|
|
535
|
+
description: "",
|
|
536
|
+
imageURL: ""
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
id: "streets-v2-pastel",
|
|
540
|
+
name: "Pastel",
|
|
541
|
+
variantType: "PASTEL",
|
|
542
|
+
description: "",
|
|
543
|
+
imageURL: ""
|
|
544
|
+
}
|
|
545
|
+
]
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
referenceStyleID: "OUTDOOR",
|
|
549
|
+
name: "Outdoor",
|
|
550
|
+
description: "",
|
|
551
|
+
variants: [
|
|
552
|
+
{
|
|
553
|
+
id: "outdoor-v2",
|
|
554
|
+
name: "Default",
|
|
555
|
+
variantType: "DEFAULT",
|
|
556
|
+
description: "",
|
|
557
|
+
imageURL: ""
|
|
558
|
+
}
|
|
559
|
+
]
|
|
560
|
+
},
|
|
561
|
+
{
|
|
562
|
+
referenceStyleID: "WINTER",
|
|
563
|
+
name: "Winter",
|
|
564
|
+
description: "",
|
|
565
|
+
variants: [
|
|
566
|
+
{
|
|
567
|
+
id: "winter-v2",
|
|
568
|
+
name: "Winter",
|
|
569
|
+
variantType: "DEFAULT",
|
|
570
|
+
description: "",
|
|
571
|
+
imageURL: ""
|
|
572
|
+
}
|
|
573
|
+
]
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
referenceStyleID: "SATELLITE",
|
|
577
|
+
name: "Satellite",
|
|
578
|
+
description: "",
|
|
579
|
+
variants: [
|
|
580
|
+
{
|
|
581
|
+
id: "satellite",
|
|
582
|
+
name: "Default",
|
|
583
|
+
variantType: "DEFAULT",
|
|
584
|
+
description: "",
|
|
585
|
+
imageURL: ""
|
|
586
|
+
}
|
|
587
|
+
]
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
referenceStyleID: "HYBRID",
|
|
591
|
+
name: "Hybrid",
|
|
592
|
+
description: "",
|
|
593
|
+
variants: [
|
|
594
|
+
{
|
|
595
|
+
id: "hybrid",
|
|
596
|
+
name: "Default",
|
|
597
|
+
variantType: "DEFAULT",
|
|
598
|
+
description: "",
|
|
599
|
+
imageURL: ""
|
|
600
|
+
}
|
|
601
|
+
]
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
referenceStyleID: "BASIC",
|
|
605
|
+
name: "Basic",
|
|
606
|
+
description: "",
|
|
607
|
+
variants: [
|
|
608
|
+
{
|
|
609
|
+
id: "basic-v2",
|
|
610
|
+
name: "Default",
|
|
611
|
+
variantType: "DEFAULT",
|
|
612
|
+
description: "",
|
|
613
|
+
imageURL: ""
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
id: "basic-v2-dark",
|
|
617
|
+
name: "Dark",
|
|
618
|
+
variantType: "DARK",
|
|
619
|
+
description: "",
|
|
620
|
+
imageURL: ""
|
|
621
|
+
},
|
|
622
|
+
{
|
|
623
|
+
id: "basic-v2-light",
|
|
624
|
+
name: "Light",
|
|
625
|
+
variantType: "LIGHT",
|
|
626
|
+
description: "",
|
|
627
|
+
imageURL: ""
|
|
628
|
+
}
|
|
629
|
+
]
|
|
630
|
+
},
|
|
631
|
+
{
|
|
632
|
+
referenceStyleID: "BRIGHT",
|
|
633
|
+
name: "Bright",
|
|
634
|
+
description: "",
|
|
635
|
+
variants: [
|
|
636
|
+
{
|
|
637
|
+
id: "bright-v2",
|
|
638
|
+
name: "Default",
|
|
639
|
+
variantType: "DEFAULT",
|
|
640
|
+
description: "",
|
|
641
|
+
imageURL: ""
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
id: "bright-v2-dark",
|
|
645
|
+
name: "Dark",
|
|
646
|
+
variantType: "DARK",
|
|
647
|
+
description: "",
|
|
648
|
+
imageURL: ""
|
|
649
|
+
},
|
|
650
|
+
{
|
|
651
|
+
id: "bright-v2-light",
|
|
652
|
+
name: "Light",
|
|
653
|
+
variantType: "LIGHT",
|
|
654
|
+
description: "",
|
|
655
|
+
imageURL: ""
|
|
656
|
+
},
|
|
657
|
+
{
|
|
658
|
+
id: "bright-v2-pastel",
|
|
659
|
+
name: "Pastel",
|
|
660
|
+
variantType: "PASTEL",
|
|
661
|
+
description: "",
|
|
662
|
+
imageURL: ""
|
|
663
|
+
}
|
|
664
|
+
]
|
|
665
|
+
},
|
|
666
|
+
{
|
|
667
|
+
referenceStyleID: "OPENSTREETMAP",
|
|
668
|
+
name: "OpenStreetMap",
|
|
669
|
+
description: "",
|
|
670
|
+
variants: [
|
|
671
|
+
{
|
|
672
|
+
id: "openstreetmap",
|
|
673
|
+
name: "Default",
|
|
674
|
+
variantType: "DEFAULT",
|
|
675
|
+
description: "",
|
|
676
|
+
imageURL: ""
|
|
677
|
+
}
|
|
678
|
+
]
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
referenceStyleID: "TOPO",
|
|
682
|
+
name: "Topo",
|
|
683
|
+
description: "",
|
|
684
|
+
variants: [
|
|
685
|
+
{
|
|
686
|
+
id: "topo-v2",
|
|
687
|
+
name: "Default",
|
|
688
|
+
variantType: "DEFAULT",
|
|
689
|
+
description: "",
|
|
690
|
+
imageURL: ""
|
|
691
|
+
},
|
|
692
|
+
{
|
|
693
|
+
id: "topo-v2-shiny",
|
|
694
|
+
name: "Shiny",
|
|
695
|
+
variantType: "SHINY",
|
|
696
|
+
description: "",
|
|
697
|
+
imageURL: ""
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
id: "topo-v2-pastel",
|
|
701
|
+
name: "Pastel",
|
|
702
|
+
variantType: "PASTEL",
|
|
703
|
+
description: "",
|
|
704
|
+
imageURL: ""
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
id: "topo-v2-topographique",
|
|
708
|
+
name: "Topographique",
|
|
709
|
+
variantType: "TOPOGRAPHIQUE",
|
|
710
|
+
description: "",
|
|
711
|
+
imageURL: ""
|
|
712
|
+
}
|
|
713
|
+
]
|
|
714
|
+
},
|
|
715
|
+
{
|
|
716
|
+
referenceStyleID: "VOYAGER",
|
|
717
|
+
name: "Voyager",
|
|
718
|
+
description: "",
|
|
719
|
+
variants: [
|
|
720
|
+
{
|
|
721
|
+
id: "voyager-v2",
|
|
722
|
+
name: "Default",
|
|
723
|
+
variantType: "DEFAULT",
|
|
724
|
+
description: "",
|
|
725
|
+
imageURL: ""
|
|
726
|
+
},
|
|
727
|
+
{
|
|
728
|
+
id: "voyager-v2-darkmatter",
|
|
729
|
+
name: "Darkmatter",
|
|
730
|
+
variantType: "DARK",
|
|
731
|
+
description: "",
|
|
732
|
+
imageURL: ""
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
id: "voyager-v2-positron",
|
|
736
|
+
name: "Positron",
|
|
737
|
+
variantType: "LIGHT",
|
|
738
|
+
description: "",
|
|
739
|
+
imageURL: ""
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
id: "voyager-v2-vintage",
|
|
743
|
+
name: "Vintage",
|
|
744
|
+
variantType: "VINTAGE",
|
|
745
|
+
description: "",
|
|
746
|
+
imageURL: ""
|
|
747
|
+
}
|
|
748
|
+
]
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
referenceStyleID: "TONER",
|
|
752
|
+
name: "Toner",
|
|
753
|
+
description: "",
|
|
754
|
+
variants: [
|
|
755
|
+
{
|
|
756
|
+
id: "toner-v2",
|
|
757
|
+
name: "Default",
|
|
758
|
+
variantType: "DEFAULT",
|
|
759
|
+
description: "",
|
|
760
|
+
imageURL: ""
|
|
761
|
+
},
|
|
762
|
+
{
|
|
763
|
+
id: "toner-v2-background",
|
|
764
|
+
name: "Background",
|
|
765
|
+
variantType: "BACKGROUND",
|
|
766
|
+
description: "",
|
|
767
|
+
imageURL: ""
|
|
768
|
+
},
|
|
769
|
+
{
|
|
770
|
+
id: "toner-v2-lite",
|
|
771
|
+
name: "Lite",
|
|
772
|
+
variantType: "LITE",
|
|
773
|
+
description: "",
|
|
774
|
+
imageURL: ""
|
|
775
|
+
},
|
|
776
|
+
{
|
|
777
|
+
id: "toner-v2-lines",
|
|
778
|
+
name: "Lines",
|
|
779
|
+
variantType: "LINES",
|
|
780
|
+
description: "",
|
|
781
|
+
imageURL: ""
|
|
782
|
+
}
|
|
783
|
+
]
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
referenceStyleID: "STAGE",
|
|
787
|
+
name: "Stage",
|
|
788
|
+
description: "",
|
|
789
|
+
variants: [
|
|
790
|
+
{
|
|
791
|
+
id: "stage",
|
|
792
|
+
name: "Default",
|
|
793
|
+
variantType: "DEFAULT",
|
|
794
|
+
description: "",
|
|
795
|
+
imageURL: ""
|
|
796
|
+
},
|
|
797
|
+
{
|
|
798
|
+
id: "stage-dark",
|
|
799
|
+
name: "Dark",
|
|
800
|
+
variantType: "DARK",
|
|
801
|
+
description: "",
|
|
802
|
+
imageURL: ""
|
|
803
|
+
},
|
|
804
|
+
{
|
|
805
|
+
id: "stage-light",
|
|
806
|
+
name: "Light",
|
|
807
|
+
variantType: "LIGHT",
|
|
808
|
+
description: "",
|
|
809
|
+
imageURL: ""
|
|
810
|
+
}
|
|
811
|
+
]
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
referenceStyleID: "OCEAN",
|
|
815
|
+
name: "Ocean",
|
|
816
|
+
description: "",
|
|
817
|
+
variants: [
|
|
818
|
+
{
|
|
819
|
+
id: "ocean",
|
|
820
|
+
name: "Default",
|
|
821
|
+
variantType: "DEFAULT",
|
|
822
|
+
description: "",
|
|
823
|
+
imageURL: ""
|
|
824
|
+
}
|
|
825
|
+
]
|
|
826
|
+
}
|
|
827
|
+
];
|
|
828
|
+
function makeReferenceStyleProxy(referenceStyle) {
|
|
829
|
+
return new Proxy(referenceStyle, {
|
|
830
|
+
get(target, prop, receiver) {
|
|
831
|
+
if (target.hasVariant(prop)) {
|
|
832
|
+
return target.getVariant(prop);
|
|
833
|
+
}
|
|
834
|
+
if (prop.toString().toUpperCase() === prop) {
|
|
835
|
+
return referenceStyle.getDefaultVariant();
|
|
836
|
+
}
|
|
837
|
+
return Reflect.get(target, prop, receiver);
|
|
838
|
+
}
|
|
839
|
+
});
|
|
840
|
+
}
|
|
841
|
+
function buildMapStyles() {
|
|
842
|
+
const mapStyle = {};
|
|
843
|
+
for (let i = 0; i < mapStylePresetList.length; i += 1) {
|
|
844
|
+
const refStyleInfo = mapStylePresetList[i];
|
|
845
|
+
const refStyle = makeReferenceStyleProxy(
|
|
846
|
+
new ReferenceMapStyle(refStyleInfo.name, refStyleInfo.referenceStyleID)
|
|
847
|
+
);
|
|
848
|
+
for (let j = 0; j < refStyleInfo.variants.length; j += 1) {
|
|
849
|
+
const variantInfo = refStyleInfo.variants[j];
|
|
850
|
+
const variant = new MapStyleVariant(
|
|
851
|
+
variantInfo.name,
|
|
852
|
+
variantInfo.variantType,
|
|
853
|
+
variantInfo.id,
|
|
854
|
+
refStyle,
|
|
855
|
+
variantInfo.description,
|
|
856
|
+
variantInfo.imageURL
|
|
857
|
+
);
|
|
858
|
+
refStyle.addVariant(variant);
|
|
859
|
+
}
|
|
860
|
+
mapStyle[refStyleInfo.referenceStyleID] = refStyle;
|
|
861
|
+
}
|
|
862
|
+
return mapStyle;
|
|
863
|
+
}
|
|
864
|
+
function styleToStyle(style) {
|
|
865
|
+
if (!style) {
|
|
866
|
+
return MapStyle[mapStylePresetList[0].referenceStyleID].getDefaultVariant().getId();
|
|
867
|
+
}
|
|
868
|
+
if (typeof style === "string" || style instanceof String) {
|
|
869
|
+
return style.trim().toLowerCase();
|
|
870
|
+
}
|
|
871
|
+
if (style instanceof MapStyleVariant) {
|
|
872
|
+
return style.getId();
|
|
873
|
+
}
|
|
874
|
+
if (style instanceof ReferenceMapStyle) {
|
|
875
|
+
return style.getDefaultVariant().getId();
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
const MapStyle = buildMapStyles();
|
|
879
|
+
|
|
441
880
|
function getSqSegDist(p, p1, p2) {
|
|
442
881
|
let x = p1[0], y = p1[1], dx = p2[0] - x, dy = p2[1] - y;
|
|
443
882
|
if (dx !== 0 || dy !== 0) {
|
|
@@ -508,12 +947,12 @@ function simplifyAndStringify(path, maxNbChar = 3e3) {
|
|
|
508
947
|
return str;
|
|
509
948
|
}
|
|
510
949
|
function centered(center, zoom, options = {}) {
|
|
511
|
-
var _a, _b, _c, _d, _e
|
|
512
|
-
const style = (
|
|
950
|
+
var _a, _b, _c, _d, _e;
|
|
951
|
+
const style = styleToStyle(options.style);
|
|
513
952
|
const scale = options.hiDPI ? "@2x" : "";
|
|
514
|
-
const format = (
|
|
515
|
-
let width = ~~((
|
|
516
|
-
let height = ~~((
|
|
953
|
+
const format = (_a = options.format) != null ? _a : "png";
|
|
954
|
+
let width = ~~((_b = options.width) != null ? _b : 1024);
|
|
955
|
+
let height = ~~((_c = options.height) != null ? _c : 1024);
|
|
517
956
|
if (options.hiDPI) {
|
|
518
957
|
width = ~~(width / 2);
|
|
519
958
|
height = ~~(height / 2);
|
|
@@ -543,7 +982,7 @@ function centered(center, zoom, options = {}) {
|
|
|
543
982
|
}
|
|
544
983
|
if ("path" in options) {
|
|
545
984
|
let pathStr = "";
|
|
546
|
-
pathStr += `fill:${(
|
|
985
|
+
pathStr += `fill:${(_d = options.pathFillColor) != null ? _d : "none"}|`;
|
|
547
986
|
if ("pathStrokeColor" in options) {
|
|
548
987
|
pathStr += `stroke:${options.pathStrokeColor}|`;
|
|
549
988
|
}
|
|
@@ -554,16 +993,16 @@ function centered(center, zoom, options = {}) {
|
|
|
554
993
|
pathStr += simplifyAndStringify(options.path);
|
|
555
994
|
endpoint.searchParams.set("path", pathStr);
|
|
556
995
|
}
|
|
557
|
-
endpoint.searchParams.set("key", (
|
|
996
|
+
endpoint.searchParams.set("key", (_e = options.apiKey) != null ? _e : config.apiKey);
|
|
558
997
|
return endpoint.toString();
|
|
559
998
|
}
|
|
560
999
|
function bounded(boundingBox, options = {}) {
|
|
561
|
-
var _a, _b, _c, _d, _e
|
|
562
|
-
const style = (
|
|
1000
|
+
var _a, _b, _c, _d, _e;
|
|
1001
|
+
const style = styleToStyle(options.style);
|
|
563
1002
|
const scale = options.hiDPI ? "@2x" : "";
|
|
564
|
-
const format = (
|
|
565
|
-
let width = ~~((
|
|
566
|
-
let height = ~~((
|
|
1003
|
+
const format = (_a = options.format) != null ? _a : "png";
|
|
1004
|
+
let width = ~~((_b = options.width) != null ? _b : 1024);
|
|
1005
|
+
let height = ~~((_c = options.height) != null ? _c : 1024);
|
|
567
1006
|
if (options.hiDPI) {
|
|
568
1007
|
width = ~~(width / 2);
|
|
569
1008
|
height = ~~(height / 2);
|
|
@@ -596,7 +1035,7 @@ function bounded(boundingBox, options = {}) {
|
|
|
596
1035
|
}
|
|
597
1036
|
if ("path" in options) {
|
|
598
1037
|
let pathStr = "";
|
|
599
|
-
pathStr += `fill:${(
|
|
1038
|
+
pathStr += `fill:${(_d = options.pathFillColor) != null ? _d : "none"}|`;
|
|
600
1039
|
if ("pathStrokeColor" in options) {
|
|
601
1040
|
pathStr += `stroke:${options.pathStrokeColor}|`;
|
|
602
1041
|
}
|
|
@@ -607,21 +1046,21 @@ function bounded(boundingBox, options = {}) {
|
|
|
607
1046
|
pathStr += simplifyAndStringify(options.path);
|
|
608
1047
|
endpoint.searchParams.set("path", pathStr);
|
|
609
1048
|
}
|
|
610
|
-
endpoint.searchParams.set("key", (
|
|
1049
|
+
endpoint.searchParams.set("key", (_e = options.apiKey) != null ? _e : config.apiKey);
|
|
611
1050
|
return endpoint.toString();
|
|
612
1051
|
}
|
|
613
1052
|
function automatic(options = {}) {
|
|
614
|
-
var _a, _b, _c, _d, _e
|
|
1053
|
+
var _a, _b, _c, _d, _e;
|
|
615
1054
|
if (!("markers" in options) && !("path" in options)) {
|
|
616
1055
|
throw new Error(
|
|
617
1056
|
"Automatic static maps require markers and/or path to be created."
|
|
618
1057
|
);
|
|
619
1058
|
}
|
|
620
|
-
const style = (
|
|
1059
|
+
const style = styleToStyle(options.style);
|
|
621
1060
|
const scale = options.hiDPI ? "@2x" : "";
|
|
622
|
-
const format = (
|
|
623
|
-
let width = ~~((
|
|
624
|
-
let height = ~~((
|
|
1061
|
+
const format = (_a = options.format) != null ? _a : "png";
|
|
1062
|
+
let width = ~~((_b = options.width) != null ? _b : 1024);
|
|
1063
|
+
let height = ~~((_c = options.height) != null ? _c : 1024);
|
|
625
1064
|
if (options.hiDPI) {
|
|
626
1065
|
width = ~~(width / 2);
|
|
627
1066
|
height = ~~(height / 2);
|
|
@@ -656,7 +1095,7 @@ function automatic(options = {}) {
|
|
|
656
1095
|
}
|
|
657
1096
|
if ("path" in options) {
|
|
658
1097
|
let pathStr = "";
|
|
659
|
-
pathStr += `fill:${(
|
|
1098
|
+
pathStr += `fill:${(_d = options.pathFillColor) != null ? _d : "none"}|`;
|
|
660
1099
|
if ("pathStrokeColor" in options) {
|
|
661
1100
|
pathStr += `stroke:${options.pathStrokeColor}|`;
|
|
662
1101
|
}
|
|
@@ -667,7 +1106,7 @@ function automatic(options = {}) {
|
|
|
667
1106
|
pathStr += simplifyAndStringify(options.path);
|
|
668
1107
|
endpoint.searchParams.set("path", pathStr);
|
|
669
1108
|
}
|
|
670
|
-
endpoint.searchParams.set("key", (
|
|
1109
|
+
endpoint.searchParams.set("key", (_e = options.apiKey) != null ? _e : config.apiKey);
|
|
671
1110
|
return endpoint.toString();
|
|
672
1111
|
}
|
|
673
1112
|
const staticMaps = {
|
|
@@ -676,5 +1115,5 @@ const staticMaps = {
|
|
|
676
1115
|
automatic
|
|
677
1116
|
};
|
|
678
1117
|
|
|
679
|
-
export { ClientConfig, LanguageGeocoding, ServiceError, config, coordinates, data, geocoding, geolocation, staticMaps };
|
|
1118
|
+
export { ClientConfig, LanguageGeocoding, MapStyle, MapStyleVariant, ReferenceMapStyle, ServiceError, config, coordinates, data, geocoding, geolocation, mapStylePresetList, staticMaps, styleToStyle };
|
|
680
1119
|
//# sourceMappingURL=maptiler-client.mjs.map
|