メインコンテンツまでスキップ

Geography and geometry

Public beta for Mapbox Search JS
Mapbox Search JS はパブリック ベータ版です。パブリック ベータ段階では、フレームワークが安定するにつれて変更される可能性があります。

This page includes reference documentation for geography and geometry utilities in the Mapbox Search JS Core framework.

LngLat

A LngLat object represents a given longitude and latitude coordinate, measured in degrees. These coordinates use longitude, latitude coordinate order (as opposed to latitude, longitude) to match the GeoJSON specification, which is equivalent to the OGC:CRS84 coordinate reference system.

Note that any method that accepts a LngLat object as an argument or option can also accept an Array of two numbers and will perform an implicit conversion. This flexible type is documented as LngLatLike.

new LngLat(lng: any, lat: any)

Parameters

lng(any) Longitude, measured in degrees.
lat(any) Latitude, measured in degrees.

Example

const ll = new LngLat(-123.9749, 40.7736);
console.log(ll.lng); // = -123.9749

Static Members

Instance Members

このsection on LngLatは役に立ちましたか?

LngLatLike

A LngLat object, an array of two numbers representing longitude and latitude, or an object with lng and lat or lon and lat properties.

(LngLat | [number, number] | {lng: number, lat: number} | {lon: number, lat: number})

Example

const v1 = new LngLat(-122.420679, 37.772537);
const v2 = [-122.420679, 37.772537];
const v3 = {lon: -122.420679, lat: 37.772537};
このsection on LngLatLikeは役に立ちましたか?

LngLatBounds

A LngLatBounds object represents a geographical bounding box, defined by its southwest and northeast points in longitude and latitude.

Note that any method that accepts a LngLatBounds object as an argument or option can also accept an Array of two LngLatLike constructs and will perform an implicit conversion. This flexible type is documented as LngLatBoundsLike.

new LngLatBounds()

Static Members

Instance Members

このsection on LngLatBoundsは役に立ちましたか?

LngLatBoundsLike

A LngLatBounds object, an array of LngLatLike objects in [sw, ne] order, or an array of numbers in [west, south, east, north] order.

(LngLatBounds | [LngLatLike, LngLatLike] | [number, number, number, number])

Example

const v1 = new LngLatBounds(
new LngLat(-73.9876, 40.7661),
new LngLat(-73.9397, 40.8002)
);
const v2 = new LngLatBounds([-73.9876, 40.7661], [-73.9397, 40.8002]);
const v3 = [[-73.9876, 40.7661], [-73.9397, 40.8002]];
このsection on LngLatBoundsLikeは役に立ちましたか?
このsection on featureToSuggestionは役に立ちましたか?
このpageは役に立ちましたか?