---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideGeoPoint - Global

# GlideGeoPoint - Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 4 minutes to read

The GlideGeoPoint API enables you to get and set geopoint data type values in a table.

This API is available by default. The geopoint data type allows you to store a latitude and longitude values in a single field within a table. Using the GlideGeoPoint API, you can instantiate new GlideGeoPoint
objects, create new geopoints for a specific table, or retrieve single latitude, longitude or geotype values. For additional information on how to implement specific use cases like inserting new records using a geopoint, computing
distances between geopoint locations, or querying for nearby geopoint locations, see [GlideGeoPoint Developer Guide](https://servicenow-prod.fluidtopics.net/wLTtIOa7_XaH9MNEXCixxA#geopoint-dev-guide "The GlideGeoPoint developer guide contains information about how to compute distances between latitude and longitude values (geopoints), return locations within given geopoint and radius values, and use additional functionality provided by supported GlideGeoPoint API functions.").  
Key aspects of the geotype data type are:

* It consists of a pair of decimal numbers representing longitude and latitude values.
* The range for longitude is (-180, 180\]. Any value outside this range is normalized to the equivalent value inside this range.
* The range for latitude is \[-90, 90\]. Any value outside this range is normalized to the equivalent value inside this range.
* Geopoint values are always accepted as input and display as a comma-separated pair: "longitude,latitude". Parentheses may optionally surround the expression.
* Both longitude and latitude values are stored up to 6 decimal places of precision.  
Note:  
GlideGeoPoint API values are always listed in longitude, latitude order.

The examples on this page assume that a custom table is pre-populated with fields containing the geopoint field type. For more information about this data type, see [Geo point field type](https://www.servicenow.com/docs/access?context=geo-point-field-type&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US) and [Function field](https://www.servicenow.com/docs/access?context=platform-support-functions&version=xanadu&pubname=xanadu-platform-administration&ft:locale=en-US).

## GlideGeoPoint - GlideGeoPoint() {#ariaid-title2}

Instantiates a GlideGeoPoint object. The GlideGeoPoint object adds semantic awareness to longitude and latitude values that are otherwise stored as strings.
{#GlideGeoPoint-GlideGeoPoint__table_dhw_y13_mxb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#GlideGeoPoint-GlideGeoPoint__table_dhw_y13_mxb}  
The following example shows how to initialize a new GlideGeoPoint object as a null value.

    var gp = new GlideGeoPoint();

## GlideGeoPoint - GlideGeoPoint(String longitude, String latitude) {#ariaid-title3}

Instantiates the GlideGeoPoint object according to provided
longitude and latitude values.
{#GlideGeoPoint-GlideGeoPoint_S_S__table_jf5_zvc_wxb__entry__3}

| Name | Type | Description |
|-|-|-|
| longitude | String | The longitude coordinate of the geopoint. |
| latitude | String | The latitude coordinate of the geopoint. |
[Table 2. Parameters]

{#GlideGeoPoint-GlideGeoPoint_S_S__table_jf5_zvc_wxb} {#GlideGeoPoint-GlideGeoPoint_S_S__table_kf5_zvc_wxb__entry__2}

| Type | Description |
|-|-|
| geopoint | The resultant GlideGeoPoint object. |
[Table 3. Returns]

{#GlideGeoPoint-GlideGeoPoint_S_S__table_kf5_zvc_wxb}  
The following example shows how providing longitude and latitude values initializes the object accordingly.

    // Providing longitude and latitude values initializes the object accordingly 
    var gp = new GlideGeoPoint(10.123, 25.987);  
    gs.info("geopoint: " + gp);

Output:

    geopoint: 10.123000,25.987000

## GlideGeoPoint - GlideGeoPoint(Object geoPoint) {#ariaid-title4}

Copies longitude and latitude points values to instantiate a new GlideGeoPoint object.
{#GlideGeoPoint-GlideGeoPoint_O__table_egf_cxc_wxb__entry__3}

| Name | Type | Description |
|-|-|-|
| geoPoint | Object | The geopoint instance that you want copy. |
[Table 4. Parameters]

{#GlideGeoPoint-GlideGeoPoint_O__table_egf_cxc_wxb} {#GlideGeoPoint-GlideGeoPoint_O__table_fgf_cxc_wxb__entry__2}

| Type | Description |
|-|-|
| geopoint | The resultant GlideGeoPoint object. |
[Table 5. Returns]

{#GlideGeoPoint-GlideGeoPoint_O__table_fgf_cxc_wxb}  
The following example shows how to copy longitude and latitude values to instantiate a new GlideGeoPoint object.

    var gp = new GlideGeoPoint(135, -64);
    var gpCopy = new GlideGeoPoint(gp); 
    gs.info("geopoint: " + gpCopy);

Output:

    geopoint: 135,-64

## GlideGeoPoint - getDisplayValue() {#ariaid-title5}

Returns the geopoint of the current user in a user-friendly format.
The getDisplayValue() method returns a single geopoint value. For information about how to retrieve all geopoint values from a specific table, see [GlideGeoPoint Developer Guide](https://servicenow-prod.fluidtopics.net/wLTtIOa7_XaH9MNEXCixxA#geopoint-dev-guide "The GlideGeoPoint developer guide contains information about how to compute distances between latitude and longitude values (geopoints), return locations within given geopoint and radius values, and use additional functionality provided by supported GlideGeoPoint API functions.").
{#GlideGeoPoint-getDisplayValue__table_rr1_24t_qxb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 6. Parameters]

{#GlideGeoPoint-getDisplayValue__table_rr1_24t_qxb} {#GlideGeoPoint-getDisplayValue__table_sr1_24t_qxb__entry__2}

| Type | Description |
|-|-|
| String | The value of the longitude and latitude coordinates set in the object. |
[Table 7. Returns]

{#GlideGeoPoint-getDisplayValue__table_sr1_24t_qxb}  

    var gp = new GlideGeoPoint(); 
    gp.setValue(76.25, 49.75);      
    gs.info("geopoint: " + gp); 
    gs.info("getDisplayValue(): " + gp.getDisplayValue());

Output:

    geopoint: 76.250000,49.750000 
    getDisplayValue(): (76.250000, 49.750000)

## GlideGeoPoint - getGeoPoint(String geo_point_field_name) {#ariaid-title6}

Returns a list of geo point coordinate values for a given field name of type geo point.
{#GlideGeoPoint-getGeoPoint_S__table_bz4_jsl_5bc__entry__3}

| Name | Type | Description |
|-|-|-|
| geo_point_field_name | String | The name of the geo point field. Located in the Dictionary Entry `[sys_dictionary]` table. Note: You can also locate field names under dictionary elements defined on a table to see associated fields of geo point type. |
[Table 8. Parameters]

{#GlideGeoPoint-getGeoPoint_S__table_bz4_jsl_5bc} {#GlideGeoPoint-getGeoPoint_S__table_cz4_jsl_5bc__entry__2}

| Type | Description |
|-|-|
| Object | The resultant GlideGeoPoint object. |
[Table 9. Returns]

{#GlideGeoPoint-getGeoPoint_S__table_cz4_jsl_5bc}  
In the following example, 'test_table' is a table which contains the 'geo_point' field of geo point type. The test_table has one record populated in the geo_point column with a value of (-30.560000,-54.330000). The example code
returns the latitude and longitude coordinates and display value of the record in geo_point column.

    var gr_Test = new GlideRecord('test_table');
    gr_Test.query();
    gr_Test.next();
    var gp = gr_Test.getGeoPoint('geo_point');
    gs.info("getLatitude(): " + gp.getLatitude());
    gs.info("getLongitude(): " + gp.getLongitude());
    gs.info("getDisplayValue(): " + gp.getDisplayValue());

Output:

    getLatitude(): -54.33
    getLongitude(): -30.560000000000002 
    getDisplayValue(): (-30.560000, -54.330000)

## GlideGeoPoint - getLatitude() {#ariaid-title7}

Returns the latitude value of the GlideGeoPoint object.
{#GlideGeoPoint-getLatitude__table_w24_fpt_qxb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 10. Parameters]

{#GlideGeoPoint-getLatitude__table_w24_fpt_qxb} {#GlideGeoPoint-getLatitude__table_x24_fpt_qxb__entry__2}

| Type | Description |
|-|-|
| String | The latitude value of the GlideGeoPoint object. |
[Table 11. Returns]

{#GlideGeoPoint-getLatitude__table_x24_fpt_qxb}  

    var gp = new GlideGeoPoint(); 
    gp.setValue(76.25, 49.75);      

    gs.info("geopoint: " + gp); 
    gs.info("getLatitude(): " + gp.getLatitude());

Output:

    geopoint: 76.250000,49.750000 
    getLatitude(): 49.75

## GlideGeoPoint - getLongitude() {#ariaid-title8}

Returns the longitude value of the GlideGeoPoint object.
{#GlideGeoPoint-getLongitude__table_fmz_t4t_qxb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 12. Parameters]

{#GlideGeoPoint-getLongitude__table_fmz_t4t_qxb} {#GlideGeoPoint-getLongitude__table_gmz_t4t_qxb__entry__2}

| Type | Description |
|-|-|
| String | The longitude value of the GlideGeoPoint object. |
[Table 13. Returns]

{#GlideGeoPoint-getLongitude__table_gmz_t4t_qxb}  

    var gp = new GlideGeoPoint(); 
    gp.setValue(76.25, 49.75);      
    gs.info("geopoint: " + gp);  
    gs.info("getLongitude(): " + gp.getLongitude());

Output:

    geopoint: 76.250000,49.750000 
     getLongitude(): 76.25

## GlideGeoPoint - getValue() {#ariaid-title9}

Returns a string containing the programmatic longitude and latitude value of the current GlideGeoPoint object.
{#GlideGeoPoint-getValue__table_cvs_2zg_4xb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 14. Parameters]

{#GlideGeoPoint-getValue__table_cvs_2zg_4xb} {#GlideGeoPoint-getValue__table_dvs_2zg_4xb__entry__2}

| Type | Description |
|-|-|
| String | The longitude and latitude value of the current GlideGeoPoint object. |
[Table 15. Returns]

{#GlideGeoPoint-getValue__table_dvs_2zg_4xb}  

     var gp = new GlideGeoPoint(); 
    gp.setValue(76.25, 49.75);      
    gs.info("geopoint: " + gp);
    gs.info("getValue(): " + gp.getValue());

Output:

    geopoint: 76.250000,49.750000
    getValue(): 76.250000,49.750000

## GlideGeoPoint - setValue(String longitude, String latitude) {#ariaid-title10}

Sets the longitude and latitude values of the geopoint.
{#GlideGeoPoint-setValue_S_S__table_gw3_4qg_4xb__entry__3}

| Name | Type | Description |
|-|-|-|
| longitude | String | The longitudinal coordinate of the geopoint. |
| latitude | String | The latitude coordinate of the geopoint. |
[Table 16. Parameters]

{#GlideGeoPoint-setValue_S_S__table_gw3_4qg_4xb} {#GlideGeoPoint-setValue_S_S__table_hw3_4qg_4xb__entry__2}

| Type | Description |
|-|-|
| String | The longitude and latitude value set on the GlideGeoPoint object. |
[Table 17. Returns]

{#GlideGeoPoint-setValue_S_S__table_hw3_4qg_4xb}  

    var gp = new GlideGeoPoint(); 
    gp.setValue("-28.48,38.91");      
    gs.info("geopoint: " + gp);

Output:

    geopoint: -28.480000,38.910000

## GlideGeoPoint - setValue(String value) {#ariaid-title11}

Sets the longitude and latitude values of the geopoint using a single comma-delimited value.
{#GlideGeoPoint-setValue_S__table_mng_gyc_wxb__entry__3}

| Name | Type | Description |
|-|-|-|
| value | String | A comma-delimited value containing longitude and latitude points respectively. |
[Table 18. Parameters]

{#GlideGeoPoint-setValue_S__table_mng_gyc_wxb} {#GlideGeoPoint-setValue_S__table_nng_gyc_wxb__entry__2}

| Type | Description |
|-|-|
| String | The longitude and latitude value set on the GlideGeoPoint object. |
[Table 19. Returns]

{#GlideGeoPoint-setValue_S__table_nng_gyc_wxb}  
The following example shows how to set the longitude and latitude values using a single string.

    var gp = new GlideGeoPoint();
    gp.setValue(23.4, 56.7);

Output:

    geopoint: -23.400000,56.700000


