@azure-rest/maps-render
Version:
A generated SDK for MapsRenderClient.
102 lines • 3.86 kB
TypeScript
import type { LatLon } from "@azure/maps-common";
/**
* Specify how the pin's position and label text.
*/
export interface Pin {
/** The coordinate of the pin. */
coordinate: LatLon;
/** The label text for the pin. */
label?: string;
}
/**
* The pin options for default/none image style..
*/
export interface PinOptions {
/** The opacity of the pin. Range from 0 to 1 */
opacity?: number;
/**
* 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).
* To override the label anchor, using the _labelAnchor_ option and provide X and Y pixel coordinates for the anchor.
* 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.
* 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]\}
* */
labelAnchor?: [number, number];
/** Color of the label. Range from 000000 to FFFFFF */
labelColor?: string;
/** Size of the label in pixels. */
labelSizeInPixels?: number;
/**
* 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.
* To override the anchor location of the pin image, use the _pinAnchor_ option. This uses the same format as the _labelAnchor_ options.
* 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]\}
*/
pinAnchor?: [number, number];
/** The ration of the pin. Range from -360 to 360*/
rotationInDegree?: number;
/** The scale of the pin. Should be greater than 0. */
scale?: number;
/** Color of the pin. Range from 000000 to FFFFFF */
pinColor?: string;
}
export interface PinSet {
pins: Pin[];
pinImage?: "default" | "none" | string;
options?: PinOptions;
}
/**
* Create a pin query string for _get map static image_
*
* @example
* ```ts snippet:ReadmeSampleCreatePinsQuery
* 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"));
* ```
*
* @param pins - An array of {@link Pin} that specify the positions and label text of each pin.
* @param pinImage - Specify the image source for custom pin. Set this to "none" if you don't want to show a pin image.
* @param options - The style options of the pins. See {@link PinOptions}
* @returns - The composed query string.
*/
export declare function createPinsQuery(pinSets: PinSet[]): string;
//# sourceMappingURL=createPinsQuery.d.ts.map