Where is the STContains function for the Geography type. I don't know but its not in Sql Server 2008.

As a workaround you can use STIntersection and compare the results with the geography you are comparing with i..e

declare @g geography = 'POLYGON((0 0,0 10,0 20,0 30, 0 40, 50 40,50 30 ,50 20, 50 10, 50 0, 0 0))'

declare @l geography = geography::Parse('LINESTRING(20 0,20 10,20 20)')

select @g.STIntersection(@l).ToString(), @g.STIntersection(@l).STEquals(@l);

This returns 1 if the LINESTRING  is within the POLYGON


This is cross posted from my SQLBlogcasts blog which can be found here, http://sqlblogcasts.com/blogs/simons/SQL Server 2008 Spatial - STContains for Geography type

Categories:

Comments

Add comment


(Will show your Gravatar icon)  

  Country flag

biuquote
  • Comment
  • Preview
Loading



Theme design by Nukeation based on Jelle Druyts