From a939da29134279c8045a2099569ff2cb8611f0b2 Mon Sep 17 00:00:00 2001 From: dpdiliberto Date: Fri, 17 Apr 2020 14:30:23 -0700 Subject: [PATCH] add example for getLngLat --- src/ui/marker.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ui/marker.js b/src/ui/marker.js index 55484adb013..02230ae249f 100644 --- a/src/ui/marker.js +++ b/src/ui/marker.js @@ -270,7 +270,13 @@ export default class Marker extends Evented { * the marker on screen. * * @returns {LngLat} A {@link LngLat} describing the marker's location. - */ + * @example + * // Store the marker's longitude and latitude coordinates in a variable + * var lngLat = marker.getLngLat(); + * // Print the marker's longitude and latitude values in the console + * console.log('Longitude: ' + lngLat.lng + ', Latitude: ' + lngLat.lat ) + * @see [Create a draggable Marker](https://docs.mapbox.com/mapbox-gl-js/example/drag-a-marker/) + */ getLngLat() { return this._lngLat; }