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

Creating your own map

Save as filesEdit on JSFiddle

The Yandex.Maps API can be used for displaying maps and plans on a website that aren't anchored to the earth's surface.

Before creating a map, you need to set your own layer with the map image. Pass the data source for the map to the class constructor. The data source provides the tiles for the layer according to the current coordinates of the map center and the zoom level.

To use an image as a custom Yandex.Maps layer, you need to prepare it first. The image must be divided into sections (tiles) with the dimensions 256x256 pixels. Each tile is stored in a separate file (JPEG or PNG). For each zoom level, you must form a corresponding set of tiles.

Then create a new map type using the MapType class. When creating the map type, specify the following parameters:

  • name of the type
  • array of layer constructors or a key.

Creating a map and setting a custom map type for it. This can be done via the constructor's type parameter or the setType method of the class instance.

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