Skip to content

Support mapping (and querying) of geometry collections #30630

@roji

Description

@roji

GIS has a concept of a collection of geometry objects; this is represented by NetTopologySuite's GeometryCollection type, which extends Geometry and which we map to the database geometry/geography types (e.g. GeometryCollection in SQL Server). In most databases we also translate some spatial functions.

As part of #29427, we're allowing to map a .NET collection of any supported type to a JSON column in the database; but since collections of spatial objects have a special representation, we're excluding that specifically. Since GeometryCollection already implements IEnumerable<Geometry>, we probably don't want to also allow mapping e.g. Geometry[]. However, most database don't allow unpacking a geometry collection to a queryable table (PG supports this via ST_Dump); this means mapping Geometry[] to a regular JSON string column in the database does an advantage (queryability) over mapping to a database geometry collection.

Note: SQL Server OPENJSON doesn't natively support geometry, i.e. does not allow using geometry in its WITH clause. But we can still get WKT out as a string and just wrap it in a function which returns the geometry object.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions