Version:
Popular examples
Map
Geo objects
Balloon and hint
Controls
Hotspots
Clustering
GeoQuery
Behaviors and events
Search on a map
Traffic
User's location
Routing
YMapsML
GeoXML
ObjectManager
Modular system
Panoramas
External modules

Using a custom image for the placemark

Save as filesEdit on JSFiddle

The API provides the ability to set custom images for placemarks.

To set a desired image, specify the following options for the placemark:

  • iconLayout: "default#image";
  • iconImageHref: {URL of the graphic file}.

To set the image with the content specify the following placemark options:

  • iconLayout: "default#imageWithContent";
  • iconImageHref: {URL of the graphic file}.
And also specify the content of the geo object icon:
  • iconContent: 'content';

You can also set the options iconImageSize (width and height of the image in pixels), iconImageOffset (the offset of the icon's upper-left corner relative to the anchor point), iconImageClipRect (coordinates of the displayed area of the source image, in pixels), iconContentOffset (the offset of the text relative to the placemark's anchor point) and iconContentLayout (content layout).

Пишете на JavaScript? У нас есть вакансии
Mon Oct 31 2022 13:07:25 GMT+0300 (Moscow Standard Time)