Class: GeoBookmark

ol.control. GeoBookmark

Bookmark positions on ol maps.


new GeoBookmark(options)

Parameters:
Name Type Description
options

Geobookmark's options

Properties
Name Type Argument Default Description
className string

default ol-bookmark

title string | undefined

Title to use for the button tooltip, default "Geobookmarks"

placeholder string

input placeholder, default Add a new geomark...

deleteTitle string <optional>
'Suppr.'

title for delete buttons

editable bool

enable modification, default true

namespace string

a namespace to save the boolmark (if more than one on a page), default ol

marks Array.<any>

a list of default bookmarks:

See:
Fires:
  • event:add
  • event:remove
  • event:select
Example
var bm = new GeoBookmark ({ 
  marks: {
    "Paris": {pos:ol.proj.transform([2.351828, 48.856578], 'EPSG:4326', 'EPSG:3857'), zoom:11, permanent: true },
    "London": {pos:ol.proj.transform([-0.1275,51.507222], 'EPSG:4326', 'EPSG:3857'), zoom:12}
  }
});

Extends

Methods


addBookmark(name, options, position, zoom, rotation, permanent)

Add a new Geo bookmark (replace existing one if any)

Parameters:
Name Type Description
name string

name of the bookmark (display in the menu)

options *
position ol.coordinate

default current position

zoom number

default current map zoom

rotation number

default current map rotation

permanent bool

prevent from deletion, default false


getBookmarks()

Get Geo bookmarks

Returns:

a list of bookmarks : { BM1:{pos:ol.coordinates, zoom: integer}, BM2:{pos:ol.coordinates, zoom: integer} }

Type
any

removeBookmark(name)

Remove a Geo bookmark

Parameters:
Name Type Description
name string

setBookmarks(bmark)

Set bookmarks

Parameters:
Name Type Description
bmark

a list of bookmarks, default retreave in the localstorage

Example
bm.setBookmarks({
    "Paris": {pos:_ol_proj_.transform([2.351828, 48.856578], 'EPSG:4326', 'EPSG:3857'), zoom:11, permanent: true },
    "London": {pos:_ol_proj_.transform([-0.1275,51.507222], 'EPSG:4326', 'EPSG:3857'), zoom:12}
  });