Tüm Ürünler
Search
Belge Merkezi

Tablestore:Coğrafi sorgu

Son Güncelleme:Oct 02, 2026

Coğrafi sorgular; mesafeye göre coğrafi sorgu, sınırlayıcı kutuya göre coğrafi sorgu ve çokgene göre coğrafi sorgu olmak üzere üç türe ayrılır.

Ön koşullar

Mesafeye göre coğrafi sorgu

Mesafeye göre coğrafi sorguyu kullanarak bir merkez nokta ve yarıçaptan oluşan dairesel coğrafi alanı sorguda filtreleme koşulu olarak belirtebilirsiniz. Tablestore, Geopoint sütunundaki değeri bu dairesel coğrafi alan içinde kalan satırları döndürür.

  • Parametreler


    Parametre


    Açıklama


    tableName


    Veri tablosunun adı.


    indexName


    Arama dizininin adı.


    query


    Sorgu türü. Sorgu türünü TableStore.QueryType.GEO_DISTANCE_QUERY olarak ayarlayın.


    fieldName


    Alanın adı. Alan değerlerinin türü Geopoint'tir.


    centerPoint

    Merkez noktanın koordinat çifti. Koordinat çifti enlem ve boylam değerlerinden oluşur.

    Bu parametre değeri "enlem,boylam" biçiminde olmalıdır. Enlem için geçerli değerler: [-90,90]. Boylam için geçerli değerler: [-180.180]. Örnek: “35,8,-45,91".


    distance


    Dairesel coğrafi alanın yarıçapı. Bu parametrenin değeri DOUBLE veri türündedir. Birim: metre.

  • Örnekler

    Aşağıdaki örnek kod, Col_GeoPoint sütunundaki değerin belirli bir dairesel coğrafi alan içinde kaldığı satırları nasıl sorgulayacağınızı gösterir.

    client.search({
        tableName: TABLE_NAME,
        indexName: INDEX_NAME,
        searchQuery: {
            offset: 0,
            limit: 10, // To query only the number of rows that meet the query conditions without specific data, set the limit parameter to 0. 
            query: { // Set the query type to TableStore.QueryType.GEO_DISTANCE_QUERY. 
                queryType: TableStore.QueryType.GEO_DISTANCE_QUERY,
                query: {
                    fieldName: "Col_GeoPoint",
                    centerPoint: "1.1", // Specify the coordinate pair for the central point. 
                    distance: 10000 // Set the distance from the central point to a value smaller than or equal to 10,000. Unit: meter. 
                }
            },
            getTotalCount: true // Specify whether to return the total number of rows that meet the query conditions. Default value: false. 
        },
        columnToGet: { // Specify the columns that you want to return. You can set the parameter to RETURN_SPECIFIED to return the specified columns, RETURN_ALL to return all columns, RETURN_ALL_FROM_INDEX to return all columns in the search index, or RETURN_NONE to return only the primary key columns. 
            returnType: TableStore.ColumnReturnType.RETURN_ALL
        }
    }, function (err, data) {
        if (err) {
            console.log('error:', err);
            return;
        }
        console.log('success:', JSON.stringify(data, null, 2));
    });

Sınırlayıcı kutuya göre coğrafi sorgu

Sınırlayıcı kutuya göre coğrafi sorguyu kullanarak dikdörtgen bir coğrafi alanı sorguda filtreleme koşulu olarak belirtebilirsiniz. Tablestore, Geopoint sütunundaki değerin bu dikdörtgen coğrafi alan içinde kaldığı satırları döndürür.

  • Parametreler


    Parametre


    Açıklama


    tableName


    Veri tablosunun adı.


    indexName


    Arama dizininin adı.


    query


    Sorgu türü. Sorgu türünü TableStore.QueryType.GEO_BOUNDING_BOX_QUERY olarak ayarlayın.


    fieldName


    Alanın adı. Alan değerlerinin türü Geopoint'tir.


    topLeft


    Dikdörtgen coğrafi alanın sol üst köşesinin koordinat çifti.


    bottomRight

    Dikdörtgen coğrafi alanın sağ alt köşesinin koordinat çifti. Sol üst ve sağ alt köşelerin koordinat çiftleri benzersiz bir dikdörtgen coğrafi alan tanımlar.

    Bu parametre değeri "enlem,boylam" biçiminde olmalıdır. Enlem için geçerli değerler: [-90,90]. Boylam için geçerli değerler: [-180.180]. Örnek: “35,8,-45,91".

  • Örnekler

    Aşağıdaki örnek kod, sol üst köşe koordinat çifti "10,0" ve sağ alt köşe koordinat çifti "0,10" olan dikdörtgen bir coğrafi alan içinde Col_GeoPoint sütunundaki değerin kaldığı satırları nasıl sorgulayacağınızı gösterir:

    client.search({
        tableName: TABLE_NAME,
        indexName: INDEX_NAME,
        searchQuery: {
            offset: 0,
            limit: 10, // To query only the number of rows that meet the query conditions without specific data, set the limit parameter to 0. 
            query: { // Set the query type to TableStore.QueryType.GEO_BOUNDING_BOX_QUERY. 
                queryType: TableStore.QueryType.GEO_BOUNDING_BOX_QUERY,
                query: {
                    fieldName: "Col_GeoPoint", // Specify the name of the field. 
                    topLeft: "10.0", // Specify the coordinate pair for the upper-left corner of the rectangular geographical area. 
                    bottomRight: "0.10" // Specify coordinate pair for the lower-right corner of the rectangular geographical area. 
                }
            },
            getTotalCount: true // Specify whether to return the total number of rows that meet the query conditions. Default value: false. 
        },
        columnToGet: { // Specify the columns that you want to return. You can set the parameter to RETURN_SPECIFIED to return the specified columns, RETURN_ALL to return all columns, RETURN_ALL_FROM_INDEX to return all columns in the search index, or RETURN_NONE to return only the primary key columns. 
            returnType: TableStore.ColumnReturnType.RETURN_ALL
        }
    }, function (err, data) {
        if (err) {
            console.log('error:', err);
            return;
        }
        console.log('success:', JSON.stringify(data, null, 2));
    });

Çokgene göre coğrafi sorgu

Çokgene göre coğrafi sorguyu kullanarak bir çokgen coğrafi alan belirtebilirsiniz. Tablestore, Geopoint sütunundaki değerin bu çokgen coğrafi alan içinde kalan satırları döndürür.

  • Parametreler


    Parametre


    Açıklama


    tableName


    Veri tablosunun adı.


    indexName


    Arama dizininin adı.


    query


    Sorgu türü. Sorgu türünü TableStore.QueryType.GEO_POLYGON_QUERY olarak ayarlayın.


    fieldName


    Alanın adı. Alan değerlerinin türü Geopoint'tir.


    points

    Çokgen coğrafi alanı tanımlayan noktaların koordinat çiftleri.

    Her noktanın koordinat çifti "enlem,boylam" biçiminde olmalıdır. Enlem için geçerli değerler: [-90,90]. Boylam için geçerli değerler: [-180.180]. Örnek: “35,8,-45,91".

  • Örnekler

    Aşağıdaki örnek kod, Col_GeoPoint sütunundaki değerin bir çokgen coğrafi alan içinde kaldığı satırları nasıl sorgulayacağınızı gösterir:

    client.search({
        tableName: TABLE_NAME,
        indexName: INDEX_NAME,
        searchQuery: {
            offset: 0,
            limit: 10, // To query only the number of rows that meet the query conditions without specific data, set the limit parameter to 0. 
            query: { // Set the query type to TableStore.QueryType.GEO_POLYGON_QUERY. 
                queryType: TableStore.QueryType.GEO_POLYGON_QUERY,
                query: {
                    fieldName: "Col_GeoPoint",
                    points: ["0,0","5,5","5,0"] // Specify coordinate pairs for vertices of a polygon geographical area. 
                }
            },
            getTotalCount: true // Specify whether to return the total number of rows that meet the query conditions. Default value: false. 
        },
        columnToGet: { // Specify the columns that you want to return. You can set the parameter to RETURN_SPECIFIED to return the specified columns, RETURN_ALL to return all columns, RETURN_ALL_FROM_INDEX to return all columns in the search index, or RETURN_NONE to return only the primary key columns. 
            returnType: TableStore.ColumnReturnType.RETURN_ALL
        }
    }, function (err, data) {
        if (err) {
            console.log('error:', err);
            return;
        }
        console.log('success:', JSON.stringify(data, null, 2));
    });

SSS

İlgili Başlıklar