Overview of YMapsML
YMapsML is an XML language intended for describing and displaying various geographical objects in the Yandex.Maps service.
YMapsML is based on the XML standard and is an extension of the GML standard.
The root element of a YMapsML document is ymaps:ymaps. The attributes for this element define the XML namespace and the XSD schema being used.
The ymaps:ymaps element, in turn, can contain several tags that serve as containers for various data or groups of data that are displayed on a map.
- attr:Attribution
- It is a container for the attr:Source tag.
- repr:Representation
- It is a container for the repr:View, repr:Style, and repr:Template tags.
- ymaps:GeoObjectCollection
- A container for descriptions of the objects placed on a map. You can use this element to set shared properties, such as styles, for a set of geographical objects. The ymaps:GeoObjectCollection element can contain nested ymaps:GeoObjectCollection elements, but it can only be present once in the ymaps:ymaps element.
In general terms, a YMapsML document looks like this:
<?xml version="1.0" encoding="utf-8"?>
<ymaps:ymaps xmlns:ymaps="https://maps.yandex.ru/ymaps/1.x"
xmlns:gml="http://www.opengis.net/gml"
xmlns:repr="https://maps.yandex.ru/representation/1.x"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="https://maps.yandex.ru/schemas/ymaps/1.x/ymaps.xsd">
<repr:Representation>
<repr:View>
<repr:mapType>HYBRID</repr:mapType>
<gml:boundedBy>
<gml:Envelope>
<gml:lowerCorner>32.805985 39.915474</gml:lowerCorner>
<gml:upperCorner>32.858513 39.865093</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>
</repr:View>
<repr:Style gml:id="customStyle">
<repr:parentStyle>default#greenPoint</repr:parentStyle>
<repr:iconStyle>
<repr:href>https://info.maps.yandex.net/api/i/steelblue/dot.png</repr:href>
<repr:size x="26" y="46"/>
<repr:offset x="-22" y="-46"/>
<repr:shadow>
<repr:href>https://info.maps.yandex.net/api/i/dot_shadow.png</repr:href>
<repr:size x="25" y="23"/>
<repr:offset x="0" y="-25"/>
</repr:shadow>
</repr:iconStyle>
<repr:lineStyle>
<repr:strokeColor>ff003399</repr:strokeColor>
<repr:strokeWidth>5</repr:strokeWidth>
</repr:lineStyle>
<repr:balloonContentStyle>
<repr:template>#customTemplate</repr:template>
</repr:balloonContentStyle>
</repr:Style>
<repr:Template gml:id="customTemplate">
<repr:text><![CDATA[<div
style="color:blue">$[description]</div>]]></repr:text>
</repr:Template>
</repr:Representation>
<Attribution>
<Source id="source">
<author>
<name>Source name</name>
<uri>maps.yandex.com.tr</uri>
</author>
</Source>
</Attribution>
<ymaps:GeoObjectCollection>
<ymaps:style>#customStyle</ymaps:style>
<gml:featureMembers>
<ymaps:GeoObject>
<gml:description>Description</gml:description>
<gml:Point>
<gml:pos>32.830618 39.889957</gml:pos>
</gml:Point>
</ymaps:GeoObject>
<ymaps:GeoObject>
<gml:LinearRing>
<gml:pos>32.823752 39.894651</gml:pos>
<gml:pos>32.824009 39.883213</gml:pos>
<gml:pos>32.835597 39.882486</gml:pos>
<gml:pos>32.834395 39.895775</gml:pos>
<gml:pos>32.823752 39.894651</gml:pos>
</gml:LinearRing>
</ymaps:GeoObject>
</gml:featureMembers>
</ymaps:GeoObjectCollection>
</ymaps:ymaps>