Showing posts from December, 2011

Check if Point is inside a Polygon using SQL

Using the geospatial SQL functions you can check if a point (with a given X,Y) is included inside a polygon Example: Declare @point geometry Declare @polygon geometry SET @point = geometry::STGeomFromText( 'POINT (-88.22 41.50000001)' , 4326 ) SET @polygon = geometry::STGeomFromText( 'POLYGON ((-88.2 41.5, -88.2 41.6, -88.3 41.6, -88.3 41.5, -88.2 41.5))' , 4326 ) --124 Select @point.STIntersection(@polygon).ToString() This SQL code defines two geometry objects, @point and @polygon, and checks if they inte…

Load More
That is All