Placemark
Extends GeoObject.
Placemark. A geo object with the geometry geometry.Point.
Constructor | Fields | Events | Methods
Constructor
Placemark(geometry[, properties[, options]])
Creates a placemark instance.
Parameters:
Parameter |
Default value |
Description |
— |
Type: Number[]|Object|IPointGeometry Coordinates of the placemark, or a hash describing the geometry, or a reference to the point geometry object. |
|
— |
Type: Object|IDataManager Placemark data. Can be set as a class instance implementing the IDataManager interface, or as a hash. When options are set to default values, the following data fields are interpreted by a geo object:
|
|
— |
Type: Object Placemark options. To change the style and color of an icon, use the following options:
If you want to create your own icon layout, you should specify the following options:
Note To specify the layout of the icon shadow, use the same set of options, but with the "iconShadow" prefix. For example, iconShadowLayout. You can also set options for individual objects using the Placemark class:
Below are the other options of this class. |
|
"pointer" |
Type: String Type of cursor over a placemark. |
|
false |
Type: Boolean Checks whether the placemark can be dragged. |
|
true |
Type: Boolean Checks whether the placemark has the "balloon" field. |
|
true |
Type: Boolean Checks whether the placemark has the "hint" field. |
|
true |
Type: Boolean Hide the placemark when opening the balloon. |
|
— |
Type: Number[] The pixel offset of the icon relative to its set position. |
|
— |
Type: IGeometryJson|null The hotspot shape of the placemark. Specified as a JSON description of the pixel geometry of the icon. Use this option when creating your HTML layouts. The coordinates of the figure geometry are counted from the anchor point. |
|
true |
Type: Boolean Enables automatically modifying the z-index of the placemark depending on its state. |
|
"default#geoObject" |
Type: String Interactivity model. Available keys and their values are listed in the description of interactivityModel.storage. |
|
true |
Type: Boolean Checks whether to show the balloon when the placemark is clicked on. |
|
false |
Type: Boolean Checks whether to show an empty balloon when the placemark is clicked on. |
|
false |
Type: Boolean Checks whether to show an empty hint when the mouse pointer hovers over the placemark. |
|
true |
Type: Boolean Checks whether to show the hint when the mouse pointer hovers over the placemark. |
|
"places" |
Type: String The key of the pane where the placemark overlay is placed. |
|
"default#placemark" |
Type: String|Function Key identifier from overlay.storage or the overlay class. The generator function accepts three parameters:
|
|
false |
Type: Boolean Enables synchronously adding an overlay to the map. By default, overlays are added to the map asynchronously to prevent the browser from hanging when adding a large number of geo objects. However, adding asynchronously does not allow accessing the overlay immediately after adding a placemark to the map. |
|
true |
Type: Boolean When an object is dragged to the edge of the map, the map center changes automatically. Whether to use map margins when automatically shifting the map center with map.margin.Manager. |
|
true |
Type: Boolean Checks placemark visibility. |
|
— |
Type: Number The z-index of a placemark in its normal state. Lowest priority. |
|
— |
Type: Number The z-index of a placemark icon with an open balloon. Highest priority. |
|
— |
Type: Number The z-index of a placemark that is being dragged. |
|
— |
Type: Number The z-index of a placemark when the mouse pointer is hovering over it. |
* Mandatory parameter/option.
Examples:
1.
// Creating a placemark.
var placemark = new ymaps.Placemark([55.75, 37.61], {
balloonContent: '<img src="http://img-fotki.yandex.ru/get/6114/82599242.2d6/0_88b97_ec425cf5_M" />',
iconContent: "Azerbaijan"
}, {
preset: "islands#yellowStretchyIcon",
// Disabling the close balloon button.
balloonCloseButton: false,
// The balloon will open and close when the placemark icon is clicked.
hideIconOnBalloonOpen: false
});
geoMap.geoObjects.add(placemark);
2.
var placemark = new ymaps.Placemark([55.75, 37.61], {}, {
// Setting the placemark style (circle).
preset: "islands#circleDotIcon",
// Setting the placemark color (in RGB format).
iconColor: '#ff0000'
});
geoMap.geoObjects.add(placemark);
Fields
Name |
Type |
Description |
Balloon for a geo object. Inherited from GeoObject. |
||
The "Point" geometry editor. |
||
Event manager. Inherited from GeoObject. |
||
The "Point" type of geometery. |
||
Geo object hint. Inherited from GeoObject. |
||
Geo object options manager. Inherited from GeoObject. |
||
Geo object data manager. Inherited from GeoObject. |
||
State of the geo object. Defined by the following fields:
Inherited from GeoObject. |
Events
Name |
Description |
Closing the balloon. Instance of the Event class. Inherited from GeoObject. |
|
Opening a balloon on a geo object. Instance of the Event class. Inherited from GeoObject. |
|
Event preceding the "drag" event. Instance of the Event class. Names of fields that are available via the Event.get method:
Inherited from GeoObject. |
|
Event preceding the "dragstart" event. Instance of the Event class. Names of fields that are available via the Event.get method:
Inherited from GeoObject. |
|
Single left-click on the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Inherited from IDomEventEmitter. |
|
Calls the element's context menu. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Inherited from IDomEventEmitter. |
|
Double left-click on the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Inherited from IDomEventEmitter. |
|
Dragging a geo object. Instance of the Event class. Names of fields that are available via the Event.get method:
Inherited from GeoObject. |
|
End of geo object dragging. Instance of the Event class. Names of fields that are available via the Event.get method:
Inherited from GeoObject. |
|
Start of geo object dragging. Instance of the Event class. Names of fields that are available via the Event.get method:
Inherited from GeoObject. |
|
Change in the state of the editor for the geo object's geometry. Instance of the Event class. Names of fields that are available via the Event.get method:
Inherited from GeoObject. |
|
Change to the geo object geometry. Instance of the Event class. Names of fields that are available via the Event.get method:
Inherited from IGeoObject. |
|
Closing the hint. Instance of the Event class. Inherited from GeoObject. |
|
Opening a hint on a geo object. Instance of the Event class. Inherited from GeoObject. |
|
Map reference changed. Data fields:
Inherited from IParentOnMap. |
|
Pressing the mouse button over the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Inherited from IDomEventEmitter. |
|
Pointing the cursor at the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Inherited from IDomEventEmitter. |
|
Moving the cursor off of the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Inherited from IDomEventEmitter. |
|
Moving the cursor over the object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Inherited from IDomEventEmitter. |
|
Letting go of the mouse button over an object. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Inherited from IDomEventEmitter. |
|
End of multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface. Inherited from IDomEventEmitter. |
|
Repeating event during multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Defines the touches property, which contains a list of touches. Every touch is described by an object that contains the following fields:
Inherited from IDomEventEmitter. |
|
Start of multitouch. This event is only available on devices that support multitouch. Returns an implementation of the IMultiTouchEvent interface with information about touches. Defines the touches property, which contains a list of touches. Every touch is described by an object that contains the following fields:
Inherited from IDomEventEmitter. |
|
Change to the object options. Inherited from ICustomizable. |
|
Change to the geo object overlay. Instance of the Event class. Names of fields that are available via the Event.get method:
Inherited from IGeoObject. |
|
The parent object reference changed. Data fields:
Inherited from IChild. |
|
Change to the geo object data. Instance of the Event class. Names of fields that are available via the Event.get method:
Inherited from IGeoObject. |
|
Mouse wheel scrolling. When using, keep in mind that mouse events are emulated when a touch screen is used. Instance of the MapEvent class. More information is available in domEvent.manager. Inherited from IDomEventEmitter. |
Methods
Name |
Returns |
Description |
getMap() |
Returns reference to the map. Inherited from IParentOnMap. |
|
Returns the promise object, which is confirmed by the overlay object at the time it is actually created, or is rejected with an appropriate error message. Inherited from IGeoObject. |
||
IOverlay|null |
The method provides synchronous access to the overlay. Inherited from IGeoObject. |
|
IParentOnMap|null |
Returns link to the parent object, or null if the parent element was not set. Inherited from IChildOnMap. |
|
Sets the parent object. If the null value is passed, the manager element will only be deleted from the current parent object. Inherited from IChildOnMap. |
Fields details
editor
{geometryEditor.Point} editor
The "Point" geometry editor.
geometry
{geometry.Point} geometry
The "Point" type of geometery.
Mandatory parameter/option.