The location column stores a location with longitude and latitude precision (but displayed with text). You can read, update, and clear the location column via the API, but you currently cannot filter your results by it.

Reading the 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

FieldDescription
address StringThe column's address value.
city StringThe column's city value.
city_short StringThe column's shortened city value.
column Column!The column the value belongs to.
country StringThe column's country value.
country_short StringThe column's shortened country value.
id ID!The column's unique identifier.
lat FloatThe column's latitude value.
lng FloatThe column's longitude value.
place_id StringThe unique place identifier of the location.
street StringThe column's street value.
street_number StringThe column's street building number value.
street_number_short StringThe column's shortened street building number value.
street_short StringThe column's shortened street value.
text StringThe column's value as text. This field will return "" if the column has an empty value.
type ColumnType!The column's type.
updated_at DateThe column's last updated date.
value JSONThe column's JSON-formatted raw value.

Updating the 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.

πŸ“˜

Note

The address is not verified to match the latitude/longitude and is just used as the text displayed in the cell. In case no address is provided, the address will be displayed as unknown.

The legal values for latitude are between -90.0 and 90.0 exclusive and between -180.0 and 180.0 inclusive for longitude. If the updated values exceed those ranges, you will get an error.

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
  }
}
fetch ("https://api.monday.com/v2", {
  method: 'post',
  headers: {
    'Content-Type': 'application/json',
    'Authorization' : 'YOUR_API_KEY_HERE'
  },
  body: JSON.stringify({
    query : "mutation ($myBoardId:Int!, $myItemId:Int!, $myColumnValue: String!, $columnId: String!) { change_simple_column_value (item_id:$myItemId, board_id:$myBoardId, column_id: $columnId, value: $myColumnValue) { id } }",
    variables : JSON.stringify({
      myBoardId: 1234567890,
      myItemId: 9876543210,
      columnId: "location",
      myColumnValue: "29.9772962 31.1324955 Giza Pyramid Complex"
      })
    })
  })

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
  }
}
fetch ("https://api.monday.com/v2", {
  method: 'post',
  headers: {
    'Content-Type': 'application/json',
    'Authorization' : 'YOUR_API_KEY'
  },
  body: JSON.stringify({
    query : "mutation ($myBoardId:Int!, $myItemId:Int!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id } }",
    variables : JSON.stringify({
      myBoardId: 1234567890,
      myItemId: 9876543210,
      myColumnValues: "{\"location\" : {\"lat\" : \"29.9772962\", \"lng\": \"31.1324955\", \"address\": \"Giza Pyramid Complex\"}}"
    })
  })
})

Clearing the 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
  }
}
fetch ("https://api.monday.com/v2", {
  method: 'post',
  headers: {
    'Content-Type': 'application/json',
    'Authorization' : 'YOUR_API_KEY_HERE'
  },
  body: JSON.stringify({
    query : "mutation ($myBoardId:Int!, $myItemId:Int!, $myColumnValues:JSON!) { change_multiple_column_values(item_id:$myItemId, board_id:$myBoardId, column_values: $myColumnValues) { id } }",
    variables : JSON.stringify({
      myBoardId: 1234567890,
      myItemId: 9876543210,
      myColumnValues: "{\"location\" : null}"
    })
  })
})

πŸ“˜

Join our developer community!

We've created a community specifically for our devs where you can search through previous topics to find solutions, ask new questions, hear about new features and updates, and learn tips and tricks from other devs. Come join in on the fun! 😎