Using lookup: placekey, retrieve the shape of a specific POI using polygon fields in the Geometry data set.

query {
  lookup(placekey: "[email protected]") {
    placekey
    safegraph_geometry {
      location_name
      polygon_wkt
      polygon_class
      enclosed
    }
  }
}
curl --location --request POST 'https://api.safegraph.com/v1/graphql' \
--header 'apikey: {your-api-key}' \
--header 'content-type: application/json' \
--data-raw '{"query":"query {\n  lookup(placekey: \"[email protected]\") {\n    placekey\n    safegraph_geometry {\n      location_name\n      polygon_wkt\n      polygon_class\n      enclosed\n    }\n  }\n}","variables":{}}'
# pip install safegraphQL
import safegraphql.client as sgql

sgql_client = sgql.HTTP_Client(apikey = 'your-api-key')

pk = '[email protected]'
cols = [
    'location_name',
    'polygon_wkt',
    'polygon_class',
    'enclosed'
]

sgql_client.lookup(product = 'geometry', placekeys = pk, columns = cols)
{
  "data": {
    "lookup": {
      "placekey": "[email protected]",
      "safegraph_geometry": {
        "location_name": "Starbucks",
        "polygon_wkt": "POLYGON ((-81.97314747229308 28.095766670700137, -81.97290741458625 28.095764304558138, -81.97290473237723 28.0956956864176, -81.9729717876026 28.095698052561104, -81.97297446981162 28.09568148955543, -81.97305359497756 28.09567912341157, -81.97305225387305 28.095701601776266, -81.97314479008406 28.095694503345808, -81.97314747229308 28.095766670700137))",
        "polygon_class": "OWNED_POLYGON",
        "enclosed": false
      }
    }
  },
  "extensions": {
    "row_count": 1,
    "version_date": "1627739802__2021_07"
  }
}