Learn how to read, update, and clear the location column on monday boards using the platform API
The location column stores a geographic location with longitude/latitude precision and displays it as text in the UI.
Via the API, the location column supports read, update, and clear operations.
Column Type | Implementation Type | Supported Operations |
|---|---|---|
|
|
|
Queries
Location columns can be queried through the column_values field on items queries using an inline fragment on LocationValue.
query {
items(ids: [1234567890, 9876543210]) {
column_values {
... on LocationValue {
country
street
street_number
}
}
}
}Fields
You can use the following fields to specify what information your LocationValue implementation will return.
| Field | Description |
|---|---|
address String | The location's address. |
city String | The location's city. |
city_short String | The location's shortened city value. |
column Column! | The column the value belongs to. |
country String | The location's country. |
country_short String | The location's shortened country value. |
id ID! | The column's unique identifier. |
lat Float | The location's latitude. |
lng Float | The location's longitude. |
place_id String | The unique place identifier of the location. |
street String | The location's street. |
street_number String | The location's street number. |
street_number_short String | The location's shortened street building number value. |
street_short String | The location's shortened street value. |
text String | The column's value as text. Returns "" if the column has an empty value. |
type ColumnType! | The column's type. |
updated_at Date | The column's last updated date. |
value JSON | The column's JSON-formatted raw value. |
Mutations
Update
You can update a location column using the change_simple_column_value or change_multiple_column_values mutations. You can send values as simple strings or JSON objects, depending on the mutation you choose.
The address is not validated against the latitude and longitude. It's only displayed as text in the cell.
If no address is provided, the cell displays unknown.Valid latitude values range from -90.0 to 90.0 (exclusive), and valid longitude values range from -180.0 to 180.0 (inclusive). If the updated coordinates fall outside these ranges, the mutation returns an error.
change_simple_column_value
change_simple_column_valueTo update a location column with a simple string, send the latitude, longitude, and (optionally) the address separated by spaces.
mutation {
change_simple_column_value(
item_id: 9876543210
board_id: 1234567890
column_id: "location"
value: "29.9772962 31.1324955 Giza Pyramid Complex"
) {
id
}
}change_multiple_column_values
change_multiple_column_valuesTo update a location column with JSON, send the latitude, longitude, and (optionally) the address as fields on the location object.
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"location\": {\"lat\": \"29.9772962\", \"lng\": \"31.1324955\", \"address\": \"Giza Pyramid Complex\"}}"
) {
id
}
}Clear
You can clear a location column using change_multiple_column_values by passing null or an empty object in column_values.
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"location\": null}"
) {
id
}
}