Class: QgsBookmark

class qgis.core.QgsBookmark

Bases: sip.wrapper

Represents a spatial bookmark, with a name, CRS and extent.

QgsBookmark objects are typically used alongside the QgsBookmarkManager class, which handles storage of a set of bookmarks.

New in version 3.10.

QgsBookmark() Default constructor, creates an empty bookmark.

QgsBookmark(QgsBookmark)

Methods

extent

Returns the bookmark’s spatial extent.

fromXml

Creates a bookmark using the properties from a DOM element.

group

Returns the bookmark’s group, which is a user-visible string identifying the bookmark’s category.

id

Returns the bookmark’s unique ID.

name

Returns the bookmark’s name, which is a user-visible string identifying the bookmark.

setExtent

Sets the bookmark’s spatial extent.

setGroup

Sets the bookmark’s group, which is a user-visible string identifying the bookmark’s category.

setId

Sets the bookmark’s unique id.

setName

Sets the bookmark’s name, which is a user-visible string identifying the bookmark.

writeXml

Returns a DOM element representing the bookmark’s properties.

extent(self)QgsReferencedRectangle

Returns the bookmark’s spatial extent.

See also

setExtent()

Return type

QgsReferencedRectangle

fromXml(element: QDomElement, doc: QDomDocument)QgsBookmark

Creates a bookmark using the properties from a DOM element.

See also

writeXml()

Parameters
  • element (QDomElement) –

  • doc (QDomDocument) –

Return type

QgsBookmark

group(self)str

Returns the bookmark’s group, which is a user-visible string identifying the bookmark’s category.

See also

setGroup()

Return type

str

id(self)str

Returns the bookmark’s unique ID.

See also

setId()

Return type

str

name(self)str

Returns the bookmark’s name, which is a user-visible string identifying the bookmark.

See also

setName()

Return type

str

setExtent(self, extent: QgsReferencedRectangle)

Sets the bookmark’s spatial extent.

See also

extent()

Parameters

extent (QgsReferencedRectangle) –

setGroup(self, group: str)

Sets the bookmark’s group, which is a user-visible string identifying the bookmark’s category.

See also

group()

Parameters

group (str) –

setId(self, id: str)

Sets the bookmark’s unique id.

See also

id()

Parameters

id (str) –

setName(self, name: str)

Sets the bookmark’s name, which is a user-visible string identifying the bookmark.

See also

name()

Parameters

name (str) –

writeXml(self, doc: QDomDocument)QDomElement

Returns a DOM element representing the bookmark’s properties.

See also

fromXml()

Parameters

doc (QDomDocument) –

Return type

QDomElement