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