@maptiler/client 1.6.0 → 1.7.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 (118) hide show
  1. package/dist/maptiler-client.cjs +482 -309
  2. package/dist/maptiler-client.cjs.map +1 -1
  3. package/dist/maptiler-client.d.ts +114 -5
  4. package/dist/maptiler-client.min.mjs +1 -1
  5. package/dist/maptiler-client.mjs +471 -309
  6. package/dist/maptiler-client.mjs.map +1 -1
  7. package/dist/maptiler-client.umd.js +483 -310
  8. package/dist/maptiler-client.umd.js.map +1 -1
  9. package/dist/maptiler-client.umd.min.js +1 -1
  10. package/package.json +25 -18
  11. package/readme.md +1 -1
  12. package/rollup.config.js +3 -3
  13. package/src/callFetch.ts +2 -2
  14. package/src/config.ts +4 -1
  15. package/src/demProfiler/getElevation.ts +46 -0
  16. package/src/demProfiler/index.ts +240 -0
  17. package/src/demProfiler/tileCover.ts +96 -0
  18. package/src/geometry/area.ts +96 -0
  19. package/src/geometry/distance.ts +45 -0
  20. package/src/geometry/index.ts +3 -0
  21. package/src/geometry/util.ts +34 -0
  22. package/src/index.ts +3 -0
  23. package/src/language.ts +1 -1
  24. package/src/mapstyle.ts +5 -5
  25. package/src/services/ServiceError.ts +5 -2
  26. package/src/services/coordinates.ts +14 -9
  27. package/src/services/data.ts +3 -3
  28. package/src/services/geocoding.ts +17 -14
  29. package/src/services/geolocation.ts +2 -2
  30. package/src/services/simplify.ts +3 -3
  31. package/src/services/staticMaps.ts +9 -9
  32. package/tsconfig.json +1 -1
  33. package/docs/.nojekyll +0 -1
  34. package/docs/assets/custom.css +0 -118
  35. package/docs/assets/highlight.css +0 -85
  36. package/docs/assets/main.js +0 -58
  37. package/docs/assets/search.js +0 -1
  38. package/docs/assets/style.css +0 -1280
  39. package/docs/classes/config.ClientConfig.html +0 -132
  40. package/docs/classes/services_ServiceError.ServiceError.html +0 -103
  41. package/docs/functions/language.getAutoLanguageGeocoding.html +0 -60
  42. package/docs/functions/services_simplify.default.html +0 -65
  43. package/docs/images/JS-logo.svg +0 -4
  44. package/docs/images/TS-logo.svg +0 -6
  45. package/docs/images/maptiler-client-logo.afdesign +0 -0
  46. package/docs/images/maptiler-client-logo.svg +0 -75
  47. package/docs/images/maptiler-logo-256.png +0 -0
  48. package/docs/images/maptiler-logo.svg +0 -23
  49. package/docs/images/screenshots/static-bounded-europe-1024.png +0 -0
  50. package/docs/images/screenshots/static-bounded-europe-2048.png +0 -0
  51. package/docs/images/screenshots/static-bounded-portugal-1024x2048.png +0 -0
  52. package/docs/images/screenshots/static-bounded-portugal-2048x2048.png +0 -0
  53. package/docs/images/screenshots/static-with-path.png +0 -0
  54. package/docs/index.html +0 -340
  55. package/docs/modules/config.html +0 -71
  56. package/docs/modules/language.html +0 -71
  57. package/docs/modules/services_ServiceError.html +0 -61
  58. package/docs/modules/services_coordinates.html +0 -84
  59. package/docs/modules/services_data.html +0 -66
  60. package/docs/modules/services_geocoding.html +0 -82
  61. package/docs/modules/services_geolocation.html +0 -68
  62. package/docs/modules/services_simplify.html +0 -61
  63. package/docs/modules/services_staticMaps.html +0 -74
  64. package/docs/modules.html +0 -59
  65. package/docs/types/config.FetchFunction.html +0 -71
  66. package/docs/types/language.LanguageGeocodingString.html +0 -58
  67. package/docs/types/services_coordinates.CoordinateExport.html +0 -71
  68. package/docs/types/services_coordinates.CoordinateGrid.html +0 -69
  69. package/docs/types/services_coordinates.CoordinateId.html +0 -71
  70. package/docs/types/services_coordinates.CoordinateSearch.html +0 -93
  71. package/docs/types/services_coordinates.CoordinateSearchResult.html +0 -75
  72. package/docs/types/services_coordinates.CoordinateTransformResult.html +0 -76
  73. package/docs/types/services_coordinates.CoordinateTransformation.html +0 -89
  74. package/docs/types/services_coordinates.CoordinatesSearchOptions.html +0 -83
  75. package/docs/types/services_coordinates.CoordinatesTransformOptions.html +0 -85
  76. package/docs/types/services_coordinates.XYZ.html +0 -73
  77. package/docs/types/services_data.GetDataOptions.html +0 -64
  78. package/docs/types/services_geocoding.ByIdGeocodingOptions.html +0 -63
  79. package/docs/types/services_geocoding.CommonForwardAndReverseGeocodingOptions.html +0 -63
  80. package/docs/types/services_geocoding.Coordinates.html +0 -63
  81. package/docs/types/services_geocoding.FeatureHierarchy.html +0 -63
  82. package/docs/types/services_geocoding.GeocodingFeature.html +0 -63
  83. package/docs/types/services_geocoding.GeocodingOptions.html +0 -63
  84. package/docs/types/services_geocoding.GeocodingSearchResult.html +0 -80
  85. package/docs/types/services_geocoding.LanguageGeocodingOptions.html +0 -70
  86. package/docs/types/services_geocoding.ReverseGeocodingOptions.html +0 -63
  87. package/docs/types/services_geolocation.GeolocationInfoOptions.html +0 -65
  88. package/docs/types/services_geolocation.GeolocationResult.html +0 -128
  89. package/docs/types/services_staticMaps.AutomaticStaticMapOptions.html +0 -61
  90. package/docs/types/services_staticMaps.BoundedStaticMapOptions.html +0 -61
  91. package/docs/types/services_staticMaps.CenteredStaticMapOptions.html +0 -61
  92. package/docs/types/services_staticMaps.StaticMapBaseOptions.html +0 -157
  93. package/docs/types/services_staticMaps.StaticMapMarker.html +0 -61
  94. package/docs/variables/config.config.html +0 -58
  95. package/docs/variables/language.LanguageGeocoding.html +0 -171
  96. package/docs/variables/services_coordinates.coordinates.html +0 -110
  97. package/docs/variables/services_data.data.html +0 -80
  98. package/docs/variables/services_geocoding.geocoding.html +0 -265
  99. package/docs/variables/services_geolocation.geolocation.html +0 -79
  100. package/docs/variables/services_staticMaps.staticMaps.html +0 -128
  101. package/docsmd/.nojekyll +0 -1
  102. package/docsmd/README.md +0 -873
  103. package/docsmd/assets/custom.css +0 -118
  104. package/docsmd/classes/ClientConfig.md +0 -90
  105. package/docsmd/classes/MapStyleVariant.md +0 -234
  106. package/docsmd/classes/ReferenceMapStyle.md +0 -169
  107. package/docsmd/classes/ServiceError.md +0 -52
  108. package/images/JS-logo.svg +0 -4
  109. package/images/TS-logo.svg +0 -6
  110. package/images/maptiler-client-logo.afdesign +0 -0
  111. package/images/maptiler-client-logo.svg +0 -75
  112. package/images/maptiler-logo-256.png +0 -0
  113. package/images/maptiler-logo.svg +0 -23
  114. package/images/screenshots/static-bounded-europe-1024.png +0 -0
  115. package/images/screenshots/static-bounded-europe-2048.png +0 -0
  116. package/images/screenshots/static-bounded-portugal-1024x2048.png +0 -0
  117. package/images/screenshots/static-bounded-portugal-2048x2048.png +0 -0
  118. package/images/screenshots/static-with-path.png +0 -0
@@ -1,23 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
3
- <svg width="100%" height="100%" viewBox="0 0 161 41" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" xmlns:serif="http://www.serif.com/" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;">
4
- <g transform="matrix(1,0,0,1,-1.20801,-0.711928)">
5
- <path d="M11.965,33.743C14.023,35.769 19.5,41.264 19.497,41.269C19.477,41.305 24.938,35.908 27.113,33.768L19.526,26.3L11.965,33.743Z" style="fill:rgb(58,24,136);fill-rule:nonzero;"/>
6
- <path d="M19.526,26.3L27.113,33.768C27.124,33.756 27.138,33.741 27.15,33.731L34.73,26.27L27.143,18.802L19.526,26.3Z" style="fill:rgb(3,161,196);fill-rule:nonzero;"/>
7
- <path d="M34.73,26.27L34.749,26.25C38.942,22.123 38.945,15.435 34.762,11.302L27.144,18.802L34.73,26.27Z" style="fill:rgb(5,208,223);fill-rule:nonzero;"/>
8
- <path d="M11.908,18.802L4.349,26.243C4.351,26.245 4.352,26.248 4.355,26.25L11.953,33.73C11.957,33.734 11.961,33.738 11.966,33.743L19.526,26.3L11.908,18.802Z" style="fill:rgb(118,31,232);fill-rule:nonzero;"/>
9
- <path d="M19.526,11.303L27.143,18.802L34.762,11.303C34.755,11.298 34.753,11.295 34.749,11.29L27.15,3.81C27.149,3.808 27.146,3.806 27.144,3.804L19.526,11.303Z" style="fill:rgb(255,170,1);fill-rule:nonzero;"/>
10
- <path d="M4.317,11.328C0.161,15.46 0.172,22.124 4.349,26.243L11.908,18.802L4.317,11.328Z" style="fill:rgb(241,23,93);fill-rule:nonzero;"/>
11
- <path d="M19.526,11.303L11.934,3.829L4.355,11.29C4.341,11.303 4.33,11.317 4.316,11.329L11.908,18.802L19.526,11.303Z" style="fill:rgb(251,58,27);fill-rule:nonzero;"/>
12
- <path d="M27.144,3.804C22.946,-0.321 16.148,-0.319 11.953,3.81L11.934,3.829L19.526,11.303L27.144,3.804Z" style="fill:rgb(251,201,53);fill-rule:nonzero;"/>
13
- <path d="M58.567,28.139L58.567,20.497C58.567,18.616 57.566,16.908 55.595,16.908C53.654,16.908 52.508,18.616 52.508,20.497L52.508,28.139L48.922,28.139L48.922,13.84L52.244,13.84L52.508,15.578C53.273,14.129 54.949,13.609 56.33,13.609C58.066,13.609 59.8,14.304 60.624,16.271C61.918,14.245 63.595,13.667 65.476,13.667C69.593,13.667 71.622,16.155 71.622,20.44L71.622,28.139L68.034,28.139L68.034,20.44C68.034,18.559 67.24,16.966 65.301,16.966C63.359,16.966 62.153,18.616 62.153,20.497L62.153,28.139L58.567,28.139Z" style="fill-rule:nonzero;"/>
14
- <path d="M86.765,13.87L90.206,13.87L90.206,28.139L86.824,28.139L86.647,26.056C85.825,27.734 83.561,28.543 81.943,28.573C77.651,28.603 74.474,25.997 74.474,20.989C74.474,16.069 77.798,13.493 82.033,13.522C83.973,13.522 85.824,14.419 86.647,15.838L86.765,13.87ZM78.062,20.989C78.062,23.71 79.973,25.331 82.355,25.331C88,25.331 88,16.677 82.355,16.677C79.973,16.677 78.062,18.269 78.062,20.989Z" style="fill-rule:nonzero;"/>
15
- <path d="M93.236,34.105L93.236,13.87L96.589,13.87L96.822,15.838C97.94,14.245 99.882,13.551 101.528,13.551C105.996,13.551 108.968,16.822 108.968,21.019C108.968,25.187 106.291,28.487 101.645,28.487C100.118,28.487 97.852,28.023 96.822,26.461L96.822,34.104L93.236,34.104L93.236,34.105ZM105.381,21.019C105.381,18.791 103.851,16.966 101.264,16.966C98.676,16.966 97.146,18.791 97.146,21.019C97.146,23.247 98.823,25.073 101.264,25.073C103.705,25.073 105.381,23.247 105.381,21.019Z" style="fill-rule:nonzero;"/>
16
- <path d="M115.378,9.528L115.378,13.84L120.319,13.84L120.319,15.026L115.378,15.026L115.378,23.739C115.378,25.679 115.791,27.04 118.055,27.04C118.76,27.04 119.554,26.808 120.289,26.461L120.789,27.617C119.877,28.054 118.965,28.342 118.055,28.342C114.968,28.342 113.967,26.547 113.967,23.74L113.967,15.027L110.879,15.027L110.879,13.84L113.967,13.84L113.967,9.672L115.378,9.528Z" style="fill-rule:nonzero;"/>
17
- <path d="M125.554,9.18C125.554,10.685 123.23,10.685 123.23,9.18C123.23,7.675 125.554,7.675 125.554,9.18ZM123.643,13.782L123.643,28.14L125.082,28.14L125.082,13.782L123.643,13.782Z" style="fill-rule:nonzero;"/>
18
- <rect x="129.199" y="7.878" width="1.441" height="20.261" style="fill-rule:nonzero;"/>
19
- <path d="M153.488,13.84L153.547,16.389C154.459,14.448 156.518,13.696 158.37,13.696C159.459,13.667 160.515,13.956 161.486,14.536L160.839,15.693C160.076,15.23 159.221,15.027 158.37,15.027C155.663,15.057 153.576,17.198 153.576,19.804L153.576,28.14L152.135,28.14L152.135,13.84L153.488,13.84Z" style="fill-rule:nonzero;"/>
20
- <path d="M135.54,23.414C135.541,23.415 135.543,23.417 135.543,23.418L147.303,20.354C147.302,20.349 147.302,20.345 147.302,20.341L135.54,23.414Z" style="fill-rule:nonzero;"/>
21
- <path d="M141.214,27.28C138.654,27.28 136.461,25.701 135.543,23.458L135.535,23.458L135.542,23.457C135.542,23.456 135.541,23.455 135.54,23.454L147.301,20.38C147.301,20.385 147.302,20.389 147.302,20.394L148.555,20.068C148.049,16.446 144.956,13.658 141.214,13.658C137.12,13.658 133.802,16.996 133.802,21.113C133.802,25.23 137.12,28.569 141.214,28.569C144.276,28.569 146.905,26.7 148.035,24.037L146.855,23.532C145.921,25.734 143.747,27.28 141.214,27.28ZM135.083,21.113C135.083,17.708 137.828,14.946 141.214,14.946C143.862,14.946 146.117,16.634 146.976,18.999L135.16,22.085C135.11,21.768 135.083,21.444 135.083,21.113Z" style="fill-rule:nonzero;"/>
22
- </g>
23
- </svg>
package/docs/index.html DELETED
@@ -1,340 +0,0 @@
1
- <!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>MapTiler Client - v1.6.0</title><meta name="description" content="Documentation for MapTiler Client - v1.6.0"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="assets/style.css"/><link rel="stylesheet" href="assets/highlight.css"/><link rel="stylesheet" href="assets/custom.css"/><script async src="assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
2
- <div class="tsd-toolbar-contents container">
3
- <div class="table-cell" id="tsd-search" data-base=".">
4
- <div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
5
- <div class="field">
6
- <div id="tsd-toolbar-links"></div></div>
7
- <ul class="results">
8
- <li class="state loading">Preparing search index...</li>
9
- <li class="state failure">The search index is not available</li></ul><a href="index.html" class="title">MapTiler Client - v1.6.0</a></div>
10
- <div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
11
- <div class="container container-main">
12
- <div class="col-8 col-content">
13
- <div class="tsd-page-title">
14
- <h2>MapTiler Client - v1.6.0</h2></div>
15
- <div class="tsd-panel tsd-typography"><p align="center">
16
- <a href="https://docs.maptiler.com/client-js/">offcial page →</a><br>
17
- <img src="images/maptiler-client-logo.svg" width="400px">
18
- </p>
19
-
20
- <p align="center" style="color: #AAA">
21
- The Javascript & TypeScript API client library to enjoy <a href="https://www.maptiler.com/cloud/">MapTiler Cloud</a>'s <br>services such as geocoding, geolocation and more!
22
- </p>
23
-
24
- <p align="center">
25
- <img src="images/JS-logo.svg" width="20px">
26
- <img src="images/TS-logo.svg" width="20px">
27
- <img src="https://img.shields.io/npm/v/@maptiler/client"></img>
28
- <img src="https://img.shields.io/twitter/follow/maptiler?style=social"></img>
29
- </p>
30
-
31
-
32
- <a href="#api-client-library-for-javascript--typescript" id="api-client-library-for-javascript--typescript" style="color: inherit; text-decoration: none;">
33
- <h1>API Client Library for JavaScript / TypeScript</h1>
34
- </a>
35
-
36
- <a href="#what" id="what" style="color: inherit; text-decoration: none;">
37
- <h2>What?</h2>
38
- </a>
39
- <p>The <strong>MapTiler Client JS</strong> exposes a number of handy functions that wrap API call to <a href="https://docs.maptiler.com/cloud/api">MapTiler Cloud API services</a>, such as:</p>
40
- <ul>
41
- <li><a href="#-geocoding">Geocoding forward and reverse</a></li>
42
- <li><a href="#%EF%B8%8F%EF%B8%8F-geolocation">Geolocation from visitor&#39;s IP address</a></li>
43
- <li><a href="#-coordinates">Coordidinate systems search and tranform</a></li>
44
- <li><a href="#-data">User data fetching as GeoJSON</a></li>
45
- <li><a href="#%EF%B8%8F-static-maps">Static maps of all sorts</a></li>
46
- </ul>
47
-
48
- <a href="#why" id="why" style="color: inherit; text-decoration: none;">
49
- <h2>Why?</h2>
50
- </a>
51
- <p>The project is entirely written in TypeScript and all the function arguments are nicely documented and typed.</p>
52
- <ul>
53
- <li>Better developer experience of working with APIs in the code editor - with parameter info, quick info, and member lists.<ul>
54
- <li>Code completion: reducing typos and other common mistakes</li>
55
- <li>Content assist and code hinting providing contextual help</li>
56
- </ul>
57
- </li>
58
- <li>Type safety - for higher quality code and testing</li>
59
- <li>Backward compatibility: guaranteed on changes to API endpoints</li>
60
- <li>Runs: in Node.js or in browser</li>
61
- <li>Open source license</li>
62
- </ul>
63
-
64
- <a href="#install" id="install" style="color: inherit; text-decoration: none;">
65
- <h1>Install</h1>
66
- </a>
67
- <pre><code class="language-shell"><span class="hl-0">npm </span><span class="hl-1">install</span><span class="hl-0"> </span><span class="hl-1">--save</span><span class="hl-0"> </span><span class="hl-1">@maptiler/client</span>
68
- </code></pre>
69
-
70
- <a href="#api-documentation" id="api-documentation" style="color: inherit; text-decoration: none;">
71
- <h1>API documentation</h1>
72
- </a>
73
- <p>In addition to the details and examples provided in this readme, check out the <a href="https://maptiler.github.io/maptiler-client-js">complete API documentation</a>.</p>
74
-
75
- <a href="#quick-start" id="quick-start" style="color: inherit; text-decoration: none;">
76
- <h1>Quick start</h1>
77
- </a>
78
- <pre><code class="language-ts"><span class="hl-2">// Import the whole library</span><br/><span class="hl-3">import</span><span class="hl-0"> </span><span class="hl-4">*</span><span class="hl-0"> </span><span class="hl-3">as</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0"> </span><span class="hl-3">from</span><span class="hl-0"> </span><span class="hl-1">&#39;@maptiler/client&#39;</span><span class="hl-0">;</span><br/><br/><span class="hl-2">// Or import only the bits you need</span><br/><span class="hl-3">import</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-5">config</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-5">geocoding</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-5">geolocation</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-5">coordinates</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-5">data</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-5">staticMaps</span><span class="hl-0">,</span><br/><span class="hl-0">} </span><span class="hl-3">from</span><span class="hl-0"> </span><span class="hl-1">&#39;@maptiler/client&#39;</span><span class="hl-0">;</span>
79
- </code></pre>
80
- <p>The <a href="examples/">examples</a> folder includes are featuring usages for <strong>NodeJS</strong>, <strong>browser with UMD</strong> and <strong>browser with ES module</strong>.</p>
81
-
82
- <a href="#easy-access-to-maptiler-cloud-api" id="easy-access-to-maptiler-cloud-api" style="color: inherit; text-decoration: none;">
83
- <h1>Easy access to MapTiler Cloud API</h1>
84
- </a>
85
- <p>Here is the list of service wrapper functions that are built-in:</p>
86
-
87
- <a href="#🔍-geocoding" id="🔍-geocoding" style="color: inherit; text-decoration: none;">
88
- <h2>🔍 Geocoding</h2>
89
- </a>
90
- <blockquote>
91
- <p>✅ Please, use geocoding functions only from client-side (browser) and do not 🚫 <strong>store</strong> or <strong>redistribute</strong> MapTiler Cloud API data. In case of doubt, consult the <a href="https://www.maptiler.com/cloud/terms/#explicitly-prohibited-use">terms</a> ⚖️</p>
92
- </blockquote>
93
-
94
- <a href="#forward" id="forward" style="color: inherit; text-decoration: none;">
95
- <h3>Forward</h3>
96
- </a>
97
- <p>You want to know the longitude and latitude of a specific place, use the forward geocoding:</p>
98
- <pre><code class="language-ts"><span class="hl-2">// in an async function, or as a &#39;thenable&#39;:</span><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">result</span><span class="hl-0"> = </span><span class="hl-3">await</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">geocoding</span><span class="hl-0">.</span><span class="hl-7">forward</span><span class="hl-0">(</span><span class="hl-1">&#39;paris&#39;</span><span class="hl-0">);</span>
99
- </code></pre>
100
- <p>You can provide some options such as:</p>
101
- <ul>
102
- <li>the proximity, given a lon-lat position, to sort the results</li>
103
- <li>one of more languages to get the results into</li>
104
- <li>a bounding geo box, to restrict the search to a given window</li>
105
- </ul>
106
- <p>Read more about forward geocoding as well as feature ID query and batch forward geocoding on our <a href="https://docs.maptiler.com/client-js/geocoding/#forward">official documentation</a>.</p>
107
-
108
- <a href="#reverse" id="reverse" style="color: inherit; text-decoration: none;">
109
- <h3>Reverse</h3>
110
- </a>
111
- <p>You wan to tknow the name of a place, given a longitude-latitude? Use the reverse geocoding:</p>
112
- <pre><code class="language-ts"><span class="hl-2">// in an async function, or as a &#39;thenable&#39;:</span><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">result</span><span class="hl-0"> = </span><span class="hl-3">await</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">geocoding</span><span class="hl-0">.</span><span class="hl-7">reverse</span><span class="hl-0">([</span><span class="hl-8">6.249638</span><span class="hl-0">, </span><span class="hl-8">46.402056</span><span class="hl-0">]);</span>
113
- </code></pre>
114
- <p>The same option object as the forward geocoding can be provided.</p>
115
- <p>Read more about reverse geocoding on our <a href="https://docs.maptiler.com/client-js/geocoding/#reverse">official documentation</a>.</p>
116
-
117
- <a href="#language" id="language" style="color: inherit; text-decoration: none;">
118
- <h3>Language</h3>
119
- </a>
120
- <p>For both <em>forward</em> and <em>reverse</em> geocoding, this library provides a list of supported languages as shorthands to <a href="https://en.wikipedia.org/wiki/ISO_639-1">ISO language codes</a>. The result will be provided in multiple languages if the <code>language</code> options is an array:</p>
121
- <pre><code class="language-ts"><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">result</span><span class="hl-0"> = </span><span class="hl-3">await</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">geocoding</span><span class="hl-0">.</span><span class="hl-7">forward</span><span class="hl-0">(</span><span class="hl-1">&#39;paris&#39;</span><span class="hl-0">, {</span><span class="hl-5">language:</span><span class="hl-0"> [</span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">geocoding</span><span class="hl-0">.</span><span class="hl-5">languages</span><span class="hl-0">.</span><span class="hl-6">SPANISH</span><span class="hl-0">, </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">geocoding</span><span class="hl-0">.</span><span class="hl-5">languages</span><span class="hl-0">.</span><span class="hl-6">KOREAN</span><span class="hl-0">]})</span>
122
- </code></pre>
123
- <p>The special language <code>AUTO</code> will detect the platform/browser preferred language.</p>
124
-
125
- <a href="#🕵️♂️-geolocation" id="🕵️♂️-geolocation" style="color: inherit; text-decoration: none;">
126
- <h2>🕵️‍♂️ Geolocation</h2>
127
- </a>
128
- <p>The geolocation service provides location informations of a visitor using its IP address.</p>
129
- <p>The geolocation uses the IP address of a visitors to provide informations about their location, such as city, region, country, timezone, etc. The precision is lower than GPS but does not require visitors to explicitely enable the location service from their web browser.</p>
130
- <p>There is only a single function:</p>
131
- <pre><code class="language-ts"><span class="hl-2">// in an async function, or as a &#39;thenable&#39;:</span><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">result</span><span class="hl-0"> = </span><span class="hl-3">await</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">geolocation</span><span class="hl-0">.</span><span class="hl-7">info</span><span class="hl-0">();</span>
132
- </code></pre>
133
- <p>Read more about geolocation on our <a href="https://docs.maptiler.com/client-js/geolocation/">official documentation</a>.</p>
134
-
135
- <a href="#🌐-coordinates" id="🌐-coordinates" style="color: inherit; text-decoration: none;">
136
- <h2>🌐 Coordinates</h2>
137
- </a>
138
- <p>If you are already familiar with <a href="https://epsg.io/">epsg.io</a> (created by MapTiler), then you may find convenient to access the details of more than 10 thousands of coordinate reference systems (CRS) programmatically, as well as transforming coordinates from one system to another!</p>
139
-
140
- <a href="#search" id="search" style="color: inherit; text-decoration: none;">
141
- <h3>Search</h3>
142
- </a>
143
- <p>The <code>search</code> lets you perform a query in a free form fashion. Here are some examples:</p>
144
- <pre><code class="language-ts"><span class="hl-2">// in an async function, or as a &#39;thenable&#39;:</span><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">resultA</span><span class="hl-0"> = </span><span class="hl-3">await</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">coordinates</span><span class="hl-0">.</span><span class="hl-7">search</span><span class="hl-0">(</span><span class="hl-1">&#39;mercator&#39;</span><span class="hl-0">);</span><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">resultB</span><span class="hl-0"> = </span><span class="hl-3">await</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">coordinates</span><span class="hl-0">.</span><span class="hl-7">search</span><span class="hl-0">(</span><span class="hl-1">&#39;plate carree&#39;</span><span class="hl-0">);</span><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">resultC</span><span class="hl-0"> = </span><span class="hl-3">await</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">coordinates</span><span class="hl-0">.</span><span class="hl-7">search</span><span class="hl-0">(</span><span class="hl-1">&#39;france&#39;</span><span class="hl-0">);</span><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">resultD</span><span class="hl-0"> = </span><span class="hl-3">await</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">coordinates</span><span class="hl-0">.</span><span class="hl-7">search</span><span class="hl-0">(</span><span class="hl-1">&#39;code:4326&#39;</span><span class="hl-0">, {</span><span class="hl-5">transformations:</span><span class="hl-0"> </span><span class="hl-4">true</span><span class="hl-0">}));</span>
145
- </code></pre>
146
- <p>The <code>transformations</code> options retrieves a lot more details about the CRS that MapTiler API is able to transform to/from than just their IDs.</p>
147
- <p>Read more about searching coordinate systems on our <a href="https://docs.maptiler.com/client-js/coordinates/#search">official documentation</a>.</p>
148
-
149
- <a href="#transform" id="transform" style="color: inherit; text-decoration: none;">
150
- <h3>Transform</h3>
151
- </a>
152
- <p>Transforming a couple of coordinates from one system to another can be challenging, for example, most countries have their own official system, yet web mapping tools are more often than not exclusive to <a href="https://epsg.io/4326">WGS84</a>.</p>
153
- <p>If not provided, both the source (<code>sourceCrs</code>) and the destination (<code>targetCrs</code>) are default to <strong>EPSG:4326</strong> (in other words, <a href="https://epsg.io/4326">WGS84</a>). Here is how to use this feature:</p>
154
- <pre><code class="language-ts"><span class="hl-2">// in an async function, or as a &#39;thenable&#39;:</span><br/><br/><span class="hl-2">// Providing one coordinate to transform, with a target CRS being EPSG:9793 (RGF93 v2 / Lambert-93, France official CRS)</span><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">resultA</span><span class="hl-0"> = </span><span class="hl-3">await</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">coordinates</span><span class="hl-0">.</span><span class="hl-7">transform</span><span class="hl-0">([</span><span class="hl-8">1</span><span class="hl-0">, </span><span class="hl-8">45</span><span class="hl-0">], {</span><span class="hl-5">targetCrs:</span><span class="hl-0"> </span><span class="hl-8">9793</span><span class="hl-0">})</span><br/><br/><span class="hl-2">// Using the same logic, we can pass up to 50 coordinates to be transformed</span><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">resultB</span><span class="hl-0"> = </span><span class="hl-3">await</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">coordinates</span><span class="hl-0">.</span><span class="hl-7">transform</span><span class="hl-0">([[</span><span class="hl-8">10</span><span class="hl-0">, </span><span class="hl-8">48</span><span class="hl-0">], [</span><span class="hl-8">1</span><span class="hl-0">, </span><span class="hl-8">45</span><span class="hl-0">]], {</span><span class="hl-5">targetCrs:</span><span class="hl-0"> </span><span class="hl-8">9793</span><span class="hl-0">})</span>
155
- </code></pre>
156
- <p>Read more about transforming coordinates on our <a href="https://docs.maptiler.com/client-js/coordinates/#transform">official documentation</a>.</p>
157
-
158
- <a href="#💽-data" id="💽-data" style="color: inherit; text-decoration: none;">
159
- <h2>💽 Data</h2>
160
- </a>
161
- <p>MapTiler Cloud give its users the possibility to <a href="https://cloud.maptiler.com/data/">upload and create data</a>, manually with a user interface or by uploading a GPX, GeoJSON, KML or shp file. A unique ID is associated to each dataset so that we can later on access it programmatically to retrieve a GeoJSON equivalent of it:</p>
162
- <pre><code class="language-ts"><span class="hl-2">// in an async function, or as a &#39;thenable&#39;:</span><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">result</span><span class="hl-0"> = </span><span class="hl-3">await</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">data</span><span class="hl-0">.</span><span class="hl-7">get</span><span class="hl-0">(</span><span class="hl-1">&#39;my-dataset-unique-id&#39;</span><span class="hl-0">)</span>
163
- </code></pre>
164
- <p>Since the result is a GeoJSON, it can easily be added to a <code>map</code> with <code>.addSource()</code> and <code>.addLayer()</code>.</p>
165
- <p>Read more about fetching your own data on our <a href="https://docs.maptiler.com/client-js/data/">official documentation</a>.</p>
166
-
167
- <a href="#🗺️-static-maps" id="🗺️-static-maps" style="color: inherit; text-decoration: none;">
168
- <h2>🗺️ Static maps</h2>
169
- </a>
170
- <blockquote>
171
- <p>✅ Please, use static maps URLs only from client side <code>&lt;img&gt;</code> elements, and do not 🚫 store or redistribute the static map files. In case of doubt, consult the <a href="https://www.maptiler.com/cloud/terms/#explicitly-prohibited-use">terms</a> ⚖️</p>
172
- </blockquote>
173
- <p>Maptiler Cloud provides many possibilities for creating static maps as PNG, JPEG or WebP images. They all offer the possibilities to:</p>
174
- <ul>
175
- <li>Choose from one of the MapTiler style or your own</li>
176
- <li>Add markers with a custom icon (or default icon with custom color)</li>
177
- <li>Add path or polygon, with a parametric line width and color and a parametric filling color</li>
178
- </ul>
179
- <p>Three modes are available: <code>centered</code>, <code>bounded</code> and <code>automatic</code>.</p>
180
- <blockquote>
181
- <p>📣 <em><strong>important:</strong></em> <span style="text-decoration: underline">only image <strong>URLs</strong> are returned.</span><br>Contrary to the other functions of this library, the static map functions <strong>do not</strong> perform any query to MapTiler Cloud API, instead they build the image URL for you to use in <code>&lt;img&gt;</code> elements.</p>
182
- </blockquote>
183
-
184
- <a href="#map-styles" id="map-styles" style="color: inherit; text-decoration: none;">
185
- <h3>Map Styles</h3>
186
- </a>
187
- <p>In the following static map functions, the <code>option</code> object features a <code>style</code> property that can be a string or one of the built-in style shorthand. Here is the full list:</p>
188
- <ul>
189
- <li><code>MapStyle.STREETS</code>, reference style for navigation and city exploration<ul>
190
- <li><code>MapStyle.STREETS.DARK</code> (variant)</li>
191
- <li><code>MapStyle.STREETS.LIGHT</code> (variant)</li>
192
- <li><code>MapStyle.STREETS.PASTEL</code> (variant)</li>
193
- </ul>
194
- </li>
195
- <li><code>MapStyle.OUTDOOR</code> reference style for adventure</li>
196
- <li><code>MapStyle.DATAVIZ</code>, the perfect style for data visualization, with very little noise<ul>
197
- <li><code>MapStyle.DATAVIZ.DARK</code> (variant)</li>
198
- <li><code>MapStyle.DATAVIZ.LIGHT</code> (variant)</li>
199
- </ul>
200
- </li>
201
- <li><code>MapStyle.BACKDROP</code>, the perfect style for data visualization, with very little noise<ul>
202
- <li><code>MapStyle.BACKDROP.DARK</code> (variant)</li>
203
- <li><code>MapStyle.BACKDROP.LIGHT</code> (variant)</li>
204
- </ul>
205
- </li>
206
- <li><code>MapStyle.WINTER</code> reference style for winter adventure</li>
207
- <li><code>MapStyle.SATELLITE</code> reference style satellite and airborne imagery (no variants)</li>
208
- <li><code>MapStyle.HYBRID</code> reference style satellite and airborne imagery with labels (no variants)</li>
209
- <li><code>MapStyle.BASIC</code> reference style for minimalist design and general purpose<ul>
210
- <li><code>MapStyle.BASIC.DARK</code> (variant)</li>
211
- <li><code>MapStyle.BASIC.LIGHT</code> (variant)</li>
212
- </ul>
213
- </li>
214
- <li><code>MapStyle.BRIGHT</code> reference style for high contrast navigation<ul>
215
- <li><code>MapStyle.BRIGHT.DARK</code> (variant)</li>
216
- <li><code>MapStyle.BRIGHT.LIGHT</code> (variant)</li>
217
- <li><code>MapStyle.BRIGHT.PASTEL</code> (variant)</li>
218
- </ul>
219
- </li>
220
- <li><code>MapStyle.TOPO</code> reference style for topographic study<ul>
221
- <li><code>MapStyle.TOPO.SHINY</code> (variant)</li>
222
- <li><code>MapStyle.TOPO.PASTEL</code> (variant)</li>
223
- <li><code>MapStyle.TOPO.TOPOGRAPHIQUE</code> (variant)</li>
224
- </ul>
225
- </li>
226
- <li><code>MapStyle.VOYAGER</code> reference style for stylish yet minimalist maps<ul>
227
- <li><code>MapStyle.VOYAGER.DARK</code> (variant)</li>
228
- <li><code>MapStyle.VOYAGER.LIGHT</code> (variant)</li>
229
- <li><code>MapStyle.VOYAGER.VINTAGE</code> (variant)</li>
230
- </ul>
231
- </li>
232
- <li><code>MapStyle.TONER</code> reference style for very high contrast stylish maps <ul>
233
- <li><code>MapStyle.TONER.BACKGROUND</code> (variant)</li>
234
- <li><code>MapStyle.TONER.LITE</code> (variant)</li>
235
- <li><code>MapStyle.TONER.LINES</code> (variant)</li>
236
- </ul>
237
- </li>
238
- <li><code>MapStyle.OPENSTREETMAP</code> (reference style, this one does not have any variants)</li>
239
- <li><code>MapStyle.OCEAN</code> (reference style, this one does not have any variants)</li>
240
- </ul>
241
-
242
- <a href="#centered-static-maps" id="centered-static-maps" style="color: inherit; text-decoration: none;">
243
- <h3>Centered static maps</h3>
244
- </a>
245
- <p>This type of map is centered on a longitude-latitude coordinate and the zoom level must also be provided (from <code>0</code>: very zoomed out, to <code>22</code>: very zoomed in).<br>Note that if a path or markers are provided, the framing of the map will not automatically adapt to include those (use the <code>automatic</code> mode for that).</p>
246
- <pre><code class="language-ts"><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">imageLink</span><span class="hl-0"> = </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">staticMaps</span><span class="hl-0">.</span><span class="hl-7">centered</span><span class="hl-0">(</span><br/><span class="hl-0"> </span><span class="hl-2">// center position (Boston)</span><br/><span class="hl-0"> [-</span><span class="hl-8">71.06080</span><span class="hl-0">, </span><span class="hl-8">42.362114</span><span class="hl-0">], </span><br/><br/><span class="hl-0"> </span><span class="hl-2">// zoom level</span><br/><span class="hl-0"> </span><span class="hl-8">12.5</span><span class="hl-0">, </span><br/><span class="hl-0"> </span><br/><span class="hl-0"> </span><span class="hl-2">// Options</span><br/><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-2">// Request a hiDPI/Retina image</span><br/><span class="hl-0"> </span><span class="hl-5">hiDPI:</span><span class="hl-0"> </span><span class="hl-4">true</span><span class="hl-0">,</span><br/><br/><span class="hl-0"> </span><span class="hl-2">// Output image size</span><br/><span class="hl-0"> </span><span class="hl-5">width:</span><span class="hl-0"> </span><span class="hl-8">1000</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-5">height:</span><span class="hl-0"> </span><span class="hl-8">1000</span><span class="hl-0">,</span><br/><br/><span class="hl-0"> </span><span class="hl-2">// Map style</span><br/><span class="hl-0"> </span><span class="hl-5">style:</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">MapStyle</span><span class="hl-0">.</span><span class="hl-6">OUTDOOR</span><span class="hl-0">,</span><br/><span class="hl-0"> });</span>
247
- </code></pre>
248
- <p>Read more about centered static maps on our official <a href="https://docs.maptiler.com/cloud/api/static-maps/#center-based-image">API documentation</a>.</p>
249
-
250
- <a href="#bounded-static-maps" id="bounded-static-maps" style="color: inherit; text-decoration: none;">
251
- <h3>Bounded static maps</h3>
252
- </a>
253
- <p>This type of map requires a bounding box made of two points: the south-west bound and the north-east bound. The zoom level cannot be provided and is automatically deduced from the size of the bounding box.</p>
254
- <pre><code class="language-ts"><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">imageLink</span><span class="hl-0"> = </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">staticMaps</span><span class="hl-0">.</span><span class="hl-7">bounded</span><span class="hl-0">(</span><br/><span class="hl-0"> </span><span class="hl-2">// The bounding box on Europe</span><br/><span class="hl-0"> [</span><br/><span class="hl-0"> -</span><span class="hl-8">24</span><span class="hl-0">, </span><span class="hl-2">// west bound (min x)</span><br/><span class="hl-0"> </span><span class="hl-8">34.5</span><span class="hl-0">, </span><span class="hl-2">// south bound (min y)</span><br/><span class="hl-0"> </span><span class="hl-8">32</span><span class="hl-0">, </span><span class="hl-2">// east bound (max x)</span><br/><span class="hl-0"> </span><span class="hl-8">71</span><span class="hl-0">, </span><span class="hl-2">// north bound (max y)</span><br/><span class="hl-0"> ],</span><br/><br/><span class="hl-0"> </span><span class="hl-2">// Options</span><br/><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-5">hiDPI:</span><span class="hl-0"> </span><span class="hl-4">true</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-5">width:</span><span class="hl-0"> </span><span class="hl-8">2048</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-5">height:</span><span class="hl-0"> </span><span class="hl-8">2048</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-5">style:</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">MapStyle</span><span class="hl-0">.</span><span class="hl-6">STREETS</span><span class="hl-0">.</span><span class="hl-6">DARK</span><span class="hl-0">,</span><br/><br/><span class="hl-0"> </span><span class="hl-2">// Extra space that will add around the bounding box, in percentage</span><br/><span class="hl-0"> </span><span class="hl-2">// (0.1 = 10% is actually the dafault)</span><br/><span class="hl-0"> </span><span class="hl-5">padding:</span><span class="hl-0"> </span><span class="hl-8">0.1</span><br/><span class="hl-0"> });</span>
255
- </code></pre>
256
- <p>Since the zoom level cannot be provided, the level of details is dictated by the size of the output image. here is an example:</p>
257
- <table>
258
- <thead>
259
- <tr>
260
- <th align="center"><code>2048 x 2048</code></th>
261
- <th align="center"><code>1024 x 1024</code></th>
262
- </tr>
263
- </thead>
264
- <tbody><tr>
265
- <td align="center"><img src="images/screenshots/static-bounded-europe-2048.png" alt=""></td>
266
- <td align="center"><img src="images/screenshots/static-bounded-europe-1024.png" alt=""></td>
267
- </tr>
268
- </tbody></table>
269
- <p>As you may notice, the geo bounding box could have very different proportions than the output image size. In the following example, we place the very same bounding box around Portugal, which has a this particular strip looking shape. We also add a <code>path</code> that repeats exactly the same bounding box to show the difference between the provided bounding box and the final image. We kept the default padding of 10%:</p>
270
- <table>
271
- <thead>
272
- <tr>
273
- <th align="center"><code>2048 x 2048</code></th>
274
- <th align="center"><code>1024 x 2048</code></th>
275
- </tr>
276
- </thead>
277
- <tbody><tr>
278
- <td align="center"><img src="images/screenshots/static-bounded-portugal-2048x2048.png" alt=""></td>
279
- <td align="center"><img src="images/screenshots/static-bounded-portugal-1024x2048.png" alt=""></td>
280
- </tr>
281
- </tbody></table>
282
- <p>Read more about bounded static maps on our official <a href="https://docs.maptiler.com/cloud/api/static-maps/#bounds-based-image">API documentation</a>.</p>
283
-
284
- <a href="#automatic-static-maps" id="automatic-static-maps" style="color: inherit; text-decoration: none;">
285
- <h3>Automatic static maps</h3>
286
- </a>
287
- <p>As we have seen with centered and bounded maps, providing all the parameters is nice but can be cumbersome for the simplest use cases. This is why MapTiler Cloud also provides static maps that fits automatically whatever you need to place inside: path or markers.</p>
288
- <p>In the following example, we are going to load a cycling track recorded by one of our team members in Montreal, Canada. The track, originally a GPX file, was pushed to MapTiler Data and is now made available as a GeoJSON:</p>
289
- <pre><code class="language-ts"><span class="hl-2">// Fetching the GeoJSON</span><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">bikeTrack</span><span class="hl-0"> = </span><span class="hl-3">await</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">data</span><span class="hl-0">.</span><span class="hl-7">get</span><span class="hl-0">(</span><span class="hl-1">&#39;the-id-of-a-bike-track-in-montreal&#39;</span><span class="hl-0">);</span><br/><br/><span class="hl-2">// Extracting the track points with the shape [[lng, lat], [lng, lat], ...]</span><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">trackPoints</span><span class="hl-0"> = </span><span class="hl-5">bikeTrack</span><span class="hl-0">.</span><span class="hl-5">features</span><span class="hl-0">[</span><span class="hl-8">0</span><span class="hl-0">].</span><span class="hl-5">geometry</span><span class="hl-0">.</span><span class="hl-5">coordinates</span><span class="hl-0">[</span><span class="hl-8">0</span><span class="hl-0">]</span><br/><span class="hl-0"> .</span><span class="hl-7">map</span><span class="hl-0">(</span><span class="hl-5">p</span><span class="hl-0"> </span><span class="hl-4">=&gt;</span><span class="hl-0"> </span><span class="hl-5">p</span><span class="hl-0">.</span><span class="hl-7">slice</span><span class="hl-0">(</span><span class="hl-8">0</span><span class="hl-0">, </span><span class="hl-8">2</span><span class="hl-0">));</span><br/><br/><span class="hl-4">const</span><span class="hl-0"> </span><span class="hl-6">imageLink</span><span class="hl-0"> = </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">staticMaps</span><span class="hl-0">.</span><span class="hl-7">automatic</span><span class="hl-0">({</span><br/><span class="hl-0"> </span><span class="hl-2">// hiDPI/Retina precision</span><br/><span class="hl-0"> </span><span class="hl-5">hiDPI:</span><span class="hl-0"> </span><span class="hl-4">true</span><span class="hl-0">,</span><br/><br/><span class="hl-0"> </span><span class="hl-2">// A fairly large output image</span><br/><span class="hl-0"> </span><span class="hl-5">width:</span><span class="hl-0"> </span><span class="hl-8">2048</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-5">height:</span><span class="hl-0"> </span><span class="hl-8">1024</span><span class="hl-0"> ,</span><br/><br/><span class="hl-0"> </span><span class="hl-2">// A grey style on which the track will pop!</span><br/><span class="hl-0"> </span><span class="hl-5">style:</span><span class="hl-0"> </span><span class="hl-5">maptilerClient</span><span class="hl-0">.</span><span class="hl-5">MapStyle</span><span class="hl-0">.</span><span class="hl-6">STREETS</span><span class="hl-0">.</span><span class="hl-6">LIGHT</span><span class="hl-0">,</span><br/><br/><span class="hl-0"> </span><span class="hl-2">// Draw a path with the trackpoints</span><br/><span class="hl-0"> </span><span class="hl-5">path:</span><span class="hl-0"> </span><span class="hl-5">trackPoints</span><span class="hl-0">,</span><br/><br/><span class="hl-0"> </span><span class="hl-2">// Adding a marker for the starting point, with a custom color (array of shape [lng, lat, color])</span><br/><span class="hl-0"> </span><span class="hl-5">marker:</span><span class="hl-0"> [</span><span class="hl-5">trackPoints</span><span class="hl-0">[</span><span class="hl-8">0</span><span class="hl-0">][</span><span class="hl-8">0</span><span class="hl-0">], </span><span class="hl-5">trackPoints</span><span class="hl-0">[</span><span class="hl-8">0</span><span class="hl-0">][</span><span class="hl-8">1</span><span class="hl-0">], </span><span class="hl-1">&#39;#0a0&#39;</span><span class="hl-0">],</span><br/><br/><span class="hl-0"> </span><span class="hl-2">// Showing the track in red</span><br/><span class="hl-0"> </span><span class="hl-5">pathStrokeColor:</span><span class="hl-0"> </span><span class="hl-1">&#39;red&#39;</span><span class="hl-0">,</span><br/><span class="hl-0">});</span>
290
- </code></pre>
291
- <p>And voila!</p>
292
- <p><img src="images/screenshots/static-with-path.png" alt="static map with bike path"></p>
293
- <blockquote>
294
- <p>📣 <em><strong>Note:</strong></em> The GeoJSON for this track contains 9380 couples of coordinates, which is a lot! In order to send the track to MapTiler Cloud static maps API, the client simplifies the long paths while keeping a high degree of precision using a very fast <a href="https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm">Ramer-Douglas-Peucker algorithm</a>.</p>
295
- </blockquote>
296
- <p>Read more about bounded static maps on our official <a href="https://docs.maptiler.com/cloud/api/static-maps/#auto-fitted-image">API documentation</a>.</p>
297
-
298
- <a href="#from-nodejs" id="from-nodejs" style="color: inherit; text-decoration: none;">
299
- <h1>From NodeJS</h1>
300
- </a>
301
- <p>NodeJS includes a stable <code>fetch()</code> function only from its version <em>18</em>, and this client does not contain a polyfill. If the <code>fetch()</code> function exists (browser or Node &gt;= 18) then it is going to be resolved automatically, Yet, a custom <code>fetch()</code> function can be provided to the <code>config</code> object for Node &lt; 18.</p>
302
- <p>In <a href="examples/test-node.js">this NodeJS example</a>, you can see that the package <a href="https://www.npmjs.com/package/node-fetch">Node Fetch</a> has been <code>npm install</code>ed and is passed to the config object of the <em>MapTiler Client</em>.</p>
303
- <pre><code class="language-js"><span class="hl-3">import</span><span class="hl-0"> {</span><br/><span class="hl-0"> </span><span class="hl-5">config</span><span class="hl-0">,</span><br/><span class="hl-0"> </span><span class="hl-2">// ...</span><br/><span class="hl-0">} </span><span class="hl-3">from</span><span class="hl-0"> </span><span class="hl-1">&#39;@maptiler/client&#39;</span><span class="hl-0">;</span><br/><br/><span class="hl-2">// For this example to work, you must bring your own node-compatible fetch,</span><br/><span class="hl-2">// unles you are using a version of Nodejs that already contains fetch (&gt;=18)</span><br/><span class="hl-3">import</span><span class="hl-0"> </span><span class="hl-5">fetch</span><span class="hl-0"> </span><span class="hl-3">from</span><span class="hl-0"> </span><span class="hl-1">&#39;node-fetch&#39;</span><span class="hl-0">;</span><br/><br/><span class="hl-5">config</span><span class="hl-0">.</span><span class="hl-5">fetch</span><span class="hl-0"> = </span><span class="hl-5">fetch</span><span class="hl-0">;</span><br/><br/><span class="hl-2">// ...</span>
304
- </code></pre>
305
-
306
- <a href="#terms-and-usage-limitations" id="terms-and-usage-limitations" style="color: inherit; text-decoration: none;">
307
- <h1>Terms and usage limitations</h1>
308
- </a>
309
- <p>The data fetched from MapTiler Cloud API, with or without this library, cannot be stored or redistributed in any ways. If you have any doubt about your specific usecase, please consult our <a href="https://www.maptiler.com/cloud/terms/#explicitly-prohibited-use">legal terms</a> or contact us.</p>
310
- </div></div>
311
- <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
312
- <div class="tsd-navigation settings">
313
- <details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
314
- <h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Settings</h3></summary>
315
- <div class="tsd-accordion-details">
316
- <div class="tsd-filter-visibility">
317
- <h4 class="uppercase">Member Visibility</h4><form>
318
- <ul id="tsd-filter-options">
319
- <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></form></div>
320
- <div class="tsd-theme-toggle">
321
- <h4 class="uppercase">Theme</h4><select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div>
322
- <nav class="tsd-navigation primary">
323
- <details class="tsd-index-accordion" open><summary class="tsd-accordion-summary">
324
- <h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Modules</h3></summary>
325
- <div class="tsd-accordion-details">
326
- <ul>
327
- <li class="current selected"><a href="modules.html">Map<wbr/>Tiler <wbr/>Client -<wbr/> v1.6.0</a>
328
- <ul>
329
- <li class="tsd-kind-module"><a href="modules/config.html">config</a></li>
330
- <li class="tsd-kind-module"><a href="modules/language.html">language</a></li>
331
- <li class="tsd-kind-module"><a href="modules/services_ServiceError.html">services/<wbr/>Service<wbr/>Error</a></li>
332
- <li class="tsd-kind-module"><a href="modules/services_coordinates.html">services/coordinates</a></li>
333
- <li class="tsd-kind-module"><a href="modules/services_data.html">services/data</a></li>
334
- <li class="tsd-kind-module"><a href="modules/services_geocoding.html">services/geocoding</a></li>
335
- <li class="tsd-kind-module"><a href="modules/services_geolocation.html">services/geolocation</a></li>
336
- <li class="tsd-kind-module"><a href="modules/services_simplify.html">services/simplify</a></li>
337
- <li class="tsd-kind-module"><a href="modules/services_staticMaps.html">services/static<wbr/>Maps</a></li></ul></li></ul></div></details></nav></div></div>
338
- <div class="container tsd-generator">
339
- <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
340
- <div class="overlay"></div><script src="assets/main.js"></script></body></html>
@@ -1,71 +0,0 @@
1
- <!DOCTYPE html><html class="default" lang="en"><head><meta charSet="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>config | MapTiler Client - v1.6.0</title><meta name="description" content="Documentation for MapTiler Client - v1.6.0"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><link rel="stylesheet" href="../assets/custom.css"/><script async src="../assets/search.js" id="search-script"></script></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os"</script><header class="tsd-page-toolbar">
2
- <div class="tsd-toolbar-contents container">
3
- <div class="table-cell" id="tsd-search" data-base="..">
4
- <div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><path d="M15.7824 13.833L12.6666 10.7177C12.5259 10.5771 12.3353 10.499 12.1353 10.499H11.6259C12.4884 9.39596 13.001 8.00859 13.001 6.49937C13.001 2.90909 10.0914 0 6.50048 0C2.90959 0 0 2.90909 0 6.49937C0 10.0896 2.90959 12.9987 6.50048 12.9987C8.00996 12.9987 9.39756 12.4863 10.5008 11.6239V12.1332C10.5008 12.3332 10.5789 12.5238 10.7195 12.6644L13.8354 15.7797C14.1292 16.0734 14.6042 16.0734 14.8948 15.7797L15.7793 14.8954C16.0731 14.6017 16.0731 14.1267 15.7824 13.833ZM6.50048 10.499C4.29094 10.499 2.50018 8.71165 2.50018 6.49937C2.50018 4.29021 4.28781 2.49976 6.50048 2.49976C8.71001 2.49976 10.5008 4.28708 10.5008 6.49937C10.5008 8.70852 8.71314 10.499 6.50048 10.499Z" fill="var(--color-text)"></path></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div>
5
- <div class="field">
6
- <div id="tsd-toolbar-links"></div></div>
7
- <ul class="results">
8
- <li class="state loading">Preparing search index...</li>
9
- <li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">MapTiler Client - v1.6.0</a></div>
10
- <div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none"><rect x="1" y="3" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="7" width="14" height="2" fill="var(--color-text)"></rect><rect x="1" y="11" width="14" height="2" fill="var(--color-text)"></rect></svg></a></div></div></header>
11
- <div class="container container-main">
12
- <div class="col-8 col-content">
13
- <div class="tsd-page-title">
14
- <ul class="tsd-breadcrumb">
15
- <li><a href="../modules.html">MapTiler Client - v1.6.0</a></li>
16
- <li><a href="config.html">config</a></li></ul>
17
- <h1>Module config</h1></div><aside class="tsd-sources">
18
- <ul>
19
- <li>Defined in <a href="https://github.com/maptiler/maptiler-client-js/blob/6f9a8fe/src/config.ts#L1">config.ts:1</a></li></ul></aside>
20
- <section class="tsd-panel-group">
21
- <section class="tsd-panel tsd-typography"></section></section>
22
- <section class="tsd-panel-group tsd-index-group">
23
- <section class="tsd-panel tsd-index-panel">
24
- <h3 class="tsd-index-heading uppercase">Index</h3>
25
- <section class="tsd-index-section">
26
- <h3 class="tsd-index-heading">Classes</h3>
27
- <div class="tsd-index-list"><a href="../classes/config.ClientConfig.html" class="tsd-index-link tsd-kind-class tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-class)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-128-path"></rect><path d="M11.898 16.1201C11.098 16.1201 10.466 15.8961 10.002 15.4481C9.53803 15.0001 9.30603 14.3841 9.30603 13.6001V9.64012C9.30603 8.85612 9.53803 8.24012 10.002 7.79212C10.466 7.34412 11.098 7.12012 11.898 7.12012C12.682 7.12012 13.306 7.34812 13.77 7.80412C14.234 8.25212 14.466 8.86412 14.466 9.64012H13.386C13.386 9.14412 13.254 8.76412 12.99 8.50012C12.734 8.22812 12.37 8.09212 11.898 8.09212C11.426 8.09212 11.054 8.22412 10.782 8.48812C10.518 8.75212 10.386 9.13212 10.386 9.62812V13.6001C10.386 14.0961 10.518 14.4801 10.782 14.7521C11.054 15.0161 11.426 15.1481 11.898 15.1481C12.37 15.1481 12.734 15.0161 12.99 14.7521C13.254 14.4801 13.386 14.0961 13.386 13.6001H14.466C14.466 14.3761 14.234 14.9921 13.77 15.4481C13.306 15.8961 12.682 16.1201 11.898 16.1201Z" fill="var(--color-text)" id="icon-128-text"></path></svg><span>Client<wbr/>Config</span></a>
28
- </div></section>
29
- <section class="tsd-index-section">
30
- <h3 class="tsd-index-heading">Type Aliases</h3>
31
- <div class="tsd-index-list"><a href="../types/config.FetchFunction.html" class="tsd-index-link tsd-kind-type-alias tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-4194304-path"></rect><path d="M11.31 16V8.224H8.91V7.24H14.79V8.224H12.39V16H11.31Z" fill="var(--color-text)" id="icon-4194304-text"></path></svg><span>Fetch<wbr/>Function</span></a>
32
- </div></section>
33
- <section class="tsd-index-section">
34
- <h3 class="tsd-index-heading">Variables</h3>
35
- <div class="tsd-index-list"><a href="../variables/config.config.html" class="tsd-index-link tsd-kind-variable tsd-parent-kind-module"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><rect fill="var(--color-icon-background)" stroke="var(--color-ts-variable)" stroke-width="1.5" x="1" y="1" width="22" height="22" rx="6" id="icon-32-path"></rect><path d="M11.106 16L8.85 7.24H9.966L11.454 13.192C11.558 13.608 11.646 13.996 11.718 14.356C11.79 14.708 11.842 14.976 11.874 15.16C11.906 14.976 11.954 14.708 12.018 14.356C12.09 13.996 12.178 13.608 12.282 13.192L13.758 7.24H14.85L12.582 16H11.106Z" fill="var(--color-text)" id="icon-32-text"></path></svg><span>config</span></a>
36
- </div></section></section></section></div>
37
- <div class="col-4 col-menu menu-sticky-wrap menu-highlight">
38
- <div class="tsd-navigation settings">
39
- <details class="tsd-index-accordion"><summary class="tsd-accordion-summary">
40
- <h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Settings</h3></summary>
41
- <div class="tsd-accordion-details">
42
- <div class="tsd-filter-visibility">
43
- <h4 class="uppercase">Member Visibility</h4><form>
44
- <ul id="tsd-filter-options">
45
- <li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li></ul></form></div>
46
- <div class="tsd-theme-toggle">
47
- <h4 class="uppercase">Theme</h4><select id="theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div>
48
- <nav class="tsd-navigation primary">
49
- <details class="tsd-index-accordion" open><summary class="tsd-accordion-summary">
50
- <h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none"><path d="M4.93896 8.531L12 15.591L19.061 8.531L16.939 6.409L12 11.349L7.06098 6.409L4.93896 8.531Z" fill="var(--color-text)"></path></svg> Modules</h3></summary>
51
- <div class="tsd-accordion-details">
52
- <ul>
53
- <li class="current"><a href="../modules.html">Map<wbr/>Tiler <wbr/>Client -<wbr/> v1.6.0</a>
54
- <ul>
55
- <li class="current selected tsd-kind-module"><a href="config.html">config</a></li>
56
- <li class="tsd-kind-module"><a href="language.html">language</a></li>
57
- <li class="tsd-kind-module"><a href="services_ServiceError.html">services/<wbr/>Service<wbr/>Error</a></li>
58
- <li class="tsd-kind-module"><a href="services_coordinates.html">services/coordinates</a></li>
59
- <li class="tsd-kind-module"><a href="services_data.html">services/data</a></li>
60
- <li class="tsd-kind-module"><a href="services_geocoding.html">services/geocoding</a></li>
61
- <li class="tsd-kind-module"><a href="services_geolocation.html">services/geolocation</a></li>
62
- <li class="tsd-kind-module"><a href="services_simplify.html">services/simplify</a></li>
63
- <li class="tsd-kind-module"><a href="services_staticMaps.html">services/static<wbr/>Maps</a></li></ul></li></ul></div></details></nav>
64
- <nav class="tsd-navigation secondary menu-sticky">
65
- <ul>
66
- <li class="tsd-kind-class tsd-parent-kind-module"><a href="../classes/config.ClientConfig.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-128-path"></use><use href="#icon-128-text"></use></svg>Client<wbr/>Config</a></li>
67
- <li class="tsd-kind-type-alias tsd-parent-kind-module"><a href="../types/config.FetchFunction.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-4194304-path"></use><use href="#icon-4194304-text"></use></svg>Fetch<wbr/>Function</a></li>
68
- <li class="tsd-kind-variable tsd-parent-kind-module"><a href="../variables/config.config.html" class="tsd-index-link"><svg class="tsd-kind-icon" width="24" height="24" viewBox="0 0 24 24"><use href="#icon-32-path"></use><use href="#icon-32-text"></use></svg>config</a></li></ul></nav></div></div>
69
- <div class="container tsd-generator">
70
- <p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p></div>
71
- <div class="overlay"></div><script src="../assets/main.js"></script></body></html>