Class: GeoBookmark

ol.control. GeoBookmark


new GeoBookmark(options)

Bookmark positions on ol maps.

Parameters:
Name Type Description
options

Geobookmark's options

Properties
Name Type Description
className string

default ol-bookmark

placeholder string

input placeholder, default Add a new geomark...

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
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, position, zoom, 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)

position _ol_coordinate_

default current position

zoom number

default current map zoom

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}
});