
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeYes, you're on the right track! The geopolygon placeholder name refers to a polygon defined by multiple coordinate points (sets of lat/long), but it's not limited to just four points—it can be any number of points that define a closed shape.
The geo functions in Sanity use GeoJSON format under the hood. When you see geopolygon in the docs, it's referring to a geographic polygon that can be:
type property set to "Polygon" (or other geometry types like "MultiPolygon")lat and lng (or lon) properties for point-based queriesgeo::contains() functionThe function signature is geo::contains(geoPolygon, geo), which means:
Here's a practical example from the docs:
// For a given $currentLocation geopoint and deliveryZone area
// Return stores that deliver to a user's location
*[
_type == "storefront" &&
geo::contains(deliveryZone, $currentLocation)
]The polygon itself is an array of coordinate pairs (each being a lat/long set). In GeoJSON format, the first and last coordinates should be identical to "close" the polygon.
geo::distance(point1, point2): Returns distance in meters between two points (only works with points, not polygons)geo::intersects(geo1, geo2): Checks if two geographic areas overlapgeo::latLng(lat, lng): Quick helper to create a point from coordinates// Example: Find stores within 10 miles of a location
*[
_type == 'storefront' &&
geo::distance(geoPoint, $currentLocation) < 16093.4
]Note that these geo functions require API version v2021-03-25 or later.
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store