Atlaslog
Atlaslog / MapLibre GL JS / API / project
MapLibre GL JS · API reference

project

Quick answer

project ( lnglat : LngLatLike ): Point

Last verified 2026-11-03 · MapLibre GL JS 4.x · Cite this page
Runnable examplesChinese noteAll API topics
project()

project(lnglat: LngLatLike): Point

Defined in: ui/map.ts:2092

Returns a Point representing pixel coordinates, relative to the map's container, that correspond to the specified geographical location.

A location behind the camera has no corresponding pixel. For such a location the returned point is outside the viewport, on the side through which the location left the screen, one viewport width or height away from the edge.

Parameters

Parameter Type Description
lnglat LngLatLike The geographical location to project.

Returns

Point

The Point corresponding to lnglat, relative to the map's container.

Example

let coordinate = [-122.420679, 37.772537];
let point = map.project(coordinate);

TutorialsAPI index
English reference text adapted from the official MapLibre GL JS documentation, © MapLibre contributors, licensed under BSD-3-Clause.
Original page: https://maplibre.org/maplibre-gl-js/docs/API/classes/Map/ · Chinese note: /maplibre/api/project.html
Cite this page

Atlaslog (2026). project. https://www.jingweizhi.com/en/maplibre/api/project.html (accessed 2026-11-03).