Geographic points

29 views
Skip to first unread message

Mathias Håkansson

unread,
Mar 1, 2024, 2:22:46 PMMar 1
to nhusers
Hi all,
I'm upgrading from NHibernate 4.x  to version 5.5. In version 4 I used NetTopologySuite together with GeoAPI to generate geographical reference points like this:

Init...
private readonly IGeometryFactory _geometryFactory = NetTopologySuite.NtsGeometryServices.Instance.CreateGeometryFactory(4326);
GeoAPI.GeometryServiceProvider.Instance = NetTopologySuite.NtsGeometryServices.Instance;

Generate point...
var c = new Coordinate(LastRecivedPosition.Longitude.DecimalDegrees, LastRecivedPosition.Latitude.DecimalDegrees, _lastTrackingAltitude);
coordinate.GeoPoint = _geometryFactory.CreatePoint(c);

where coordinate.GeoPoint is mapped as
mapping.Map(x => x.GeoPoint).Column("GeoPoint").CustomType<NHibernate.Spatial.Type.MsSql2008GeographyType>();

This code does not work anymore.
Is there a sample or best practice on how to do this in Nhibernate 5.5?

Best Regards
Mathias Håkansson
Dasa Control systems
Reply all
Reply to author
Forward
0 new messages