---
metadata:
  - name: generator
    content: Diplodoc Platform v5.39.1
alternate:
  - https://yandex.com/dev/jsapi-v2-1/doc/en/v2-1/examples/cases/placemarks_in_circle.md
  - https://yandex.com/dev/jsapi-v2-1/doc/ru/v2-1/examples/cases/placemarks_in_circle.md
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com/dev/jsapi-v2-1/doc/en/llms.txt

# Points falling within a circle

<iframe id="LIVE-EXAMPLE" style="width:100%;height: 400px;border-radius: 8px;border: 1px solid rgba(92, 94, 102, 0.14);" frameBorder="0" src="https://yastatic.net/s3/front-maps-static/maps-front-jsapi-v2-1/examples/2/out/s3-cases/en/placemarks_in_circle/index.html" allow="fullscreen"></iframe>

<a target="_blank" rel="noopener noreferrer" style="display: inline-block;margin-top: 10px;cursor: pointer;border-radius: 4px;padding: 9px 12px;background: #151515;color: white;text-decoration: none;font-weight: 500" href="https://codesandbox.io/p/sandbox/qjcktj?file=index.html">Open in CodeSandbox</a>

<div id="references">
    <a href="https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ready">ready</a>,
    <a href="https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map">Map</a>,
    <a href="https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Placemark">Placemark</a>,
    <a href="https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Circle">Circle</a>,
    <a href="https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/geoQuery">geoQuery</a>,
    <a href="https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoQueryResult">GeoQueryResult</a>
</div>
<p>
    You can use the <a href="https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoQueryResult">GeoQueryResult</a> class to create a set of placemarks on the map from JSON descriptions of their geometries.
</p>
<p>
    This example shows how to check whether objects fall within a circular area and change their options via <a href="https://yandex.ru/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/GeoQueryResult">GeoQueryResult</a>.
</p>

{% list tabs %}

-   index.html

    ```html
    <!DOCTYPE html>

    <html>
        <head>
            <title>Examples. Objects falling within a circle.</title>
            <meta
                http-equiv="Content-Type"
                content="text/html; charset=UTF-8"
            />
            <!--
            Set your own API-key. Testing key is not valid for other web-sites and services.
            Get your API-key on the Developer Dashboard: https://developer.tech.yandex.ru/keys/
        -->
            
            
            
        </head>
        <body>
            <p>Drag the circle and watch the placemark's color</p>
            <div id="map"></div>
        </body>
    </html>
    ```

-   placemarks_in_circle.js

    ```js
    ymaps.ready(init);

    function init() {
        var myMap = new ymaps.Map(
                "map",
                {
                    center: [55.43, 37.75],
                    zoom: 8,
                },
                {
                    searchControlProvider: "yandex#search",
                }
            ),
            objects = ymaps
                .geoQuery([
                    {
                        type: "Point",
                        coordinates: [55.73, 37.75],
                    },
                    {
                        type: "Point",
                        coordinates: [55.1, 37.45],
                    },
                    {
                        type: "Point",
                        coordinates: [55.25, 37.35],
                    },
                ])
                .addToMap(myMap),
            circle = new ymaps.Circle([[55.43, 37.7], 10000], null, {
                draggable: true,
            });

        circle.events.add("drag", function () {
            // Objects that fall in the circle will turn red.
            var objectsInsideCircle = objects.searchInside(circle);
            objectsInsideCircle.setOptions("preset", "islands#redIcon");
            // The remaining objects are blue.
            objects
                .remove(objectsInsideCircle)
                .setOptions("preset", "islands#blueIcon");
        });
        myMap.geoObjects.add(circle);
    }
    ```

{% endlist %}
