共用方式為


@azure-rest/maps-render package

介面

CircularPath

指定循環路徑。

CircularPathOptions

修改循環路徑樣式的選項。

CopyrightCaptionOutput

此物件會從成功的著作權呼叫傳回

CopyrightOutput

此物件會從成功的著作權要求傳回

ErrorAdditionalInfoOutput

資源管理錯誤其他資訊。

ErrorDetailOutput

錯誤詳細數據。

ErrorResponseOutput

所有 Azure Resource Manager API 的常見錯誤回應,以傳回失敗作業的錯誤詳細數據。 (這也遵循 OData 錯誤回應格式。)。

GetCopyrightCaption
GetCopyrightForTile
GetCopyrightForWorld
GetCopyrightFromBoundingBox
GetMapAttribution
GetMapStateTile
GetMapStaticImage
GetMapTile
GetMapTileset
MapAttributionOutput

圖格集所要求區段的著作權屬性。

MapTilesetOutput

TileJSON 格式之磚集的元數據。

MapsRenderClientOptions

用戶端的選擇性參數

Pin

指定釘選的位置和標籤文字的方式。

PinOptions

默認/無影像樣式的釘選選項。

PinSet
PolygonalPath

指定多邊形路徑。

PolygonalPathOptions

修改多邊形路徑樣式的選項。

RegionCopyrightsCountryOutput

Country 屬性

RegionCopyrightsOutput
RenderGetCopyrightCaption200Response

Get Copyright Caption API 是 HTTP GET 要求,其設計目的是提供版權資訊,以與轉譯服務所要求的磚搭配使用。 除了整個地圖的基本版權之外,它還可以為某些國家/地區提供特定的著作權群組。

作為地圖要求的著作權替代方案,它也可以傳回標題,以在地圖上顯示提供者資訊。

RenderGetCopyrightCaptionDefaultResponse

Get Copyright Caption API 是 HTTP GET 要求,其設計目的是提供版權資訊,以與轉譯服務所要求的磚搭配使用。 除了整個地圖的基本版權之外,它還可以為某些國家/地區提供特定的著作權群組。

作為地圖要求的著作權替代方案,它也可以傳回標題,以在地圖上顯示提供者資訊。

RenderGetCopyrightForTile200Response

若要取得特定磚的著作權資訊,要求應指定磚的縮放層級和 x 和 y 座標。 如需詳細資訊,請參閱 縮放層級和磚網格線

Copyrights API 的設計目的是為轉譯服務提供著作權資訊。 除了整個地圖的基本版權之外,API 還為某些國家/地區提供特定版權群組。

RenderGetCopyrightForTileDefaultResponse

若要取得特定磚的著作權資訊,要求應指定磚的縮放層級和 x 和 y 座標。 如需詳細資訊,請參閱 縮放層級和磚網格線

Copyrights API 的設計目的是為轉譯服務提供著作權資訊。 除了整個地圖的基本版權之外,API 還為某些國家/地區提供特定版權群組。

RenderGetCopyrightForTileQueryParam
RenderGetCopyrightForTileQueryParamProperties
RenderGetCopyrightForWorld200Response

傳回世界的著作權資訊。 若要取得全世界的默認版權資訊,請勿指定磚或周框方塊。

Copyrights API 的設計目的是為轉譯服務提供著作權資訊。 除了整個地圖的基本版權之外,API 還為某些國家/地區提供特定版權群組。

RenderGetCopyrightForWorldDefaultResponse

傳回世界的著作權資訊。 若要取得全世界的默認版權資訊,請勿指定磚或周框方塊。

Copyrights API 的設計目的是為轉譯服務提供著作權資訊。 除了整個地圖的基本版權之外,API 還為某些國家/地區提供特定版權群組。

RenderGetCopyrightForWorldQueryParam
RenderGetCopyrightForWorldQueryParamProperties
RenderGetCopyrightFromBoundingBox200Response

傳回指定周框方塊的著作權資訊。 周框方塊要求應指定最小和最大經度和緯度 (EPSG-3857) 座標

RenderGetCopyrightFromBoundingBoxDefaultResponse

傳回指定周框方塊的著作權資訊。 周框方塊要求應指定最小和最大經度和緯度 (EPSG-3857) 座標

RenderGetCopyrightFromBoundingBoxQueryParam
RenderGetCopyrightFromBoundingBoxQueryParamProperties
RenderGetMapAttribution200Response

Get Map Attribution API 可讓使用者要求圖格集區段的地圖版權屬性資訊。

RenderGetMapAttributionDefaultResponse

Get Map Attribution API 可讓使用者要求圖格集區段的地圖版權屬性資訊。

RenderGetMapAttributionQueryParam
RenderGetMapAttributionQueryParamProperties
RenderGetMapStateTile200Headers
RenderGetMapStateTile200Response

擷取向量格式的狀態磚,通常會整合到地圖控件或 SDK 的室內地圖模組中。 當使用者開啟動態樣式之後,地圖控件會呼叫此 API。 如需詳細資訊,請參閱 縮放層級和磚網格線

RenderGetMapStateTileDefaultResponse

擷取向量格式的狀態磚,通常會整合到地圖控件或 SDK 的室內地圖模組中。 當使用者開啟動態樣式之後,地圖控件會呼叫此 API。 如需詳細資訊,請參閱 縮放層級和磚網格線

RenderGetMapStateTileQueryParam
RenderGetMapStateTileQueryParamProperties
RenderGetMapStaticImage200Headers
RenderGetMapStaticImage200Response

此轉譯 API 會產生使用者定義區域的靜態點陣化地圖檢視。 它適用於輕量型 Web 應用程式、所需的用戶體驗不需要互動式地圖控件,或頻寬有限時。 此 API 也適用於將地圖內嵌在瀏覽器外部的應用程式、後端服務、報表產生或桌面應用程式中。

此 API 包含基本資料視覺效果的參數:

  • 標示為多個樣式的圖釘。
  • 轉譯圓形、路徑和多邊形幾何類型。

如需詳細資訊和詳細範例,請參閱 轉譯點陣地圖上的自定義資料

bbox 參數的維度會根據縮放層級而受到限制。 這可確保產生的影像具有適當的詳細數據層級。

縮放層級 Min Lon Range 最大 Lon 範圍 Min Lat Range 最大 Lat 範圍
0 56.25 360.0 30.1105585173 180.0
1 28.125 360.0 14.87468995 180.0
2 14.063 351.5625 7.4130741851 137.9576312246
3 7.03125 175.78125 3.7034501005 73.6354071932
4 3.515625 87.890625 1.8513375155 35.4776115315
5 1.7578125 43.9453125 0.925620264 17.4589959239
6 0.87890625 21.97265625 0.4628040687 8.6907788223
7 0.439453125 10.986328125 0.2314012764 4.3404320789
8 0.2197265625 5.4931640625 0.1157005434 2.1695927024
9 0.1098632812 2.7465820312 0.0578502599 1.0847183194
10 0.0549316406 1.3732910156 0.0289251285 0.5423494021
11 0.0274658203 0.6866455078 0.014462564 0.2711734813
12 0.0137329102 0.3433227539 0.007231282 0.1355865882
13 0.0068664551 0.171661377 0.003615641 0.067793275
14 0.0034332275 0.0858306885 0.0018078205 0.0338966351
15 0.0017166138 0.0429153442 0.0009039102 0.0169483173
16 0.0008583069 0.0214576721 0.0004519551 0.0084741586
17 0.0004291534 0.0107288361 0.0002259776 0.0042370793
18 0.0002145767 0.005364418 0.0001129888 0.0021185396
19 0.0001072884 0.002682209 5.64944E-05 0.0010592698
20 5.36442E-05 0.0013411045 2.82472E-05 0.0005296349

附注:必須將 中心bbox 參數提供給 API。

RenderGetMapStaticImageDefaultResponse

此轉譯 API 會產生使用者定義區域的靜態點陣化地圖檢視。 它適用於輕量型 Web 應用程式、所需的用戶體驗不需要互動式地圖控件,或頻寬有限時。 此 API 也適用於將地圖內嵌在瀏覽器外部的應用程式、後端服務、報表產生或桌面應用程式中。

此 API 包含基本資料視覺效果的參數:

  • 標示為多個樣式的圖釘。
  • 轉譯圓形、路徑和多邊形幾何類型。

如需詳細資訊和詳細範例,請參閱 轉譯點陣地圖上的自定義資料

bbox 參數的維度會根據縮放層級而受到限制。 這可確保產生的影像具有適當的詳細數據層級。

縮放層級 Min Lon Range 最大 Lon 範圍 Min Lat Range 最大 Lat 範圍
0 56.25 360.0 30.1105585173 180.0
1 28.125 360.0 14.87468995 180.0
2 14.063 351.5625 7.4130741851 137.9576312246
3 7.03125 175.78125 3.7034501005 73.6354071932
4 3.515625 87.890625 1.8513375155 35.4776115315
5 1.7578125 43.9453125 0.925620264 17.4589959239
6 0.87890625 21.97265625 0.4628040687 8.6907788223
7 0.439453125 10.986328125 0.2314012764 4.3404320789
8 0.2197265625 5.4931640625 0.1157005434 2.1695927024
9 0.1098632812 2.7465820312 0.0578502599 1.0847183194
10 0.0549316406 1.3732910156 0.0289251285 0.5423494021
11 0.0274658203 0.6866455078 0.014462564 0.2711734813
12 0.0137329102 0.3433227539 0.007231282 0.1355865882
13 0.0068664551 0.171661377 0.003615641 0.067793275
14 0.0034332275 0.0858306885 0.0018078205 0.0338966351
15 0.0017166138 0.0429153442 0.0009039102 0.0169483173
16 0.0008583069 0.0214576721 0.0004519551 0.0084741586
17 0.0004291534 0.0107288361 0.0002259776 0.0042370793
18 0.0002145767 0.005364418 0.0001129888 0.0021185396
19 0.0001072884 0.002682209 5.64944E-05 0.0010592698
20 5.36442E-05 0.0013411045 2.82472E-05 0.0005296349

附注:必須將 中心bbox 參數提供給 API。

RenderGetMapStaticImageQueryParam
RenderGetMapStaticImageQueryParamProperties
RenderGetMapTile200Headers
RenderGetMapTile200Response

HTTP GET 要求中的 Get Map Tiles API,可讓使用者要求向量或點陣格式的地圖底圖,通常會整合到地圖控件或 SDK 中。 可以要求的一些範例圖格是 Azure 地圖服務道路圖格、實時天氣雷達圖格,或是使用 Azure 地圖服務建立者 建立的地圖底圖。 根據預設,Azure 地圖服務會針對 Web 地圖控件使用向量圖格(Web SDK),並 Android SDK

RenderGetMapTileDefaultResponse

HTTP GET 要求中的 Get Map Tiles API,可讓使用者要求向量或點陣格式的地圖底圖,通常會整合到地圖控件或 SDK 中。 可以要求的一些範例圖格是 Azure 地圖服務道路圖格、實時天氣雷達圖格,或是使用 Azure 地圖服務建立者 建立的地圖底圖。 根據預設,Azure 地圖服務會針對 Web 地圖控件使用向量圖格(Web SDK),並 Android SDK

RenderGetMapTileQueryParam
RenderGetMapTileQueryParamProperties
RenderGetMapTileset200Response

取得地圖底圖集 API 可讓使用者要求磚集的元數據。

RenderGetMapTilesetDefaultResponse

取得地圖底圖集 API 可讓使用者要求磚集的元數據。

RenderGetMapTilesetQueryParam
RenderGetMapTilesetQueryParamProperties
Routes

類型別名

MapsRenderClient
RenderGetCopyrightCaptionParameters
RenderGetCopyrightForTileParameters
RenderGetCopyrightForWorldParameters
RenderGetCopyrightFromBoundingBoxParameters
RenderGetMapAttributionParameters
RenderGetMapStateTileParameters
RenderGetMapStaticImageParameters
RenderGetMapTileParameters
RenderGetMapTilesetParameters

函式

createPathQuery((PolygonalPath | CircularPath)[])

建立路徑查詢字串,取得地圖靜態影像 要求。

範例

import { DefaultAzureCredential } from "@azure/identity";
import MapsRender, { CircularPath, PolygonalPath, createPathQuery } from "@azure-rest/maps-render";
import { createWriteStream } from "node:fs";

const credential = new DefaultAzureCredential();
const client = MapsRender(credential, "<maps-account-client-id>");

const circularPath: CircularPath = {
  center: [52.4559, 13.228],
  radiusInMeters: 10000,
  options: {
    lineColor: "000000",
    lineOpacity: 0.9,
    lineWidthInPixels: 2,
  },
};

const linearPath: PolygonalPath = {
  coordinates: [
    [52.577, 13.35],
    [52.6, 13.2988],
    [52.32, 13.2988],
  ],
  options: {
    lineColor: "000000",
    lineOpacity: 0.9,
    lineWidthInPixels: 2,
  },
};

const polygonPath: PolygonalPath = {
  coordinates: [
    [52.577, 13.35],
    [52.6, 13.2988],
    [52.32, 13.2988],
    [52.577, 13.35],
  ],
  options: {
    lineColor: "000000",
    lineOpacity: 0.9,
    lineWidthInPixels: 2,
    fillColor: "FFFFFF",
    fillOpacity: 0.8,
  },
};

const path = createPathQuery([circularPath, linearPath, polygonPath]);
// Send the request
const response = await client
  .path("/map/static")
  .get({
    queryParameters: {
      bbox: [13.228, 52.4559, 13.5794, 52.629],
      path,
    },
  })
  .asNodeStream();

// Handle the error.
if (!response.body) {
  throw Error("No response body");
}

response.body.pipe(createWriteStream("path.png"));
createPinsQuery(PinSet[])

建立 取得地圖靜態影像的釘選查詢字串

範例

import { DefaultAzureCredential } from "@azure/identity";
import MapsRender, { PinSet, createPinsQuery } from "@azure-rest/maps-render";
import { createWriteStream } from "node:fs";

const credential = new DefaultAzureCredential();
const client = MapsRender(credential, "<maps-account-client-id>");

const pins: PinSet[] = [
  {
    pins: [
      { coordinate: [52.577, 13.35], label: "Label start" },
      { coordinate: [52.6, 13.2988], label: "Label end" },
    ],
    pinImage: "default",
    options: {
      scale: 0.9,
      pinColor: "FF0000",
      labelColor: "0000FF",
      labelSizeInPixels: 18,
    },
  },
];

const path = createPinsQuery(pins);

const response = await client
  .path("/map/static")
  .get({
    queryParameters: {
      bbox: [13.228, 52.4559, 13.5794, 52.62],
      zoom: 10,
      path,
    },
    skipUrlEncoding: true,
  })
  .asNodeStream();

// Handle the error.
if (!response.body) {
  throw Error("No response body");
}

response.body.pipe(createWriteStream("pin.png"));
default(AzureKeyCredential, ClientOptions)

從訂用帳戶金鑰建立 MapsRenderClient 的實例。

範例

import { AzureKeyCredential } from "@azure/core-auth";
import MapsRender from "@azure-rest/maps-render";

const credential = new AzureKeyCredential("<subscription-key>");
const client = MapsRender(credential);
default(TokenCredential, string, ClientOptions)

從 Azure 身分識別 TokenCredential建立 MapsRender 實例。

範例

import { DefaultAzureCredential } from "@azure/identity";
import MapsRender from "@azure-rest/maps-render";

const credential = new DefaultAzureCredential();
const client = MapsRender(credential, "<maps-account-client-id>");
default(AzureSASCredential, ClientOptions)

從 Azure 身分識別 AzureSASCredential建立 MapsRender 實例。

範例

import { AzureSASCredential } from "@azure/core-auth";
import MapsRender from "@azure-rest/maps-render";

const credential = new AzureSASCredential("<SAS Token>");
const client = MapsRender(credential);
isUnexpected(RenderGetMapTile200Response | RenderGetMapTileDefaultResponse)
isUnexpected(RenderGetMapTileset200Response | RenderGetMapTilesetDefaultResponse)
isUnexpected(RenderGetMapAttribution200Response | RenderGetMapAttributionDefaultResponse)
isUnexpected(RenderGetMapStateTile200Response | RenderGetMapStateTileDefaultResponse)
isUnexpected(RenderGetCopyrightCaption200Response | RenderGetCopyrightCaptionDefaultResponse)
isUnexpected(RenderGetMapStaticImage200Response | RenderGetMapStaticImageDefaultResponse)
isUnexpected(RenderGetCopyrightFromBoundingBox200Response | RenderGetCopyrightFromBoundingBoxDefaultResponse)
isUnexpected(RenderGetCopyrightForTile200Response | RenderGetCopyrightForTileDefaultResponse)
isUnexpected(RenderGetCopyrightForWorld200Response | RenderGetCopyrightForWorldDefaultResponse)
positionToTileXY(LatLon, number, "256" | "512")

計算特定縮放層級座標所屬於的 XY 圖格座標。 參考:https://learn.microsoft.com/en-us/azure/azure-maps/zoom-levels-and-tile-grid?tabs=typescript#tile-math-source-code

範例

import { DefaultAzureCredential } from "@azure/identity";
import MapsRender, { positionToTileXY } from "@azure-rest/maps-render";
import { createWriteStream } from "node:fs";

const credential = new DefaultAzureCredential();
const client = MapsRender(credential, "<maps-account-client-id>");

const zoom = 6;
// Use the helper function `positionToTileXY` to get the tile index from the coordinate.
const { x, y } = positionToTileXY([47.61559, -122.33817], 6, "256");
const response = await client
  .path("/map/tile")
  .get({
    queryParameters: {
      tilesetId: "microsoft.base.road",
      zoom,
      x,
      y,
    },
  })
  .asNodeStream();

// Handle the error.
if (!response.body) {
  throw Error("No response body");
}

response.body.pipe(createWriteStream("tile.png"));

函式詳細資料

createPathQuery((PolygonalPath | CircularPath)[])

建立路徑查詢字串,取得地圖靜態影像 要求。

範例

import { DefaultAzureCredential } from "@azure/identity";
import MapsRender, { CircularPath, PolygonalPath, createPathQuery } from "@azure-rest/maps-render";
import { createWriteStream } from "node:fs";

const credential = new DefaultAzureCredential();
const client = MapsRender(credential, "<maps-account-client-id>");

const circularPath: CircularPath = {
  center: [52.4559, 13.228],
  radiusInMeters: 10000,
  options: {
    lineColor: "000000",
    lineOpacity: 0.9,
    lineWidthInPixels: 2,
  },
};

const linearPath: PolygonalPath = {
  coordinates: [
    [52.577, 13.35],
    [52.6, 13.2988],
    [52.32, 13.2988],
  ],
  options: {
    lineColor: "000000",
    lineOpacity: 0.9,
    lineWidthInPixels: 2,
  },
};

const polygonPath: PolygonalPath = {
  coordinates: [
    [52.577, 13.35],
    [52.6, 13.2988],
    [52.32, 13.2988],
    [52.577, 13.35],
  ],
  options: {
    lineColor: "000000",
    lineOpacity: 0.9,
    lineWidthInPixels: 2,
    fillColor: "FFFFFF",
    fillOpacity: 0.8,
  },
};

const path = createPathQuery([circularPath, linearPath, polygonPath]);
// Send the request
const response = await client
  .path("/map/static")
  .get({
    queryParameters: {
      bbox: [13.228, 52.4559, 13.5794, 52.629],
      path,
    },
  })
  .asNodeStream();

// Handle the error.
if (!response.body) {
  throw Error("No response body");
}

response.body.pipe(createWriteStream("path.png"));
function createPathQuery(paths: (PolygonalPath | CircularPath)[]): string

參數

paths

(PolygonalPath | CircularPath)[]

您想要在影像上繪製的 PolygonalPathCircularPath 集合。

傳回

string

createPinsQuery(PinSet[])

建立 取得地圖靜態影像的釘選查詢字串

範例

import { DefaultAzureCredential } from "@azure/identity";
import MapsRender, { PinSet, createPinsQuery } from "@azure-rest/maps-render";
import { createWriteStream } from "node:fs";

const credential = new DefaultAzureCredential();
const client = MapsRender(credential, "<maps-account-client-id>");

const pins: PinSet[] = [
  {
    pins: [
      { coordinate: [52.577, 13.35], label: "Label start" },
      { coordinate: [52.6, 13.2988], label: "Label end" },
    ],
    pinImage: "default",
    options: {
      scale: 0.9,
      pinColor: "FF0000",
      labelColor: "0000FF",
      labelSizeInPixels: 18,
    },
  },
];

const path = createPinsQuery(pins);

const response = await client
  .path("/map/static")
  .get({
    queryParameters: {
      bbox: [13.228, 52.4559, 13.5794, 52.62],
      zoom: 10,
      path,
    },
    skipUrlEncoding: true,
  })
  .asNodeStream();

// Handle the error.
if (!response.body) {
  throw Error("No response body");
}

response.body.pipe(createWriteStream("pin.png"));
function createPinsQuery(pinSets: PinSet[]): string

參數

pinSets

PinSet[]

傳回

string

  • 撰寫的查詢字串。

default(AzureKeyCredential, ClientOptions)

從訂用帳戶金鑰建立 MapsRenderClient 的實例。

範例

import { AzureKeyCredential } from "@azure/core-auth";
import MapsRender from "@azure-rest/maps-render";

const credential = new AzureKeyCredential("<subscription-key>");
const client = MapsRender(credential);
function default(credential: AzureKeyCredential, options?: ClientOptions): MapsRenderClient

參數

credential
AzureKeyCredential

用來驗證服務要求的 AzureKeyCredential 實例

options
ClientOptions

用來設定轉譯客戶端的選項

傳回

default(TokenCredential, string, ClientOptions)

從 Azure 身分識別 TokenCredential建立 MapsRender 實例。

範例

import { DefaultAzureCredential } from "@azure/identity";
import MapsRender from "@azure-rest/maps-render";

const credential = new DefaultAzureCredential();
const client = MapsRender(credential, "<maps-account-client-id>");
function default(credential: TokenCredential, mapsAccountClientId: string, options?: ClientOptions): MapsRenderClient

參數

credential
TokenCredential

用來驗證服務要求的 TokenCredential 實例

mapsAccountClientId

string

特定地圖資源的 Azure 地圖服務用戶端識別碼

options
ClientOptions

用來設定轉譯客戶端的選項

傳回

default(AzureSASCredential, ClientOptions)

從 Azure 身分識別 AzureSASCredential建立 MapsRender 實例。

範例

import { AzureSASCredential } from "@azure/core-auth";
import MapsRender from "@azure-rest/maps-render";

const credential = new AzureSASCredential("<SAS Token>");
const client = MapsRender(credential);
function default(credential: AzureSASCredential, options?: ClientOptions): MapsRenderClient

參數

credential
AzureSASCredential

用來驗證服務要求的 AzureSASCredential 實例

options
ClientOptions

用來設定轉譯客戶端的選項

傳回

isUnexpected(RenderGetMapTile200Response | RenderGetMapTileDefaultResponse)

function isUnexpected(response: RenderGetMapTile200Response | RenderGetMapTileDefaultResponse): response

參數

傳回

response

isUnexpected(RenderGetMapTileset200Response | RenderGetMapTilesetDefaultResponse)

function isUnexpected(response: RenderGetMapTileset200Response | RenderGetMapTilesetDefaultResponse): response

參數

傳回

response

isUnexpected(RenderGetMapAttribution200Response | RenderGetMapAttributionDefaultResponse)

function isUnexpected(response: RenderGetMapAttribution200Response | RenderGetMapAttributionDefaultResponse): response

參數

傳回

response

isUnexpected(RenderGetMapStateTile200Response | RenderGetMapStateTileDefaultResponse)

function isUnexpected(response: RenderGetMapStateTile200Response | RenderGetMapStateTileDefaultResponse): response

參數

傳回

response

isUnexpected(RenderGetCopyrightCaption200Response | RenderGetCopyrightCaptionDefaultResponse)

function isUnexpected(response: RenderGetCopyrightCaption200Response | RenderGetCopyrightCaptionDefaultResponse): response

參數

傳回

response

isUnexpected(RenderGetMapStaticImage200Response | RenderGetMapStaticImageDefaultResponse)

function isUnexpected(response: RenderGetMapStaticImage200Response | RenderGetMapStaticImageDefaultResponse): response

參數

傳回

response

isUnexpected(RenderGetCopyrightFromBoundingBox200Response | RenderGetCopyrightFromBoundingBoxDefaultResponse)

function isUnexpected(response: RenderGetCopyrightFromBoundingBox200Response | RenderGetCopyrightFromBoundingBoxDefaultResponse): response

參數

傳回

response

isUnexpected(RenderGetCopyrightForTile200Response | RenderGetCopyrightForTileDefaultResponse)

function isUnexpected(response: RenderGetCopyrightForTile200Response | RenderGetCopyrightForTileDefaultResponse): response

參數

傳回

response

isUnexpected(RenderGetCopyrightForWorld200Response | RenderGetCopyrightForWorldDefaultResponse)

function isUnexpected(response: RenderGetCopyrightForWorld200Response | RenderGetCopyrightForWorldDefaultResponse): response

參數

傳回

response

positionToTileXY(LatLon, number, "256" | "512")

計算特定縮放層級座標所屬於的 XY 圖格座標。 參考:https://learn.microsoft.com/en-us/azure/azure-maps/zoom-levels-and-tile-grid?tabs=typescript#tile-math-source-code

範例

import { DefaultAzureCredential } from "@azure/identity";
import MapsRender, { positionToTileXY } from "@azure-rest/maps-render";
import { createWriteStream } from "node:fs";

const credential = new DefaultAzureCredential();
const client = MapsRender(credential, "<maps-account-client-id>");

const zoom = 6;
// Use the helper function `positionToTileXY` to get the tile index from the coordinate.
const { x, y } = positionToTileXY([47.61559, -122.33817], 6, "256");
const response = await client
  .path("/map/tile")
  .get({
    queryParameters: {
      tilesetId: "microsoft.base.road",
      zoom,
      x,
      y,
    },
  })
  .asNodeStream();

// Handle the error.
if (!response.body) {
  throw Error("No response body");
}

response.body.pipe(createWriteStream("tile.png"));
function positionToTileXY(position: LatLon, zoom: number, tileSize: "256" | "512"): { x: number, y: number }

參數

position
LatLon

位置座標格式為 [緯度,經度]。

zoom

number

縮放層級。

tileSize

"256" | "512"

磚金字塔圖格的大小。

傳回

{ x: number, y: number }

磚 XY 座標。