Skip to main content

identifyUrl

The URL that asks a tile layer's service what is at a tap, as a WMS GetFeatureInfo request does. The request is a small square picture, 2 * tolerance + 1 pixels across, centred on the tapped pixel: {width} and {height} are that size, {x} and {y} are the tolerance, and {bbox} is the picture's box as minx,miny,maxx,maxy in EPSG:3857 metres. Every value is encoded, so {bbox} goes out with its commas as %2C.

This is a function exported by @mapcairn/core, checked against version 0.2.0.

Signature​

import { identifyUrl } from "@mapcairn/core";

function identifyUrl(definition: IdentifiableLayerDefinition, controls: ControlValues, now: number, at: IdentifyTarget): string;

Parameters​

  • definition (IdentifiableLayerDefinition)
  • controls (ControlValues)
  • now (number)
  • at (IdentifyTarget)

Returns​

string

Throws​

  • GeometryError invalid when a coordinate or the zoom is not finite. A plain Error when the template names a variable that has no value, which a definition that passed validation never does.

Remarks​

The box is neither clamped nor shifted at the edges of the world, and the server decides what it makes of one. A tap at longitude 179.9999 gives a box that ends past the edge of the world square. Near a pole the box is centred on latitude 85.0511, the limit of Web Mercator, while {lat} keeps the latitude tapped. The caller wraps longitude to -180 up to 180 first. Numbers are rounded to a millimetre, a zoom to three decimals and degrees to six, and written without an exponent.

See also​

Source: packages/core/src/layers/identify.ts:121