Examples | Static API | 2GIS Documentation

Examples Static API

To display a simple map without additional objects, specify its size, center, and zoom level.

If there are additional objects on the map, you can omit the center and zoom level, the map will be adjusted automatically.

https://static.maps.2gis.com/1.0?s=880x300&c=55.05888,82.91118&z=15

Blank map

You can add markers to the map in the shape of circles, pins, or with a custom image. For circles and pins, you can specify the color, size and add numbering.

Marker types

By default, the marker is displayed as a small blue pin. In the parameters, you can specify the shape of the marker (circle or pin), one of nine colors, large or small size.

https://static.maps.2gis.com/1.0?s=880x300&pt=55.71433,37.56050~k:p~c:rd~s:s&pt=55.70433,37.57050~k:c~c:gn~s:l

Predefined marker styles

The marker may be assigned a number from 1 to 99. The number can be assigned both for a pin and for a circle.

You can't set a color or size for a numbered marker.

https://static.maps.2gis.com/1.0?s=880x300&pt=55.71433,37.56050~n:1&pt=55.70433,37.57050~k:c~n:2

Marker styles with numbering

You can specify a custom image for the marker using URL.

Custom marker (URL)

The image for the marker can be specified in Base64 format.

https://static.maps.2gis.com/1.0?s=880x300&pt=55.70433,37.57050~b:iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAMAAAAM7l6QAAABQVBMVEUAAAAAAP9Pe7lNd7NKe7VQeLdLeLRPfbVOerdMd7NQerVOeLZNerNPe7ROebZPebRPe7ZOebRNebZPe7NOebRNe7VQfLdRe7ZQe7dQfbdPfLhSfrlTf7pTfrlRfrlSf7lSfbhSfrpRfbhRfLdQfbhQfblRfblSfblRfrlSfrlRfrlSfbhQfbdRfbhQfLdQfbdRfblVgbtVgbxXhL5YhL5YhMBZhMBRfbhTgbtUgLtUgbtUgbxXhL9RfbhPe7dPe7ZPe7dpldBqlNBqltFQe7Zpls9pl9BrltBrl9BxnddyntdxndZxnddynddyntd6puB6p%2BF8p%2BF8qOF8qOJ8qeJ8qeN9qOKBreaCrueHtO2ItO2ItO6KtvCLt%2FCOufCQuvGRu%2FGpyvSqyvTG3Pjm7%2Fzv9f3w9f3w9v38%2Ff%2F%2B%2Fv%2F%2F%2F%2F%2BT0lLZAAAAT3RSTlMAAR0eHyAiLS4vMDEyOjs9TU5QUVJTgIGDg4TLy8zNzc7O0ODh4eLk5eXm5%2B3t7u7v8fHx8fHx8vLy8vLy8%2Ff4%2BPj4%2BPn5%2Bfn5%2Bvr7%2B%2Fv790vtUwAAAAFiS0dEaiVilQ4AAAFRSURBVCjPY2AgFnBLKWq6uGjKS3BjyjGKqBm5BURER4cHuFurCqPJsiqZBsfCQZCJAjOyLL%2BuV0wsEojx1edDkjUPi0UDIeZweRa9oFgMEGrABnWVkl8sFuAjB5EWNYHamwUCmWnJ8RD7zYTAmtVgbs6CghSIfKAKSJrHMBYuDSTiEtOzkiF8S06gtJQHinRsbGJWKoTvJgmUVgxAk07IyoDw%2FWWB0toRaNJJMN0RGkBp%2B2hUu5PgdkfbA6UdomKxuzw20g4orRWBIp2ZCvV3bGy4BjanwYG%2FDFBawhmXtJMYUJrLGpe0BTso2FSCsEsHKIOjRBgRJShJwkYAEmUKvtgi1FMamhyY9QKxJAddJlhy4bMNRpcNMudFJDY%2BHU%2FUpOitz4ucVFnkTJAsCDCWZkJL6UIqVq7%2B4cBs4O9opSyIJRNxSspq2tury4pzEJ3vAFWY0vzr8IKOAAAAAElFTkSuQmCC

Custom marker (Base64)

You can add polylines with the specified color and width to the map.

https://static.maps.2gis.com/1.0?s=880x300&ls=55.73740,37.52284,55.74033,37.53542,55.72481,37.55050~w:5&ls=55.72481,37.55050,55.71790,37.56943,55.72634,37.58097~c:a23fb5~w:5

Lines

You can add polygons to the map with the specified color and width of the outline, as well as the fill color.

https://static.maps.2gis.com/1.0?size=880x300&pn=59.99051,30.19207,59.99284,30.20503,59.98907,30.20292~c:22fe46~f:22fe46a1~w:2&pn=59.99233,30.20822,59.99121,30.21735,59.98738,30.21537,59.98856,30.20592~w:5&pn=59.99054,30.21812,59.98655,30.22571,59.98773,30.21646~c:ed3125~f:ed3125

Polygons

You can add any objects to the map according to the GeoJSON (RFC 7946) specification and set their style in the properties fields similar to URL parameters.

{
    "type": "FeatureCollection",
    "features": [{
        "type": "Feature",
        "geometry": {
            "type": "LineString",
            "coordinates": [
                [ 82.91871, 55.03652 ],
                [ 82.92131, 55.02711 ],
                [ 82.92698, 55.02470 ]
            ]
        },
        "properties": {
            "w": 5
        }
    }, {
        "type": "Feature",
        "geometry": {
            "type": "Point",
            "coordinates": [ 82.92698, 55.02470 ]
        },
        "properties": {
            "k": "c",
            "n": 1
        }
    }, {
        "type": "Feature",
        "geometry": {
            "type": "Polygon",
            "coordinates": [[
                [ 82.89827, 55.03687 ],
                [ 82.90021, 55.03489 ],
                [ 82.91062, 55.03264 ],
                [ 82.91355, 55.03636 ],
                [ 82.90925, 55.04067 ],
                [ 82.89827, 55.03687 ]
            ]]
        },
        "properties": {
            "c": "03ee10",
            "f": "03ee10a0"
        }
    }]
}
https://static.maps.2gis.com/1.0?s=880x450&z=14&g=%7B%22type%22%3A%22FeatureCollection%22%2C%22features%22%3A%5B%7B%22type%22%3A%22Feature%22%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B82.91871%2C55.03652%5D%7D%2C%22properties%22%3Anull%7D%2C%7B%22type%22%3A%22Feature%22%2C%22geometry%22%3A%7B%22type%22%3A%22LineString%22%2C%22coordinates%22%3A%5B%5B82.91871%2C55.03652%5D%2C%5B82.92131%2C55.02711%5D%2C%5B82.92698%2C55.02470%5D%5D%7D%2C%22properties%22%3A%7B%22w%22%3A5%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22geometry%22%3A%7B%22type%22%3A%22Point%22%2C%22coordinates%22%3A%5B82.92698%2C55.02470%5D%7D%2C%22properties%22%3A%7B%22k%22%3A%22c%22%2C%22n%22%3A1%7D%7D%2C%7B%22type%22%3A%22Feature%22%2C%22geometry%22%3A%7B%22type%22%3A%22Polygon%22%2C%22coordinates%22%3A%5B%5B%5B82.89827%2C55.03687%5D%2C%5B82.90021%2C55.03489%5D%2C%5B82.91062%2C55.03264%5D%2C%5B82.91355%2C55.03636%5D%2C%5B82.90925%2C55.04067%5D%2C%5B82.89827%2C55.03687%5D%5D%5D%7D%2C%22properties%22%3A%7B%22c%22%3A%2203ee10%22%2C%22f%22%3A%2203ee10a0%22%7D%7D%5D%7D

GeoJSON

Use HD mode for Retina and other high pixel density displays. In this mode, the map and all its objects, except the custom markers, will be enlarged twice, which will increase the clarity of the image at the same visual size.

https://static.maps.2gis.com/1.0?s=880x450@2x&z=14&pt=55.03652,82.91871&ls=55.03652,82.91871,55.02711,82.92131,55.02470,82.92698~w:5&pt=55.02470,82.92698~k:c~n:1&ls=55.03652,82.91871,55.03758,82.93058,55.04042,82.92996~c:ff0000&pt=55.04042,82.92996~k:c~n:2&pn=55.03687,82.89827,55.04067,82.90925,55.03636,82.91355,55.03264,82.91062,55.03489,82.90021~c:03ee10~f:03ee10a0&pt=55.03484,82.92290~k:c~c:pe

HD Map