Static function.

Forms a data set from the specified source and creates an instance of GeoQueryResult based on it.

Returns result containing data from the source.

{ GeoQueryResult } geoQuery(source)


Parameter Default value Description
source *

Type: Object

Source of geo objects:
  • IGeoObject - Object that implements the corresponding interface.
  • IGeoObject[] - Array of objects that implement the corresponding interface.
  • ICollection - Collection of objects that implement the IGeoObject interface.
  • ICollection[] - Array of object collections that implement the IGeoObject interface.
  • vow.Promise - A promise object that passes the data source for geoQuery to the handler function. The handler function can also be passed an object with the geoObjects field containing the data source for geoQuery.
  • GeoQueryResult - Object of the GeoQueryResult class.
  • String|Object - String or object with a JSON description of objects.
JSON object descriptions are formed using the following approach (see the example below). An object may be an entity or a collection of entities. A collection of entities is made up of an object with the following fields:
  • type - Type of object. The value of the field must be "FeatureCollection".
  • features - Array of child entities in the collection. Child objects may be entities or nested collections of entities.
An entity is made up of an object with the following fields:
  • type - Type of object. The value of the field must be "Feature".
  • geometry - Object geometry. Contains the "type" and "coordinates" fields. Corresponds to the parameter passed to the constructor for the ymaps.GeoObject object.
  • options - Options for the geo object.
  • properties - Geo object data.

* Mandatory parameter/option.



// Creating GeoQueryResult from a single geo object.
var placemark = new ymaps.Placemark([34, 56]);


// Creating GeoQueryResult from an array of geo objects.
var objects = [
        new ymaps.Placemark([34, 56]),
        new ymaps.Rectangle([[34, 56], [36, 57]])


// Creating GeoQueryResult from a collection of geo objects.
var result = ymaps.geoQuery(myMap.geoObjects).searchIntersect(myMap);
alert("Number of geo objects in the visible map area: " + result.getLength());


// Creating GeoQueryResult from vow.Deferred.
var result = ymaps.geoQuery(ymaps.geocode('Siromyatnicheskiy lane')).searchInside(myGeoBounds);
// Because the data source is asynchronous, we must wait for result processing.
result.then(function () {
    alert('Number of objects located inside the specified area: ' + result.getLength());


// Creating GeoQueryResult from JSON.
var result = ymaps.geoQuery({
    type: 'FeatureCollection',
    features: [
            type: 'Feature',
            geometry: {
                type: 'Circle',
                coordinates: [15, 15],
                radius: 100
            type: 'Feature',
            geometry: {
                type: 'LineString',
                coordinates: [[15, 16], [66, 23]]
            type: 'FeatureCollection',
            features: [
                    type: 'Feature',
                    geometry: {
                        type: 'Point',
                        coordinates: [12, 41]
                    properties: {
                        name: 'point'
                    options: {
                        preset: 'islands#yellowIcon'
// Adding non-point objects to the map as-is.'geometry.type != "Point"').addToMap(myMap);
// Adding point objects to the map via the clusterer.
myMap.geoObjects.add('geometry.type == "Point"').clusterize());