我正在尝试在SQL Azure中的地理数据类型中创建一个多边形但它不断给我一个错误,指定的输入不代表一个有效的地理实例,当我将数据类型从geograhy更改为几何时,它工作正常。
我试过了这个
declare @g geography;
set @g = geography::STGeomFromText('POLYGON((31.02350 30.02944, 31.02350 30.02944, 31.00857 30.04697, 31.00857 30.04697, 30.99415 30.06346, 30.99415 30.06346, 30.97424 30.08708, 30.97424 30.08708, 30.96874 30.08768, 30.96874 30.08768, 30.95947 30.08322, 30.95947 30.08322, 30.94660 30.07475, 30.94660 30.07475, 30.94282 30.07193, 30.94282 30.07193, 30.93441 30.07267, 30.93441 30.07267, 30.93338 30.06599, 30.93338 30.06599, 30.94557 30.05143, 30.94557 30.05143, 30.95140 30.04489, 30.95140 30.04489, 30.92651 30.02990, 30.92651 30.02990, 30.89802 30.01147, 30.89802 30.01147, 30.86746 29.99006, 30.86746 29.99006, 30.83794 29.97222, 30.83794 29.97222, 30.81665 29.95675, 30.81665 29.95675, 30.87158 29.88325, 30.87158 29.88325, 31.02350 30.02944, 31.02350 30.02944, 31.00857 30.04697, 31.00857 30.04697, 30.99415 30.06346, 30.99415 30.06346, 30.97424 30.08708, 30.97424 30.08708, 30.96874 30.08768, 30.96874 30.08768, 30.95947 30.08322, 30.95947 30.08322, 30.94660 30.07475, 30.94660 30.07475, 30.94282 30.07193, 30.94282 30.07193, 30.93441 30.07267, 30.93441 30.07267, 30.93338 30.06599, 30.93338 30.06599, 30.94557 30.05143, 30.94557 30.05143, 30.95140 30.04489, 30.95140 30.04489, 30.92651 30.02990, 30.92651 30.02990, 30.89802 30.01147, 30.89802 30.01147, 30.86746 29.99006, 30.86746 29.99006, 30.83794 29.97222, 30.83794 29.97222, 30.81665 29.95675, 30.81665 29.95675, 30.87158 29.88325, 30.87158 29.88325, 30.92651 29.89962, 30.92651 29.89962, 30.96737 29.89129, 30.96737 29.89129, 31.06419 29.85914, 31.06419 29.85914, 31.08410 29.89664, 31.08410 29.89664, 31.09612 29.92700, 31.09612 29.92700, 31.09921 29.94693, 31.09921 29.94693, 31.04908 30.00017, 31.04908 30.00017,31.02350 30.02944))',4326);
SELECT @g
和这个
declare @g geography;
set @g = geography::STPolyFromText('POLYGON((31.02350 30.02944, 31.02350 30.02944, 31.00857 30.04697, 31.00857 30.04697, 30.99415 30.06346, 30.99415 30.06346, 30.97424 30.08708, 30.97424 30.08708, 30.96874 30.08768, 30.96874 30.08768, 30.95947 30.08322, 30.95947 30.08322, 30.94660 30.07475, 30.94660 30.07475, 30.94282 30.07193, 30.94282 30.07193, 30.93441 30.07267, 30.93441 30.07267, 30.93338 30.06599, 30.93338 30.06599, 30.94557 30.05143, 30.94557 30.05143, 30.95140 30.04489, 30.95140 30.04489, 30.92651 30.02990, 30.92651 30.02990, 30.89802 30.01147, 30.89802 30.01147, 30.86746 29.99006, 30.86746 29.99006, 30.83794 29.97222, 30.83794 29.97222, 30.81665 29.95675, 30.81665 29.95675, 30.87158 29.88325, 30.87158 29.88325, 31.02350 30.02944, 31.02350 30.02944, 31.00857 30.04697, 31.00857 30.04697, 30.99415 30.06346, 30.99415 30.06346, 30.97424 30.08708, 30.97424 30.08708, 30.96874 30.08768, 30.96874 30.08768, 30.95947 30.08322, 30.95947 30.08322, 30.94660 30.07475, 30.94660 30.07475, 30.94282 30.07193, 30.94282 30.07193, 30.93441 30.07267, 30.93441 30.07267, 30.93338 30.06599, 30.93338 30.06599, 30.94557 30.05143, 30.94557 30.05143, 30.95140 30.04489, 30.95140 30.04489, 30.92651 30.02990, 30.92651 30.02990, 30.89802 30.01147, 30.89802 30.01147, 30.86746 29.99006, 30.86746 29.99006, 30.83794 29.97222, 30.83794 29.97222, 30.81665 29.95675, 30.81665 29.95675, 30.87158 29.88325, 30.87158 29.88325, 30.92651 29.89962, 30.92651 29.89962, 30.96737 29.89129, 30.96737 29.89129, 31.06419 29.85914, 31.06419 29.85914, 31.08410 29.89664, 31.08410 29.89664, 31.09612 29.92700, 31.09612 29.92700, 31.09921 29.94693, 31.09921 29.94693, 31.04908 30.00017, 31.04908 30.00017,31.02350 30.02944))',4326);
SELECT @g
但两者都返回相同的错误,尽管这样可以正常工作
declare @g geometry;
set @g = geometry::STPolyFromText('POLYGON((31.02350 30.02944, 31.02350 30.02944, 31.00857 30.04697, 31.00857 30.04697, 30.99415 30.06346, 30.99415 30.06346, 30.97424 30.08708, 30.97424 30.08708, 30.96874 30.08768, 30.96874 30.08768, 30.95947 30.08322, 30.95947 30.08322, 30.94660 30.07475, 30.94660 30.07475, 30.94282 30.07193, 30.94282 30.07193, 30.93441 30.07267, 30.93441 30.07267, 30.93338 30.06599, 30.93338 30.06599, 30.94557 30.05143, 30.94557 30.05143, 30.95140 30.04489, 30.95140 30.04489, 30.92651 30.02990, 30.92651 30.02990, 30.89802 30.01147, 30.89802 30.01147, 30.86746 29.99006, 30.86746 29.99006, 30.83794 29.97222, 30.83794 29.97222, 30.81665 29.95675, 30.81665 29.95675, 30.87158 29.88325, 30.87158 29.88325, 31.02350 30.02944, 31.02350 30.02944, 31.00857 30.04697, 31.00857 30.04697, 30.99415 30.06346, 30.99415 30.06346, 30.97424 30.08708, 30.97424 30.08708, 30.96874 30.08768, 30.96874 30.08768, 30.95947 30.08322, 30.95947 30.08322, 30.94660 30.07475, 30.94660 30.07475, 30.94282 30.07193, 30.94282 30.07193, 30.93441 30.07267, 30.93441 30.07267, 30.93338 30.06599, 30.93338 30.06599, 30.94557 30.05143, 30.94557 30.05143, 30.95140 30.04489, 30.95140 30.04489, 30.92651 30.02990, 30.92651 30.02990, 30.89802 30.01147, 30.89802 30.01147, 30.86746 29.99006, 30.86746 29.99006, 30.83794 29.97222, 30.83794 29.97222, 30.81665 29.95675, 30.81665 29.95675, 30.87158 29.88325, 30.87158 29.88325, 30.92651 29.89962, 30.92651 29.89962, 30.96737 29.89129, 30.96737 29.89129, 31.06419 29.85914, 31.06419 29.85914, 31.08410 29.89664, 31.08410 29.89664, 31.09612 29.92700, 31.09612 29.92700, 31.09921 29.94693, 31.09921 29.94693, 31.04908 30.00017, 31.04908 30.00017,31.02350 30.02944))',4326);
SELECT @g
答案 0 :(得分:1)
您的坐标列表格式不正确,导致SQLAzure解析器出错
请修正您的坐标,它将与您一起使用geography::STPolyFromText