tpcolson
tpcolson

Reputation: 669

geometry line intersection with polygon returns null

I'm trying to set a column based on the result of a line midpoint intersection with a polygon. I know I can call the line midpoint with something like

  X_Coord = SHAPE.STPointN(SHAPE.STNumPoints()/2).STX ,  
  Y_Coord = SHAPE.STPointN(SHAPE.STNumPoints()/2).STY 

but how to pass that to

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);

is a mystery. I've tried stcontains and stintersects, which runs, but the output is null, indicating that I'm not correctly determining when or where the line midpoint intersects the polygon.

SQL 2008 R2

Upvotes: 1

Views: 683

Answers (1)

tpcolson
tpcolson

Reputation: 669

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

Stdimension solved it!

Upvotes: 1

Related Questions