@azure-rest/maps-render
Version:
A generated SDK for MapsRenderClient.
117 lines • 3.67 kB
TypeScript
import type { LatLon } from "@azure/maps-common";
/**
* The options that modify the style of a circular path.
*/
export interface CircularPathOptions {
/** The line color of the path. Range from 000000 to FFFFFF. */
lineColor?: string;
/** The line opacity of the path. Range from 0 to 1. */
lineOpacity?: number;
/** The line width of the line. Should be greater than 0. */
lineWidthInPixels?: number;
}
/**
* The options that modify the style of a polygonal path.
*/
export interface PolygonalPathOptions extends CircularPathOptions {
/** 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.*/
fillColor?: string;
/** 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.*/
fillOpacity?: number;
}
/**
* Specify a circular path.
*/
export interface CircularPath {
/** The center of the circular path. */
center: LatLon;
/** The radius of the circular path. */
radiusInMeters: number;
/** The options that modify the style of the circular path. */
options?: CircularPathOptions;
}
/**
* Specify a polygonal path.
*/
export interface PolygonalPath {
/** The coordinates of the polygonal path. The identical coordinate in the first & last position construct a closed polygon.*/
coordinates: LatLon[];
/** The options that modify the style of the polygonal path. */
options?: PolygonalPathOptions;
}
/**
* Create a path query string for _get map static image_ request.
*
* @example
* ```ts snippet:ReadmeSampleCreatePathQuery
* 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"));
* ```
*
* @param paths - A collection of {@link PolygonalPath} and {@link CircularPath} that you want to draw on the image.
* @param options - The options for the style of the path. See the possible options in {@link PolygonalPathOptions} and {@link CircularPathOptions}.
*/
export declare function createPathQuery(paths: Array<PolygonalPath | CircularPath>): string;
//# sourceMappingURL=createPathQuery.d.ts.map