Yandex projects that involve cartographic services use this format to exchange data. The Yandex.Maps geocoding service accepts calls over the HTTP protocol and returns the response in YMapsML format.
Based on the information provided here, we can define the main uses for YMapsML:
Creating a YMapsML file is easy — just use any text editor to enter the necessary information in accordance with the language specification. To get an idea of what a YMapsML file looks like, see the examples provided in this guide. These examples are convenient to use as starting points for your own experiments.
Of course, manual editing of YMapsML files is fairly rare. The files are usually generated automatically, for example, based on the information contained in a database. YMapsML is an XML format. Almost all modern programming languages and development environments include tools for presenting data in XML. So automatic generation of YMapsML files is not a particularly difficult task.
Currently, a large amount of geographical data is presented in XML formats. This can be shown by the large number of languages that are GML application schemas or profiles. It doesn't require much effort to display this type of data on Yandex.Maps — it is sufficient to convert them to YMapsML format (for example, using XSLT).
On the Examples page you can see an example of Yandex.Maps displaying earthquake information, where the earthquake data is originally supplied in GeoRSS format. YMapsML is used as a transitional format that is easy to convert GeoRSS feeds to.
Exporting information from user maps in the My Maps service.
The My mapshttp://maps.yandex.com.tr/?um service gives users the opportunity to create and save personal maps that display sections of an area with markers placed on them.
Getting information from the geocoding service via HTTP request.
The geocoding service can determine the coordinates of a geographical object and get information about it, based on its name or address. And vice-versa, the address of an object on a map can be determined by its coordinates — reverse geocoding.
Results are returned in YMapsML format. This means that objects that are found can immediately be placed on Yandex.Maps. In addition, the resulting data is easy to analyze visually or extract using software.
Using YMapsML as a storage format for geographical data.
YMapsML can be used when geographical data needs to be in a format that is convenient for both use and storage. Geographical data is often stored in databases, or in the internal notation of various software.
If it is necessary to make reserve copies or transfer data to “external” programs, the issue arises of choosing a format for representing the information. In this case, YMapsML could be the right decision. Data in this format is easy to analyze visually, and can be processed by the Yandex.Maps API as well as software that supports GML 3.x.
<?xml version="1.0" encoding="windows-1251"?> <ymaps:ymaps xmlns:ymaps="http://maps.yandex.ru/ymaps/1.x" xmlns:repr="http://maps.yandex.ru/representation/1.x" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maps.yandex.ru/schemas/ymaps/1.x/ymaps.xsd"> <ymaps:GeoObjectCollection> <gml:name>Mosques</gml:name> <gml:featureMembers> <ymaps:GeoObject> <gml:name>Sultan Ahmed Mosque</gml:name> <gml:description>The Sultan Ahmed Mosque is popularly known as the Blue Mosque for the blue tiles adorning the walls of its interior.</gml:description> <gml:Point> <gml:pos>28.976896 41.005346</gml:pos> </gml:Point> </ymaps:GeoObject> </gml:featureMembers> </ymaps:GeoObjectCollection> </ymaps:ymaps>
The file contains information about the geographical object where Mikhail Bulgakov's novel begins. The position of the object is marked on the map by a dot with the specified geographical coordinates.
To load the YMapsMl file, the
load method is used. After the data are loaded, the
load method transforms them into a
GeoObjectCollection object and passes the object reference to the handler function.
When viewed in a browser, this page will look like this: