使用地理坐标时,我无法找到错误的确切原因

时间:2018-06-13 17:19:57

标签: sql sql-server geospatial

DECLARE @g123 geometry = geometry::STGeomFromText('LINESTRING(-116.13047257831279 56.30017316623788, -116.12913641697267 56.300147332468164, -116.12779547120535 56.299607730102615, -116.124571914419 56.29911596359641, -116.1192082382492 56.299140730412596, -116.11778756789873 56.29966295365294, -116.11782543098967 56.30010153331982, -116.11560636945568 56.300912282474926)', 4326);

如果我使用这些坐标然后使用STIsValid()方法,则返回1作为有效。但是当我使用相同的STIsValid()时,在另一组线串中,它将0视为无效。下面是我的另一组线串,根据STIsValid()无效。

DECLARE @g geometry = geometry::STGeomFromText('LINESTRING(-115.53767705050582 53.22672158956674, -115.53765868534818 53.22671128738061, -115.53767705050582 53.22672158956674, -115.53654381140187 53.226143048362516, -115.53339315469746 53.22253902683848, -115.53152182202682 53.22190044473827, -115.5230860935366 53.21472328981251, -115.52130569462724 53.20876969345053, -115.51409690401672 53.200303872725705, -115.51289773935069 53.19938946371285, -115.50194164539707 53.192345671197565, -115.48749425897319 53.18330927377852, -115.48660896207417 53.18226350516222, -115.47864624419178 53.177401797081366, -115.47740128431087 53.17682485911916, -115.46443612708893 53.16871949656764, -115.45674907970934 53.16393156693292, -115.44008277099036 53.148539644479875, -115.43876927594148 53.14733292030516, -115.42056871209088 53.13594112513783, -115.41810867029544 53.13418489856417, -115.41569669016428 53.13245707290928, -115.40702454305763 53.126296683826, -115.40060737841817 53.12421338884663, -115.3933730945182 53.11839374047024, -115.39110711038367 53.11570405230429, -115.38971149045324 53.11399817649696, -115.37762498169889 53.10661108600986, -115.37227436164345 53.105117030992915, -115.36926227096991 53.10426983449939, -115.364528013777 53.10174737901163, -115.36239004945196 53.100546579648075, -115.53770036268578 53.22673349109732, -115.53767705050582 53.22672158956674, -115.55271685609667 53.23602696078559, -115.55524236980497 53.238300471678045, -115.55611787866064 53.24257818908546, -115.55632746280297 53.242985670788634, -115.55734856610832 53.24858981971976, -115.55760951412194 53.24900780760328, -115.55767943988195 53.24919395033266, -115.557773056911 53.24944273957723, -115.55844649693005 53.250495186947575, -115.56047267939273 53.253683474193465, -115.56172434789217 53.25567849911704, -115.56915822397356 53.265061269624596, -115.57226795433193 53.269060314219125, -115.58054632493382 53.27965622974886, -115.58312853491297 53.283002280874825, -115.60422619519927 53.305529442840346, -115.60787170325098 53.30881342553875, -115.60941844316844 53.31154271134389, -115.55279421451736 53.23608965992021, -115.54973236975353 53.233483842184285, -115.53767705050582 53.22672158956674)', 4326);

1 个答案:

答案 0 :(得分:1)

您的行无效,因为它已关闭并自行穿过。从PostGIS docs查看此页面(我确定SQL Server也有一个,因为它也符合OGC标准)。

enter image description here