locked
Spatial Doubt RRS feed

  • Question

  • I would like to know what is the best method option using geographical object to get the countries inside a polygon.

     

    Thanks.

    Thursday, April 22, 2010 1:52 AM

Answers

  • I think you're referring to the fact that the geography data type in SQL Server 2008 has no STWithin method like geometry has. The SQL Server spatial team is aware of this....

    For now, here's a true hack that works pretty well if your objects are of reasonable size.

    1. Convert both geography instances to geometry You can't just cast it, but SQL Server Spatial Tools on CodePlex (http://sqlspatialtools.codeplex.com) includes a method: VacuousGeographyToGeometry.
    2. Call geometry's STWithin method.

    Cheers, Bob Beauchemin, SQLskills

     

    Friday, April 23, 2010 11:20 PM