Skip to content

Geospatial Types

Cratis provides first-class support for geospatial data in MongoDB using types from Cratis.Geospatial. The serializers follow the GeoJSON standard, making them compatible with MongoDB’s geospatial query operators and external mapping services.

  • Point — Single geographic coordinates (longitude, latitude)
  • LineString — Routes and paths (ordered sequences of points)
  • Polygon — Geographic areas with optional interior boundaries (holes)

All geospatial types are serialized in GeoJSON format, enabling:

  • MongoDB Spatial Queries — Use $near, $geoWithin, and other spatial operators
  • Interoperability — Work seamlessly with mapping services and GIS tools
  • Standards Compliance — Follow industry-standard GeoJSON specification

Choose the type that matches your use case:

  • Use Point for storing single locations (stores, users, events)
  • Use LineString for routes, paths, or trajectories
  • Use Polygon for service areas, regions, or geographic boundaries

See the individual type documentation for implementation examples and best practices.