@azure-rest/maps-render 2.0.0-alpha.20250212.1 → 2.0.0-alpha.20250213.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -23
- package/dist/browser/createPathQuery.d.ts +40 -23
- package/dist/browser/createPathQuery.d.ts.map +1 -1
- package/dist/browser/createPathQuery.js +40 -23
- package/dist/browser/createPathQuery.js.map +1 -1
- package/dist/browser/createPinsQuery.d.ts +43 -24
- package/dist/browser/createPinsQuery.d.ts.map +1 -1
- package/dist/browser/createPinsQuery.js +43 -24
- package/dist/browser/createPinsQuery.js.map +1 -1
- package/dist/browser/mapsRender.d.ts +7 -6
- package/dist/browser/mapsRender.d.ts.map +1 -1
- package/dist/browser/mapsRender.js.map +1 -1
- package/dist/browser/positionToTileXY.d.ts +23 -2
- package/dist/browser/positionToTileXY.d.ts.map +1 -1
- package/dist/browser/positionToTileXY.js +23 -2
- package/dist/browser/positionToTileXY.js.map +1 -1
- package/dist/commonjs/createPathQuery.d.ts +40 -23
- package/dist/commonjs/createPathQuery.d.ts.map +1 -1
- package/dist/commonjs/createPathQuery.js +40 -23
- package/dist/commonjs/createPathQuery.js.map +1 -1
- package/dist/commonjs/createPinsQuery.d.ts +43 -24
- package/dist/commonjs/createPinsQuery.d.ts.map +1 -1
- package/dist/commonjs/createPinsQuery.js +43 -24
- package/dist/commonjs/createPinsQuery.js.map +1 -1
- package/dist/commonjs/mapsRender.d.ts +7 -6
- package/dist/commonjs/mapsRender.d.ts.map +1 -1
- package/dist/commonjs/mapsRender.js.map +1 -1
- package/dist/commonjs/positionToTileXY.d.ts +23 -2
- package/dist/commonjs/positionToTileXY.d.ts.map +1 -1
- package/dist/commonjs/positionToTileXY.js +23 -2
- package/dist/commonjs/positionToTileXY.js.map +1 -1
- package/dist/esm/createPathQuery.d.ts +40 -23
- package/dist/esm/createPathQuery.d.ts.map +1 -1
- package/dist/esm/createPathQuery.js +40 -23
- package/dist/esm/createPathQuery.js.map +1 -1
- package/dist/esm/createPinsQuery.d.ts +43 -24
- package/dist/esm/createPinsQuery.d.ts.map +1 -1
- package/dist/esm/createPinsQuery.js +43 -24
- package/dist/esm/createPinsQuery.js.map +1 -1
- package/dist/esm/mapsRender.d.ts +7 -6
- package/dist/esm/mapsRender.d.ts.map +1 -1
- package/dist/esm/mapsRender.js.map +1 -1
- package/dist/esm/positionToTileXY.d.ts +23 -2
- package/dist/esm/positionToTileXY.d.ts.map +1 -1
- package/dist/esm/positionToTileXY.js +23 -2
- package/dist/esm/positionToTileXY.js.map +1 -1
- package/dist/react-native/createPathQuery.d.ts +40 -23
- package/dist/react-native/createPathQuery.d.ts.map +1 -1
- package/dist/react-native/createPathQuery.js +40 -23
- package/dist/react-native/createPathQuery.js.map +1 -1
- package/dist/react-native/createPinsQuery.d.ts +43 -24
- package/dist/react-native/createPinsQuery.d.ts.map +1 -1
- package/dist/react-native/createPinsQuery.js +43 -24
- package/dist/react-native/createPinsQuery.js.map +1 -1
- package/dist/react-native/mapsRender.d.ts +7 -6
- package/dist/react-native/mapsRender.d.ts.map +1 -1
- package/dist/react-native/mapsRender.js.map +1 -1
- package/dist/react-native/positionToTileXY.d.ts +23 -2
- package/dist/react-native/positionToTileXY.d.ts.map +1 -1
- package/dist/react-native/positionToTileXY.js +23 -2
- package/dist/react-native/positionToTileXY.js.map +1 -1
- package/package.json +13 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positionToTileXY.d.ts","sourceRoot":"","sources":["../../src/positionToTileXY.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAUjD
|
|
1
|
+
{"version":3,"file":"positionToTileXY.d.ts","sourceRoot":"","sources":["../../src/positionToTileXY.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAUjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,KAAK,GAAG,KAAK,GACtB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAgB1B"}
|
|
@@ -15,14 +15,35 @@ const MAX_LONGITUDE = 180;
|
|
|
15
15
|
* Reference: https://learn.microsoft.com/en-us/azure/azure-maps/zoom-levels-and-tile-grid?tabs=typescript#tile-math-source-code
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
|
-
* ```ts
|
|
18
|
+
* ```ts snippet:ReadmeSampleRequestMapTiles
|
|
19
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
20
|
+
* import MapsRender, { positionToTileXY } from "@azure-rest/maps-render";
|
|
21
|
+
* import { createWriteStream } from "node:fs";
|
|
22
|
+
*
|
|
23
|
+
* const credential = new DefaultAzureCredential();
|
|
24
|
+
* const client = MapsRender(credential, "<maps-account-client-id>");
|
|
25
|
+
*
|
|
19
26
|
* const zoom = 6;
|
|
27
|
+
* // Use the helper function `positionToTileXY` to get the tile index from the coordinate.
|
|
20
28
|
* const { x, y } = positionToTileXY([47.61559, -122.33817], 6, "256");
|
|
21
29
|
* const response = await client
|
|
22
30
|
* .path("/map/tile")
|
|
23
31
|
* .get({
|
|
24
|
-
* queryParameters: {
|
|
32
|
+
* queryParameters: {
|
|
33
|
+
* tilesetId: "microsoft.base.road",
|
|
34
|
+
* zoom,
|
|
35
|
+
* x,
|
|
36
|
+
* y,
|
|
37
|
+
* },
|
|
25
38
|
* })
|
|
39
|
+
* .asNodeStream();
|
|
40
|
+
*
|
|
41
|
+
* // Handle the error.
|
|
42
|
+
* if (!response.body) {
|
|
43
|
+
* throw Error("No response body");
|
|
44
|
+
* }
|
|
45
|
+
*
|
|
46
|
+
* response.body.pipe(createWriteStream("tile.png"));
|
|
26
47
|
* ```
|
|
27
48
|
*
|
|
28
49
|
* @param position - Position coordinate in the format [latitude, longitude].
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positionToTileXY.js","sourceRoot":"","sources":["../../src/positionToTileXY.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;
|
|
1
|
+
{"version":3,"file":"positionToTileXY.js","sourceRoot":"","sources":["../../src/positionToTileXY.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;AAqDlC,4CAoBC;AArED,SAAS,IAAI,CAAC,CAAS,EAAE,QAAgB,EAAE,QAAgB;IACzD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,YAAY,GAAG,CAAC,WAAW,CAAC;AAClC,MAAM,YAAY,GAAG,WAAW,CAAC;AACjC,MAAM,aAAa,GAAG,CAAC,GAAG,CAAC;AAC3B,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,SAAgB,gBAAgB,CAC9B,QAAgB,EAChB,IAAY,EACZ,QAAuB;IAEvB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;IAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,aAAa,CAAC,CAAC;IAElE,MAAM,CAAC,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;IAClC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;IACzD,MAAM,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,GAAG,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;IAEhF,MAAM,aAAa,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACzC,yKAAyK;IACzK,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IAE7D,OAAO;QACL,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,GAAG,GAAG,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,GAAG,aAAa,CAAC;QACtE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,OAAO,GAAG,GAAG,EAAE,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,GAAG,aAAa,CAAC;KACvE,CAAC;AACJ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { LatLon } from \"@azure/maps-common\";\n\nfunction clip(n: number, minValue: number, maxValue: number): number {\n return Math.min(Math.max(n, minValue), maxValue);\n}\n\nconst MIN_LATITUDE = -85.05112878;\nconst MAX_LATITUDE = 85.05112878;\nconst MIN_LONGITUDE = -180;\nconst MAX_LONGITUDE = 180;\n/**\n * Calculates the XY tile coordinates that a coordinate falls into for a specific zoom level.\n * Reference: https://learn.microsoft.com/en-us/azure/azure-maps/zoom-levels-and-tile-grid?tabs=typescript#tile-math-source-code\n *\n * @example\n * ```ts snippet:ReadmeSampleRequestMapTiles\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import MapsRender, { positionToTileXY } from \"@azure-rest/maps-render\";\n * import { createWriteStream } from \"node:fs\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsRender(credential, \"<maps-account-client-id>\");\n *\n * const zoom = 6;\n * // Use the helper function `positionToTileXY` to get the tile index from the coordinate.\n * const { x, y } = positionToTileXY([47.61559, -122.33817], 6, \"256\");\n * const response = await client\n * .path(\"/map/tile\")\n * .get({\n * queryParameters: {\n * tilesetId: \"microsoft.base.road\",\n * zoom,\n * x,\n * y,\n * },\n * })\n * .asNodeStream();\n *\n * // Handle the error.\n * if (!response.body) {\n * throw Error(\"No response body\");\n * }\n *\n * response.body.pipe(createWriteStream(\"tile.png\"));\n * ```\n *\n * @param position - Position coordinate in the format [latitude, longitude].\n * @param zoom - Zoom level.\n * @param tileSize - The size of the tiles in the tile pyramid.\n * @returns Tile XY coordinates.\n */\nexport function positionToTileXY(\n position: LatLon,\n zoom: number,\n tileSize: \"512\" | \"256\",\n): { x: number; y: number } {\n const latitude = clip(position[0], MIN_LATITUDE, MAX_LATITUDE);\n const longitude = clip(position[1], MIN_LONGITUDE, MAX_LONGITUDE);\n\n const x = (longitude + 180) / 360;\n const sinLatitude = Math.sin((latitude * Math.PI) / 180);\n const y = 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI);\n\n const tileSizeInNum = parseInt(tileSize);\n // tileSize needed in calculations as in rare cases the multiplying/rounding/dividing can make the difference of a pixel which can result in a completely different tile.\n const mapSize = Math.ceil(tileSizeInNum * Math.pow(2, zoom));\n\n return {\n x: Math.floor(clip(x * mapSize + 0.5, 0, mapSize - 1) / tileSizeInNum),\n y: Math.floor(clip(y * mapSize + 0.5, 0, mapSize - 1) / tileSizeInNum),\n };\n}\n"]}
|
|
@@ -43,8 +43,15 @@ export interface PolygonalPath {
|
|
|
43
43
|
* Create a path query string for _get map static image_ request.
|
|
44
44
|
*
|
|
45
45
|
* @example
|
|
46
|
-
* ```ts
|
|
47
|
-
*
|
|
46
|
+
* ```ts snippet:ReadmeSampleCreatePathQuery
|
|
47
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
48
|
+
* import MapsRender, { CircularPath, PolygonalPath, createPathQuery } from "@azure-rest/maps-render";
|
|
49
|
+
* import { createWriteStream } from "node:fs";
|
|
50
|
+
*
|
|
51
|
+
* const credential = new DefaultAzureCredential();
|
|
52
|
+
* const client = MapsRender(credential, "<maps-account-client-id>");
|
|
53
|
+
*
|
|
54
|
+
* const circularPath: CircularPath = {
|
|
48
55
|
* center: [52.4559, 13.228],
|
|
49
56
|
* radiusInMeters: 10000,
|
|
50
57
|
* options: {
|
|
@@ -54,7 +61,7 @@ export interface PolygonalPath {
|
|
|
54
61
|
* },
|
|
55
62
|
* };
|
|
56
63
|
*
|
|
57
|
-
* const linearPath = {
|
|
64
|
+
* const linearPath: PolygonalPath = {
|
|
58
65
|
* coordinates: [
|
|
59
66
|
* [52.577, 13.35],
|
|
60
67
|
* [52.6, 13.2988],
|
|
@@ -67,30 +74,40 @@ export interface PolygonalPath {
|
|
|
67
74
|
* },
|
|
68
75
|
* };
|
|
69
76
|
*
|
|
70
|
-
* const polygonPath = {
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
77
|
+
* const polygonPath: PolygonalPath = {
|
|
78
|
+
* coordinates: [
|
|
79
|
+
* [52.577, 13.35],
|
|
80
|
+
* [52.6, 13.2988],
|
|
81
|
+
* [52.32, 13.2988],
|
|
82
|
+
* [52.577, 13.35],
|
|
83
|
+
* ],
|
|
84
|
+
* options: {
|
|
85
|
+
* lineColor: "000000",
|
|
86
|
+
* lineOpacity: 0.9,
|
|
87
|
+
* lineWidthInPixels: 2,
|
|
88
|
+
* fillColor: "FFFFFF",
|
|
89
|
+
* fillOpacity: 0.8,
|
|
90
|
+
* },
|
|
84
91
|
* };
|
|
85
92
|
*
|
|
86
93
|
* const path = createPathQuery([circularPath, linearPath, polygonPath]);
|
|
87
94
|
* // Send the request
|
|
88
|
-
* const response = await client
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
95
|
+
* const response = await client
|
|
96
|
+
* .path("/map/static")
|
|
97
|
+
* .get({
|
|
98
|
+
* queryParameters: {
|
|
99
|
+
* bbox: [13.228, 52.4559, 13.5794, 52.629],
|
|
100
|
+
* path,
|
|
101
|
+
* },
|
|
102
|
+
* })
|
|
103
|
+
* .asNodeStream();
|
|
104
|
+
*
|
|
105
|
+
* // Handle the error.
|
|
106
|
+
* if (!response.body) {
|
|
107
|
+
* throw Error("No response body");
|
|
108
|
+
* }
|
|
109
|
+
*
|
|
110
|
+
* response.body.pipe(createWriteStream("path.png"));
|
|
94
111
|
* ```
|
|
95
112
|
*
|
|
96
113
|
* @param paths - A collection of {@link PolygonalPath} and {@link CircularPath} that you want to draw on the image.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPathQuery.d.ts","sourceRoot":"","sources":["../../src/createPathQuery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,oIAAoI;IACpI,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0HAA0H;IAC1H,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAKD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,8HAA8H;IAC9H,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AA2BD
|
|
1
|
+
{"version":3,"file":"createPathQuery.d.ts","sourceRoot":"","sources":["../../src/createPathQuery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,+DAA+D;IAC/D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,4DAA4D;IAC5D,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D,oIAAoI;IACpI,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0HAA0H;IAC1H,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,uCAAuC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,cAAc,EAAE,MAAM,CAAC;IACvB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC/B;AAKD;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,8HAA8H;IAC9H,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AA2BD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC,GAAG,MAAM,CASlF"}
|
|
@@ -31,8 +31,15 @@ function comosePathVal(coordinates, options) {
|
|
|
31
31
|
* Create a path query string for _get map static image_ request.
|
|
32
32
|
*
|
|
33
33
|
* @example
|
|
34
|
-
* ```ts
|
|
35
|
-
*
|
|
34
|
+
* ```ts snippet:ReadmeSampleCreatePathQuery
|
|
35
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
36
|
+
* import MapsRender, { CircularPath, PolygonalPath, createPathQuery } from "@azure-rest/maps-render";
|
|
37
|
+
* import { createWriteStream } from "node:fs";
|
|
38
|
+
*
|
|
39
|
+
* const credential = new DefaultAzureCredential();
|
|
40
|
+
* const client = MapsRender(credential, "<maps-account-client-id>");
|
|
41
|
+
*
|
|
42
|
+
* const circularPath: CircularPath = {
|
|
36
43
|
* center: [52.4559, 13.228],
|
|
37
44
|
* radiusInMeters: 10000,
|
|
38
45
|
* options: {
|
|
@@ -42,7 +49,7 @@ function comosePathVal(coordinates, options) {
|
|
|
42
49
|
* },
|
|
43
50
|
* };
|
|
44
51
|
*
|
|
45
|
-
* const linearPath = {
|
|
52
|
+
* const linearPath: PolygonalPath = {
|
|
46
53
|
* coordinates: [
|
|
47
54
|
* [52.577, 13.35],
|
|
48
55
|
* [52.6, 13.2988],
|
|
@@ -55,30 +62,40 @@ function comosePathVal(coordinates, options) {
|
|
|
55
62
|
* },
|
|
56
63
|
* };
|
|
57
64
|
*
|
|
58
|
-
* const polygonPath = {
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
65
|
+
* const polygonPath: PolygonalPath = {
|
|
66
|
+
* coordinates: [
|
|
67
|
+
* [52.577, 13.35],
|
|
68
|
+
* [52.6, 13.2988],
|
|
69
|
+
* [52.32, 13.2988],
|
|
70
|
+
* [52.577, 13.35],
|
|
71
|
+
* ],
|
|
72
|
+
* options: {
|
|
73
|
+
* lineColor: "000000",
|
|
74
|
+
* lineOpacity: 0.9,
|
|
75
|
+
* lineWidthInPixels: 2,
|
|
76
|
+
* fillColor: "FFFFFF",
|
|
77
|
+
* fillOpacity: 0.8,
|
|
78
|
+
* },
|
|
72
79
|
* };
|
|
73
80
|
*
|
|
74
81
|
* const path = createPathQuery([circularPath, linearPath, polygonPath]);
|
|
75
82
|
* // Send the request
|
|
76
|
-
* const response = await client
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
83
|
+
* const response = await client
|
|
84
|
+
* .path("/map/static")
|
|
85
|
+
* .get({
|
|
86
|
+
* queryParameters: {
|
|
87
|
+
* bbox: [13.228, 52.4559, 13.5794, 52.629],
|
|
88
|
+
* path,
|
|
89
|
+
* },
|
|
90
|
+
* })
|
|
91
|
+
* .asNodeStream();
|
|
92
|
+
*
|
|
93
|
+
* // Handle the error.
|
|
94
|
+
* if (!response.body) {
|
|
95
|
+
* throw Error("No response body");
|
|
96
|
+
* }
|
|
97
|
+
*
|
|
98
|
+
* response.body.pipe(createWriteStream("path.png"));
|
|
82
99
|
* ```
|
|
83
100
|
*
|
|
84
101
|
* @param paths - A collection of {@link PolygonalPath} and {@link CircularPath} that you want to draw on the image.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPathQuery.js","sourceRoot":"","sources":["../../src/createPathQuery.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAwCnE,SAAS,cAAc,CAAC,IAAkC;IACxD,OAAO,QAAQ,IAAI,IAAI,CAAC;AAC1B,CAAC;AAWD,MAAM,YAAY,GAAgD;IAChE,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,iBAAiB,EAAE,IAAI;IACvB,MAAM,EAAE,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AM,CAAC,kCAAO,OAAO,KAAE,MAAM,EAAE,cAAc,IAAG,CAAC;QACzE,CAAC;QACD,OAAO,aAAa,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;IACH,OAAO,qBAAqB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACpD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { LatLon } from \"@azure/maps-common\";\nimport { createMultiCollection } from \"./createMultiCollection.js\";\n\n/**\n * The options that modify the style of a circular path.\n */\nexport interface CircularPathOptions {\n /** The line color of the path. Range from 000000 to FFFFFF. */\n lineColor?: string;\n /** The line opacity of the path. Range from 0 to 1. */\n lineOpacity?: number;\n /** The line width of the line. Should be greater than 0. */\n lineWidthInPixels?: number;\n}\n\n/**\n * The options that modify the style of a polygonal path.\n */\nexport interface PolygonalPathOptions extends CircularPathOptions {\n /** The fill color of the path. This only works if the path is a closed shape like polygon or circle. Range from 000000 to FFFFFF.*/\n fillColor?: string;\n /** The fill color of the path. This only works if the path is a closed shape like polygon or circle. Range from 0 to 1.*/\n fillOpacity?: number;\n}\n\ninterface PathOptionsForRequest extends PolygonalPathOptions {\n radius?: number;\n}\n\n/**\n * Specify a circular path.\n */\nexport interface CircularPath {\n /** The center of the circular path. */\n center: LatLon;\n /** The radius of the circular path. */\n radiusInMeters: number;\n /** The options that modify the style of the circular path. */\n options?: CircularPathOptions;\n}\n\nfunction isCircularPath(path: PolygonalPath | CircularPath): path is CircularPath {\n return \"center\" in path;\n}\n/**\n * Specify a polygonal path.\n */\nexport interface PolygonalPath {\n /** The coordinates of the polygonal path. The identical coordinate in the first & last position construct a closed polygon.*/\n coordinates: LatLon[];\n /** The options that modify the style of the polygonal path. */\n options?: PolygonalPathOptions;\n}\n\nconst optionKeyMap: Record<keyof PathOptionsForRequest, string> = {\n lineColor: \"lc\",\n lineOpacity: \"la\",\n fillColor: \"fc\",\n fillOpacity: \"fa\",\n lineWidthInPixels: \"lw\",\n radius: \"ra\",\n};\n\nfunction isOptionKey(key: any): key is keyof PathOptionsForRequest {\n return key in optionKeyMap;\n}\n\nfunction comosePathVal(coordinates: LatLon[], options: PathOptionsForRequest): string {\n // compose the coordinates query string\n const coordinatesQueryStr = coordinates.map(([lat, lon]) => `${lon} ${lat}`).join(\"|\");\n // compose the options query string\n const optionsQueryStr = Object.entries(options).reduce<string>((queryStr, [key, val]) => {\n if (!isOptionKey(key)) throw Error(`Unknown key ${key}`);\n queryStr += `${queryStr ? \"|\" : \"\"}${optionKeyMap[key]}${val}`;\n return queryStr;\n }, \"\");\n return optionsQueryStr + \"||\" + coordinatesQueryStr;\n}\n\n/**\n * Create a path query string for _get map static image_ request.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreatePathQuery\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import MapsRender, { CircularPath, PolygonalPath, createPathQuery } from \"@azure-rest/maps-render\";\n * import { createWriteStream } from \"node:fs\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsRender(credential, \"<maps-account-client-id>\");\n *\n * const circularPath: CircularPath = {\n * center: [52.4559, 13.228],\n * radiusInMeters: 10000,\n * options: {\n * lineColor: \"000000\",\n * lineOpacity: 0.9,\n * lineWidthInPixels: 2,\n * },\n * };\n *\n * const linearPath: PolygonalPath = {\n * coordinates: [\n * [52.577, 13.35],\n * [52.6, 13.2988],\n * [52.32, 13.2988],\n * ],\n * options: {\n * lineColor: \"000000\",\n * lineOpacity: 0.9,\n * lineWidthInPixels: 2,\n * },\n * };\n *\n * const polygonPath: PolygonalPath = {\n * coordinates: [\n * [52.577, 13.35],\n * [52.6, 13.2988],\n * [52.32, 13.2988],\n * [52.577, 13.35],\n * ],\n * options: {\n * lineColor: \"000000\",\n * lineOpacity: 0.9,\n * lineWidthInPixels: 2,\n * fillColor: \"FFFFFF\",\n * fillOpacity: 0.8,\n * },\n * };\n *\n * const path = createPathQuery([circularPath, linearPath, polygonPath]);\n * // Send the request\n * const response = await client\n * .path(\"/map/static\")\n * .get({\n * queryParameters: {\n * bbox: [13.228, 52.4559, 13.5794, 52.629],\n * path,\n * },\n * })\n * .asNodeStream();\n *\n * // Handle the error.\n * if (!response.body) {\n * throw Error(\"No response body\");\n * }\n *\n * response.body.pipe(createWriteStream(\"path.png\"));\n * ```\n *\n * @param paths - A collection of {@link PolygonalPath} and {@link CircularPath} that you want to draw on the image.\n * @param options - The options for the style of the path. See the possible options in {@link PolygonalPathOptions} and {@link CircularPathOptions}.\n */\nexport function createPathQuery(paths: Array<PolygonalPath | CircularPath>): string {\n const pathQueries = paths.map((path) => {\n if (isCircularPath(path)) {\n const { center, radiusInMeters, options } = path;\n return comosePathVal([center], { ...options, radius: radiusInMeters });\n }\n return comosePathVal(path.coordinates, path.options || {});\n });\n return createMultiCollection(\"path\", pathQueries);\n}\n"]}
|
|
@@ -47,31 +47,50 @@ export interface PinSet {
|
|
|
47
47
|
* Create a pin query string for _get map static image_
|
|
48
48
|
*
|
|
49
49
|
* @example
|
|
50
|
-
* ```ts
|
|
50
|
+
* ```ts snippet:ReadmeSampleCreatePinsQuery
|
|
51
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
52
|
+
* import MapsRender, { PinSet, createPinsQuery } from "@azure-rest/maps-render";
|
|
53
|
+
* import { createWriteStream } from "node:fs";
|
|
51
54
|
*
|
|
52
|
-
* const
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
55
|
+
* const credential = new DefaultAzureCredential();
|
|
56
|
+
* const client = MapsRender(credential, "<maps-account-client-id>");
|
|
57
|
+
*
|
|
58
|
+
* const pins: PinSet[] = [
|
|
59
|
+
* {
|
|
60
|
+
* pins: [
|
|
61
|
+
* { coordinate: [52.577, 13.35], label: "Label start" },
|
|
62
|
+
* { coordinate: [52.6, 13.2988], label: "Label end" },
|
|
63
|
+
* ],
|
|
64
|
+
* pinImage: "default",
|
|
65
|
+
* options: {
|
|
66
|
+
* scale: 0.9,
|
|
67
|
+
* pinColor: "FF0000",
|
|
68
|
+
* labelColor: "0000FF",
|
|
69
|
+
* labelSizeInPixels: 18,
|
|
70
|
+
* },
|
|
71
|
+
* },
|
|
72
|
+
* ];
|
|
73
|
+
*
|
|
74
|
+
* const path = createPinsQuery(pins);
|
|
75
|
+
*
|
|
76
|
+
* const response = await client
|
|
77
|
+
* .path("/map/static")
|
|
78
|
+
* .get({
|
|
79
|
+
* queryParameters: {
|
|
80
|
+
* bbox: [13.228, 52.4559, 13.5794, 52.62],
|
|
81
|
+
* zoom: 10,
|
|
82
|
+
* path,
|
|
83
|
+
* },
|
|
84
|
+
* skipUrlEncoding: true,
|
|
85
|
+
* })
|
|
86
|
+
* .asNodeStream();
|
|
87
|
+
*
|
|
88
|
+
* // Handle the error.
|
|
89
|
+
* if (!response.body) {
|
|
90
|
+
* throw Error("No response body");
|
|
91
|
+
* }
|
|
92
|
+
*
|
|
93
|
+
* response.body.pipe(createWriteStream("pin.png"));
|
|
75
94
|
* ```
|
|
76
95
|
*
|
|
77
96
|
* @param pins - An array of {@link Pin} that specify the positions and label text of each pin.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPinsQuery.d.ts","sourceRoot":"","sources":["../../src/createPinsQuery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAGjD;;GAEG;AACH,MAAM,WAAW,GAAG;IAClB,iCAAiC;IACjC,UAAU,EAAE,M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AAC;IACpB,mCAAmC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,mDAAmD;IACnD,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,sDAAsD;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAiBD,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,QAAQ,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IACvC,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,MAAM,CAkBzD"}
|
|
@@ -18,31 +18,50 @@ function isOptionKeyMap(key) {
|
|
|
18
18
|
* Create a pin query string for _get map static image_
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
|
-
* ```ts
|
|
21
|
+
* ```ts snippet:ReadmeSampleCreatePinsQuery
|
|
22
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
23
|
+
* import MapsRender, { PinSet, createPinsQuery } from "@azure-rest/maps-render";
|
|
24
|
+
* import { createWriteStream } from "node:fs";
|
|
22
25
|
*
|
|
23
|
-
* const
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
26
|
+
* const credential = new DefaultAzureCredential();
|
|
27
|
+
* const client = MapsRender(credential, "<maps-account-client-id>");
|
|
28
|
+
*
|
|
29
|
+
* const pins: PinSet[] = [
|
|
30
|
+
* {
|
|
31
|
+
* pins: [
|
|
32
|
+
* { coordinate: [52.577, 13.35], label: "Label start" },
|
|
33
|
+
* { coordinate: [52.6, 13.2988], label: "Label end" },
|
|
34
|
+
* ],
|
|
35
|
+
* pinImage: "default",
|
|
36
|
+
* options: {
|
|
37
|
+
* scale: 0.9,
|
|
38
|
+
* pinColor: "FF0000",
|
|
39
|
+
* labelColor: "0000FF",
|
|
40
|
+
* labelSizeInPixels: 18,
|
|
41
|
+
* },
|
|
42
|
+
* },
|
|
43
|
+
* ];
|
|
44
|
+
*
|
|
45
|
+
* const path = createPinsQuery(pins);
|
|
46
|
+
*
|
|
47
|
+
* const response = await client
|
|
48
|
+
* .path("/map/static")
|
|
49
|
+
* .get({
|
|
50
|
+
* queryParameters: {
|
|
51
|
+
* bbox: [13.228, 52.4559, 13.5794, 52.62],
|
|
52
|
+
* zoom: 10,
|
|
53
|
+
* path,
|
|
54
|
+
* },
|
|
55
|
+
* skipUrlEncoding: true,
|
|
56
|
+
* })
|
|
57
|
+
* .asNodeStream();
|
|
58
|
+
*
|
|
59
|
+
* // Handle the error.
|
|
60
|
+
* if (!response.body) {
|
|
61
|
+
* throw Error("No response body");
|
|
62
|
+
* }
|
|
63
|
+
*
|
|
64
|
+
* response.body.pipe(createWriteStream("pin.png"));
|
|
46
65
|
* ```
|
|
47
66
|
*
|
|
48
67
|
* @param pins - An array of {@link Pin} that specify the positions and label text of each pin.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPinsQuery.js","sourceRoot":"","sources":["../../src/createPinsQuery.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAGlC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AA2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C,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC;aACvF,IAAI,CAAC,GAAG,CAAC,CAAC;QACb,mCAAmC;QACnC,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,MAAM,CAAS,CAAC,QAAQ,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE;YACtF,IAAI,CAAC,cAAc,CAAC,GAAG,CAAC;gBAAE,MAAM,KAAK,CAAC,sBAAsB,GAAG,EAAE,CAAC,CAAC;YACnE,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;gBAAE,OAAO,CAAC,QAAQ,IAAI,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YACxF,OAAO,CAAC,QAAQ,IAAI,IAAI,YAAY,CAAC,GAAG,CAAC,GAAG,GAAG,EAAE,CAAC,CAAC;QACrD,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,IAAI,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAClD,OAAO,GAAG,QAAQ,GAAG,eAAe,KAAK,YAAY,EAAE,CAAC;QAC1D,CAAC;QACD,OAAO,SAAS,eAAe,KAAK,YAAY,KAAK,QAAQ,EAAE,CAAC;IAClE,CAAC,CAAC,CAAC;IACH,OAAO,qBAAqB,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;AACpD,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { LatLon } from \"@azure/maps-common\";\nimport { createMultiCollection } from \"./createMultiCollection.js\";\n\n/**\n * Specify how the pin's position and label text.\n */\nexport interface Pin {\n /** The coordinate of the pin. */\n coordinate: LatLon;\n /** The label text for the pin. */\n label?: string;\n}\n\n/**\n * The pin options for default/none image style..\n */\nexport interface PinOptions {\n /** The opacity of the pin. Range from 0 to 1 */\n opacity?: number;\n /**\n * The labels are centered at the pushpin 'label anchor.' The anchor location is predefined for built-in pushpins and is at the top center of custom pushpins (see below).\n * To override the label anchor, using the _labelAnchor_ option and provide X and Y pixel coordinates for the anchor.\n * These coordinates are relative to the top left corner of the pushpin image. Positive X values move the anchor to the right, and positive Y values move the anchor down.\n * For example, to position the label anchor 10 pixels right and 4 pixels above the top left corner of the pushpin image, use \\{labelAnchor: [10, -4]\\}\n * */\n labelAnchor?: [number, number];\n /** Color of the label. Range from 000000 to FFFFFF */\n labelColor?: string;\n /** Size of the label in pixels. */\n labelSizeInPixels?: number;\n /**\n * By default, custom pushpin images are drawn centered at the pin coordinates. This usually isn't ideal as it obscures the location that you're trying to highlight.\n * To override the anchor location of the pin image, use the _pinAnchor_ option. This uses the same format as the _labelAnchor_ options.\n * For example, if your custom pin image has the tip of the pin at the top left corner of the image, you can set the anchor to that spot by using \\{pinAnchor: [0, 0]\\}\n */\n pinAnchor?: [number, number];\n /** The ration of the pin. Range from -360 to 360*/\n rotationInDegree?: number;\n /** The scale of the pin. Should be greater than 0. */\n scale?: number;\n /** Color of the pin. Range from 000000 to FFFFFF */\n pinColor?: string;\n}\n\nconst optionKeyMap: Record<keyof PinOptions, string> = {\n opacity: \"al\",\n labelAnchor: \"la\",\n labelColor: \"lc\",\n labelSizeInPixels: \"ls\",\n pinAnchor: \"an\",\n rotationInDegree: \"ro\",\n scale: \"sc\",\n pinColor: \"co\",\n};\n\nfunction isOptionKeyMap(key: any): key is keyof PinOptions {\n return key in optionKeyMap;\n}\n\nexport interface PinSet {\n pins: Pin[];\n pinImage?: \"default\" | \"none\" | string;\n options?: PinOptions;\n}\n/**\n * Create a pin query string for _get map static image_\n *\n * @example\n * ```ts snippet:ReadmeSampleCreatePinsQuery\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import MapsRender, { PinSet, createPinsQuery } from \"@azure-rest/maps-render\";\n * import { createWriteStream } from \"node:fs\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsRender(credential, \"<maps-account-client-id>\");\n *\n * const pins: PinSet[] = [\n * {\n * pins: [\n * { coordinate: [52.577, 13.35], label: \"Label start\" },\n * { coordinate: [52.6, 13.2988], label: \"Label end\" },\n * ],\n * pinImage: \"default\",\n * options: {\n * scale: 0.9,\n * pinColor: \"FF0000\",\n * labelColor: \"0000FF\",\n * labelSizeInPixels: 18,\n * },\n * },\n * ];\n *\n * const path = createPinsQuery(pins);\n *\n * const response = await client\n * .path(\"/map/static\")\n * .get({\n * queryParameters: {\n * bbox: [13.228, 52.4559, 13.5794, 52.62],\n * zoom: 10,\n * path,\n * },\n * skipUrlEncoding: true,\n * })\n * .asNodeStream();\n *\n * // Handle the error.\n * if (!response.body) {\n * throw Error(\"No response body\");\n * }\n *\n * response.body.pipe(createWriteStream(\"pin.png\"));\n * ```\n *\n * @param pins - An array of {@link Pin} that specify the positions and label text of each pin.\n * @param pinImage - Specify the image source for custom pin. Set this to \"none\" if you don't want to show a pin image.\n * @param options - The style options of the pins. See {@link PinOptions}\n * @returns - The composed query string.\n */\n\nexport function createPinsQuery(pinSets: PinSet[]): string {\n const pinsQueries = pinSets.map(({ pins, pinImage = \"default\", options = {} }) => {\n // compose the pins' position query string\n const pinsQueryStr = pins\n .map(({ coordinate: [lat, lon], label }) => `${label ? `'${label}'` : \"\"}${lon} ${lat}`)\n .join(\"|\");\n // compose the options query string\n const optionsQueryStr = Object.entries(options).reduce<string>((queryStr, [key, val]) => {\n if (!isOptionKeyMap(key)) throw Error(`Unexpected option: ${key}`);\n if (Array.isArray(val)) return (queryStr += `|${optionKeyMap[key]}${val[0]} ${val[1]}`);\n return (queryStr += `|${optionKeyMap[key]}${val}`);\n }, \"\");\n if (pinImage === \"none\" || pinImage === \"default\") {\n return `${pinImage}${optionsQueryStr}||${pinsQueryStr}`;\n }\n return `custom${optionsQueryStr}||${pinsQueryStr}||${pinImage}`;\n });\n return createMultiCollection(\"pins\", pinsQueries);\n}\n"]}
|
package/dist/esm/mapsRender.d.ts
CHANGED
|
@@ -5,8 +5,9 @@ import type { MapsRenderClient } from "./generated/index.js";
|
|
|
5
5
|
* Creates an instance of MapsRenderClient from a subscription key.
|
|
6
6
|
*
|
|
7
7
|
* @example
|
|
8
|
-
* ```ts
|
|
9
|
-
* import
|
|
8
|
+
* ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey
|
|
9
|
+
* import { AzureKeyCredential } from "@azure/core-auth";
|
|
10
|
+
* import MapsRender from "@azure-rest/maps-render";
|
|
10
11
|
*
|
|
11
12
|
* const credential = new AzureKeyCredential("<subscription-key>");
|
|
12
13
|
* const client = MapsRender(credential);
|
|
@@ -20,9 +21,9 @@ export default function MapsRender(credential: AzureKeyCredential, options?: Cli
|
|
|
20
21
|
* Creates an instance of MapsRender from an Azure Identity `TokenCredential`.
|
|
21
22
|
*
|
|
22
23
|
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* import MapsRenderClient from "@azure-rest/maps-render";
|
|
24
|
+
* ```ts snippet:ReadmeSampleCreateClient_TokenCredential
|
|
25
25
|
* import { DefaultAzureCredential } from "@azure/identity";
|
|
26
|
+
* import MapsRender from "@azure-rest/maps-render";
|
|
26
27
|
*
|
|
27
28
|
* const credential = new DefaultAzureCredential();
|
|
28
29
|
* const client = MapsRender(credential, "<maps-account-client-id>");
|
|
@@ -37,9 +38,9 @@ export default function MapsRender(credential: TokenCredential, mapsAccountClien
|
|
|
37
38
|
* Creates an instance of MapsRender from an Azure Identity `AzureSASCredential`.
|
|
38
39
|
*
|
|
39
40
|
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* import MapsRender from "@azure-rest/maps-render";
|
|
41
|
+
* ```ts snippet:ReadmeSampleCreateClient_SASToken
|
|
42
42
|
* import { AzureSASCredential } from "@azure/core-auth";
|
|
43
|
+
* import MapsRender from "@azure-rest/maps-render";
|
|
43
44
|
*
|
|
44
45
|
* const credential = new AzureSASCredential("<SAS Token>");
|
|
45
46
|
* const client = MapsRender(credential);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapsRender.d.ts","sourceRoot":"","sources":["../../src/mapsRender.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIhG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D
|
|
1
|
+
{"version":3,"file":"mapsRender.d.ts","sourceRoot":"","sources":["../../src/mapsRender.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAIhG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG7D;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,CAAC,EAAE,aAAa,GACtB,gBAAgB,CAAC;AACpB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAU,EAAE,eAAe,EAC3B,mBAAmB,EAAE,MAAM,EAC3B,OAAO,CAAC,EAAE,aAAa,GACtB,gBAAgB,CAAC;AACpB;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAChC,UAAU,EAAE,kBAAkB,EAC9B,OAAO,CAAC,EAAE,aAAa,GACtB,gBAAgB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapsRender.js","sourceRoot":"","sources":["../../src/mapsRender.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,eAAe,EA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C,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,YAAY,CAAC,SAAgB,EAAE,OAAO,CAAC,CAAC;QACvD,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;YACxB,IAAI,EAAE,yBAAyB;YAC/B,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,IAAI;gBAC7B,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,UAAU,CAAC,SAAS,EAAE,CAAC,CAAC;gBACxE,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC,CAAC;QACH,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { AzureKeyCredential, AzureSASCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isSASCredential, isTokenCredential } from \"@azure/core-auth\";\nimport { bearerTokenAuthenticationPolicy } from \"@azure/core-rest-pipeline\";\nimport { createMapsClientIdPolicy } from \"@azure/maps-common\";\nimport type { MapsRenderClient } from \"./generated/index.js\";\nimport createClient from \"./generated/mapsRenderClient.js\";\n\n/**\n * Creates an instance of MapsRenderClient from a subscription key.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_SubscriptionKey\n * import { AzureKeyCredential } from \"@azure/core-auth\";\n * import MapsRender from \"@azure-rest/maps-render\";\n *\n * const credential = new AzureKeyCredential(\"<subscription-key>\");\n * const client = MapsRender(credential);\n *```\n *\n * @param credential - An AzureKeyCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Render Client\n */\nexport default function MapsRender(\n credential: AzureKeyCredential,\n options?: ClientOptions,\n): MapsRenderClient;\n/**\n * Creates an instance of MapsRender from an Azure Identity `TokenCredential`.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_TokenCredential\n * import { DefaultAzureCredential } from \"@azure/identity\";\n * import MapsRender from \"@azure-rest/maps-render\";\n *\n * const credential = new DefaultAzureCredential();\n * const client = MapsRender(credential, \"<maps-account-client-id>\");\n *```\n *\n * @param credential - An TokenCredential instance used to authenticate requests to the service\n * @param mapsAccountClientId - The Azure Maps client id of a specific map resource\n * @param options - Options used to configure the Render Client\n */\nexport default function MapsRender(\n credential: TokenCredential,\n mapsAccountClientId: string,\n options?: ClientOptions,\n): MapsRenderClient;\n/**\n * Creates an instance of MapsRender from an Azure Identity `AzureSASCredential`.\n *\n * @example\n * ```ts snippet:ReadmeSampleCreateClient_SASToken\n * import { AzureSASCredential } from \"@azure/core-auth\";\n * import MapsRender from \"@azure-rest/maps-render\";\n *\n * const credential = new AzureSASCredential(\"<SAS Token>\");\n * const client = MapsRender(credential);\n * ```\n *\n * @param credential - An AzureSASCredential instance used to authenticate requests to the service\n * @param options - Options used to configure the Render Client\n */\nexport default function MapsRender(\n credential: AzureSASCredential,\n options?: ClientOptions,\n): MapsRenderClient;\nexport default function MapsRender(\n credential: TokenCredential | AzureKeyCredential | AzureSASCredential,\n clientIdOrOptions: string | ClientOptions = {},\n maybeOptions: ClientOptions = {},\n): MapsRenderClient {\n const options = typeof clientIdOrOptions === \"string\" ? maybeOptions : clientIdOrOptions;\n\n /**\n * maps service requires a header \"ms-x-client-id\", which is different from the standard Microsoft Entra ID.\n * So we need to do our own implementation.\n * This customized authentication is following by this guide: https://github.com/Azure/azure-sdk-for-js/blob/main/documentation/RLC-customization.md#custom-authentication\n */\n if (isTokenCredential(credential)) {\n const clientId = typeof clientIdOrOptions === \"string\" ? clientIdOrOptions : \"\";\n if (!clientId) {\n throw Error(\"Client id is needed for TokenCredential\");\n }\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy(\n bearerTokenAuthenticationPolicy({\n credential,\n scopes: \"https://atlas.microsoft.com/.default\",\n }),\n );\n client.pipeline.addPolicy(createMapsClientIdPolicy(clientId));\n return client;\n }\n\n if (isSASCredential(credential)) {\n const client = createClient(undefined as any, options);\n client.pipeline.addPolicy({\n name: \"mapsSASCredentialPolicy\",\n async sendRequest(request, next) {\n request.headers.set(\"Authorization\", `jwt-sas ${credential.signature}`);\n return next(request);\n },\n });\n return client;\n }\n\n return createClient(credential, options);\n}\n"]}
|
|
@@ -4,14 +4,35 @@ import type { LatLon } from "@azure/maps-common";
|
|
|
4
4
|
* Reference: https://learn.microsoft.com/en-us/azure/azure-maps/zoom-levels-and-tile-grid?tabs=typescript#tile-math-source-code
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
|
-
* ```ts
|
|
7
|
+
* ```ts snippet:ReadmeSampleRequestMapTiles
|
|
8
|
+
* import { DefaultAzureCredential } from "@azure/identity";
|
|
9
|
+
* import MapsRender, { positionToTileXY } from "@azure-rest/maps-render";
|
|
10
|
+
* import { createWriteStream } from "node:fs";
|
|
11
|
+
*
|
|
12
|
+
* const credential = new DefaultAzureCredential();
|
|
13
|
+
* const client = MapsRender(credential, "<maps-account-client-id>");
|
|
14
|
+
*
|
|
8
15
|
* const zoom = 6;
|
|
16
|
+
* // Use the helper function `positionToTileXY` to get the tile index from the coordinate.
|
|
9
17
|
* const { x, y } = positionToTileXY([47.61559, -122.33817], 6, "256");
|
|
10
18
|
* const response = await client
|
|
11
19
|
* .path("/map/tile")
|
|
12
20
|
* .get({
|
|
13
|
-
* queryParameters: {
|
|
21
|
+
* queryParameters: {
|
|
22
|
+
* tilesetId: "microsoft.base.road",
|
|
23
|
+
* zoom,
|
|
24
|
+
* x,
|
|
25
|
+
* y,
|
|
26
|
+
* },
|
|
14
27
|
* })
|
|
28
|
+
* .asNodeStream();
|
|
29
|
+
*
|
|
30
|
+
* // Handle the error.
|
|
31
|
+
* if (!response.body) {
|
|
32
|
+
* throw Error("No response body");
|
|
33
|
+
* }
|
|
34
|
+
*
|
|
35
|
+
* response.body.pipe(createWriteStream("tile.png"));
|
|
15
36
|
* ```
|
|
16
37
|
*
|
|
17
38
|
* @param position - Position coordinate in the format [latitude, longitude].
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"positionToTileXY.d.ts","sourceRoot":"","sources":["../../src/positionToTileXY.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAUjD
|
|
1
|
+
{"version":3,"file":"positionToTileXY.d.ts","sourceRoot":"","sources":["../../src/positionToTileXY.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAUjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,KAAK,GAAG,KAAK,GACtB;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAgB1B"}
|