map.Copyrights

Manager for copyright information on the map. Each map already has its own copyright information manager, available as map.copyrights. Don't instantiate new instances of this class unless necessary.

See Map.copyrights

Constructor | Events | Methods

Constructor

map.Copyrights(map)

Parameters:

Parameter

Default value

Description

map*

Type: Map

Map.

* Mandatory parameter/option.

Example:

// Adding static information about copyright info to the map
var accessor = map.copyrights.add('© Gerardus Mercator');
// ...
// Removing information about copyrights
accessor.remove();

events

Name

Description

change

Event for changes to copyright information placed on the map. Instance of the Event class. Names of fields that are available via the Event.get method:

  • oldCopyrights - Old array of copyright information.
  • newCopyrights - New array of copyright information.

Methods

Name

Returns

Description

add(customCopyrights)

ICopyrightsAccessor

Adds static copyright information to the map (independent of the current center and zoom level).

addProvider(provider)

map.Copyrights

Adds a new provider of copyright information.

get([point[, zoom]])

vow.Promise

Determines copyright information at the specified point.

getPromoLink()

String

Returns external link from the "Open in Yandex Maps" block.

removeProvider(provider)

map.Copyrights

Removes a provider of copyright information.

Events details

change

Event for changes to copyright information placed on the map. Instance of the Event class. Names of fields that are available via the Event.get method:

  • oldCopyrights - Old array of copyright information.
  • newCopyrights - New array of copyright information.

Methods details

add

{ICopyrightsAccessor} add(customCopyrights)

Adds static copyright information to the map (independent of the current center and zoom level).

Returns an object for managing the added information.

Parameters:

Parameter

Default value

Description

customCopyrights*

Type: String|HTMLElement|String[]|HTMLElement[]

Copyright information in string format, a DOM element, or an array of strings/DOM elements.

* Mandatory parameter/option.

addProvider

{map.Copyrights} addProvider(provider)

Adds a new provider of copyright information.

Returns self-reference.

Parameters:

Parameter

Default value

Description

provider*

Type: ICopyrightsProvider

Provider.

* Mandatory parameter/option.

Example:

// Creating a dynamic provider of copyright information
// that will get up-to-date information about copyrights for
// a particular point on the map from a remote server.
var myProvider = {
    getCopyrights: function (center, zoom) {
        var deferred = ymaps.vow.defer();
        $.ajax('http://some.server/copyrights/?ll=' + center.join(',') + '&z=' + zoom, {
            // The server must return an array of strings
            success: function (res) {
                deferred.resolve(res);
            }
        });
        return deferred.promise();
    }
};
// Adding a provider to the map; now when the center or zoom changes, 
// the map copyright information manager will
// request updated information from the remote server and display
// the received data automatically.
map.copyrights.addProvider(myProvider);

get

{vow.Promise} get([point[, zoom]])

Determines copyright information at the specified point.

Returns a Promise object that will be resolved and will pass an array of strings or DOM elements as a parameter.

Parameters:

Parameter

Default value

Description

point

Type: Number[]

The point (in geographical coordinates) that copyright information needs to be determined for. If omitted, the current map center is used.

zoom

Type: Number

The zoom level that copyright information needs to be determined for. If omitted, the current map zoom level is used.

{String} getPromoLink()

Returns external link from the "Open in Yandex Maps" block.

removeProvider

{map.Copyrights} removeProvider(provider)

Removes a provider of copyright information.

Returns self-reference.

Parameters:

Parameter

Default value

Description

provider*

Type: ICopyrightsProvider

Provider.

* Mandatory parameter/option.