我有一堆多多边形记录。长话短说,我有一点属于一个多多边形。当你用QGis或类似的软件想象时,这是正确的。但是sql server返回STIntersects =1,这篇文章中不仅针对多多边形,而且对大约65%的多边形返回。在26条记录中,17条表示STIntersects =1,而实际应该是1表示0.
这就是要点:
DECLARE @point geography;
set @point = (select geography::STPointFromText('POINT(7.6027101675492395 46.549656011507068)', 4326)这是不应该包含透水点的多多边形,但它是:
DECLARE @m geography;
set @m = https://pastebin.pl/view/70e8a7d6 (file is to big)
print @m.STIntersects(@point) --says 1 (it should say 0)该怎么办呢。我使用GeoJSON.Net.Contrib.MsSqlSpatial将Geo数据转换为sql地理。
我并不熟悉这些东西,我指的是Sql server地理知识或它背后的数学。
我所能做的就是猜测--我最好的猜测--多多边形不知何故搞砸了(我不知道如何证明这一点)或sql server问题或类似的问题。
这是sql服务器ver.:
Microsoft SQL Azure (RTM) - 12.0.2000.8
Feb 23 2022 11:32:53
Copyright (C) 2021 Microsoft Corporation有什么想法吗?
从我在微软网站上看到的更新:https://learn.microsoft.com/en-us/sql/relational-databases/spatial/multipolygon?view=sql-server-ver15
多多边形是这样的:
MULTIPOLYGON(((1 1, 1 -1, -1 -1, -1 1, 1 1)),((1 1, 3 1, 3 3, 1 3, 1 1)))是否有任何c#库可以将geojson转换为更正多多个区域?
每个多边形周围都有括号,其中我的MULTIPOLYGON是一个多边形。
发布于 2022-05-06 02:27:55
在使用Server时,需要注意两件事。
地理和几何类型的
当使用地理时,需要注意的是orientation.多边形。
我在上面找不到微软的任何文档,但以下是合理的解释:https://alastaira.wordpress.com/2012/01/27/ring-orientation-bigger-than-a-hemisphere-polygons-and-the-reorientobject-method-in-sql-server-2012/
BigQuery也有类似的方向规则和规则的描述:https://cloud.google.com/bigquery/docs/geospatial-data#polygon_orientation
你可以
differences)
https://stackoverflow.com/questions/72134501
复制相似问题