我正在尝试学习如何使用 NetTopologySuite(用于 .NET),但要创建一个简单的圆圈作为我的搜索区域。当我使用该.Buffer()
方法执行此操作时,创建的形状覆盖了整个地球。
var geographyFactory = NtsGeometryServices.Instance.CreateGeometryFactory(4326); // WGS84
var searchAreCoordinate = new NetTopologySuite.Geometries.Coordinate(coordinate.Latitude, coordinate.Longitude); // Not sure if long-lat or lat-long.
var searchArea = geographyFactory.CreatePoint(searchAreCoordinate).Buffer(1000); // To me, this is 1000 meters because the SRID is WGS84.
这是 WKT 输出的结果:
POLYGON ((1001 2, 981.78528040323044 -193.09032201612825, 924.8795325112867 -380.6834323650898, 832.46961230254522 -553.57023301960214, 708.10678118654755 -705.10678118654755, 556.57023301960226 -829.46961230254522, 383.68343236508986 -921.8795325112867, 196.09032201612834 -978.78528040323044, 1.0000000000000613 -998, -194.0903220161282 -978.78528040323044, -381.68343236508974 -921.8795325112867, -554.57023301960191 -829.46961230254533, -706.10678118654744 -705.10678118654755, -830.46961230254533 -553.57023301960214, -922.87953251128681 -380.68343236508946, -979.78528040323056 -193.09032201612771, -999 2.0000000000007656, -979.78528040323022 197.09032201612922, -922.87953251128624 384.68343236509088, -830.46961230254442 557.57023301960339, -706.1067811865463 709.10678118654869, -554.57023301960078 833.46961230254624, -381.68343236508787 925.87953251128749, -194.09032201612607 982.7852804032309, 1.0000000000024809 1002, 196.09032201613093 982.78528040322988, 383.68343236509247 925.87953251128567, 556.57023301960487 833.46961230254351, 708.10678118654994 709.10678118654516, 832.46961230254726 557.5702330195993, 924.87953251128818 384.68343236508628, 981.78528040323124 197.09032201612436, 1001 2))
这是放置在地图上时的样子:
如果您查看结果数据,数字远远超过 -90/90 -180/180。
我的猜测是我可能没有正确设置 SRID?