Perform a Sql Server Spatial Intersection against a table full of spatial features? -


i have table in sql 2015 has geometry column , 10,000 records. want test if new record thinking adding overlaps of existing records. know can compare 2 features stintersects this:

declare @a geometry; declare @b geometry;

set @a = geometry::stpolyfromtext('polygon((-10277454.3014 4527261.7601, -10277449.1674 4527236.5722, -10277503.1433 4527245.177, -10277462.2333 4527281.9267, -10277454.3014 4527261.7601))',3857);

select @b = [shape] [gis].[ggon].[blah] objectid = 4539;

select @a.stintersects (@b);

but if wanted compare @a of features in blah table?

if result of intersection above 1 know @a geometry intersects @b geometry does. works. if change @b be:

select @b = [shape] [gis].[ggon].[blah]

then 0 - not correct

select @a.stintersects (select [shape] [gis_pl].[talon].[mdc_wm]);

also fails

declare @a geometry; declare @b geometry;

set @a = geometry::stpolyfromtext('polygon((-10277454.3014 4527261.7601, -10277449.1674 4527236.5722, -10277503.1433 4527245.177, -10277462.2333 4527281.9267, -10277454.3014 4527261.7601))',3857);

select * [gis].[ggon].[blah] [shape].stintersects(@a) = 1


Comments