Learn how to read, update, and clear the location column on monday boards using the platform API
The location column stores a location with longitude and latitude precision (but displayed with text). The API allows you to read, update, and clear the location column.
Read a location column
You can query the location column using the column_values object that enables you to return column-specific subfields by sending a fragment in your query. Values for the location column are of the LocationValue type.
query {
items (ids:[1234567890, 9876543210]) {
column_values {
... on LocationValue {
country
street
street_number
}
}
}
}Fields
| Field | Description |
|---|---|
address String | The column's address value. |
city String | The column's city value. |
city_short String | The column's shortened city value. |
column Column! | The column the value belongs to. |
country String | The column's country value. |
country_short String | The column's shortened country value. |
id ID! | The column's unique identifier. |
lat Float | The column's latitude value. |
lng Float | The column's longitude value. |
place_id String | The unique place identifier of the location. |
street String | The column's street value. |
street_number String | The column's street building number value. |
street_number_short String | The column's shortened street building number value. |
street_short String | The column's shortened street value. |
text String | The column's value as text. This field will return "" 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. |
Update a location column
You can update a location column using the change_simple_column_value mutation and sending a simple string in the value argument. You can also use the change_multiple_column_values mutation and pass a JSON string in the column_values argument.
The address is not verified against the provided latitude and longitude. It's only displayed as text in the cell.
If no address is provided, the cell will display 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 values fall outside these ranges, an error will occur.
Simple strings
To update a location column, send the latitude, longitude, and address of the location separated by spaces (optional).
mutation {
change_simple_column_value(
item_id: 9876543210
board_id: 1234567890
column_id: "location"
value: "29.9772962 31.1324955 Giza Pyramid Complex"
) {
id
}
}JSON
To update a location column using JSON, send the latitude, longitude, and address of the location (optional).
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 a location column
You can also clear a location column using the change_multiple_column_values mutation and passing null or an empty object in the column_values argument.
mutation {
change_multiple_column_values(
item_id: 9876543210
board_id: 1234567890
column_values: "{\"location\": null}"
) {
id
}
}