Release v7.15.1
Summary
Replaces legacy Coordinate type with GeoJSON-compliant geospatial types following MongoDB's GeoJSON specification. All types serialize to standard GeoJSON format for interoperability.
Implements a JsonConverter infrastructure in TypeScript similar to System.Text.Json for consistent type serialization across the codebase.
Added
Point,LinearRing,LineString, andPolygontypes in C# and TypeScript- GeoJSON converters:
PointJsonConverter,LineStringJsonConverter,PolygonJsonConverterin both C# and TypeScript - TypeScript:
JsonConverter<T>base class and converter infrastructure similar to System.Text.Json - TypeScript: Separate converter modules in
json/directory (DateJsonConverter,GuidJsonConverter,TimeSpanJsonConverter,PointJsonConverter,LineStringJsonConverter,PolygonJsonConverter,ValueMapJsonConverter) - Package.json module exports for
@cratis/fundamentals/geospatialand@cratis/fundamentals/jsonfollowing Arc's pattern - Constructor validation: LinearRing minimum 4 points, LineString minimum 2 points
- Ring closure validation: first and last points must be identical per GeoJSON spec
- Comprehensive test coverage: 15 spec files covering read/write operations for all JSON converters (Date, Guid, TimeSpan, Point, LineString, Polygon, ValueMap) - 312 tests total
- Documentation explaining what each geospatial type represents, with real-world use cases (location tracking, routes, zones, geofencing, agriculture, etc.)
Changed
- C#:
Coordinaterenamed toPoint(breaking change) - JSON serialization format changed from
{"longitude":10.5,"latitude":20.3}to GeoJSON{"type":"Point","coordinates":[10.5,20.3]} - TypeScript: Refactored
JsonSerializerto use centralized converter infrastructure with registered converters - TypeScript: All type converters moved from inline implementations to separate converter classes
- Documentation enhanced to explain what each geospatial type represents (Point, LineString, Polygon) with comprehensive use case examples, not just serialization details
Fixed
- ValueMapJsonConverter now properly registered and integrated with converter infrastructure (was created but not used)
- Markdown lint errors (MD031/blanks-around-fences, MD024/no-duplicate-heading) in documentation files
Removed
- C#:
Coordinaterecord andCoordinateJsonConverter(breaking change) - TypeScript:
Coordinateclass,CoordinateJsonConverter, and all related tests (breaking change)
Example Usage:
// C# - GeoJSON format
var point = new Point(10.7522, 59.9139);
var route = new LineString([
new Point(10.5, 20.3),
new Point(11.2, 21.1)
]);
var park = new Polygon(
new LinearRing([
new Point(0, 0),
new Point(10, 0),
new Point(10, 10),
new Point(0, 10),
new Point(0, 0) // Ring must close
]),
[] // Optional holes
);// TypeScript - same GeoJSON format with modular imports
import { Point, LineString } from '@cratis/fundamentals/geospatial';
import { PointJsonConverter } from '@cratis/fundamentals/json';
const point = new Point(10.7522, 59.9139);
const route = new LineString([
new Point(10.5, 20.3),
new Point(11.2, 21.1)
]);Migration: C# code must update all Coordinate references to Point and migrate stored JSON data to GeoJSON format. TypeScript code must also update all Coordinate references to Point - the Coordinate type has been completely removed from TypeScript. TypeScript projects can now import specific modules for better tree-shaking.