几何线与多边形的交点返回null

时间:2012-06-13 01:26:39

标签: sql sql-server sql-server-2008 gis geospatial

我正在尝试根据与多边形的线中点交点的结果设置一列。我知道我可以用

这样的方式调用中间点
  X_Coord = SHAPE.STPointN(SHAPE.STNumPoints()/2).STX ,  
  Y_Coord = SHAPE.STPointN(SHAPE.STNumPoints()/2).STY 

但如何将其传递给

update GRSM_ROADS
set QuadName = USGS_24K_TOPOMAP_BOUNDARIES.NAME
from  GRSM_ROADS
inner join USGS_24K_TOPOMAP_BOUNDARIES
on dbo.GRSM_ROADS.Location_ID = GRSM_ROADS.Location_ID
where (USGS_24K_TOPOMAP_BOUNDARIES.SHAPE.STIntersects(dbo.GRSM_ROADS.shape) = 1);

是一个谜。我已经尝试了运行的stcontains和stintersects,但输出为空,表明我没有正确确定线中点何时或何处与多边形相交。

SQL 2008 R2

1 个答案:

答案 0 :(得分:1)

where (USGS_24K_TOPOMAP_BOUNDARIES.SHAPE.STIntersection(dbo.GRSM_ROADS.shape).STDimension() = 1);

Stdimension解决了它!