sql server - STIntersect geography,geometry datatype -


i have circle , point, point intersects circle in geometry not in geography.

declare @circle geography = geography::point(39.10591303215, 21.923140028856, 4120).stbuffer(500) declare @geogpoint geography = geography::point(51.590294, 25.16387, 4120) select @circle,@geogpoint.tostring(),@geogpoint,@circle.stintersects(@geogpoint)   declare @circle1 geometry = geometry::point(39.10591303215, 21.923140028856, 4120).stbuffer(500) declare @geomgpoint geometry = geometry::point(51.590294, 25.16387, 4120) select @circle1,@geomgpoint.tostring(),@geomgpoint,@circle1.stintersects(@geomgpoint) 

i have lot of circle , point,problem geometry intersecting , geography few.

for geography, buffer in units per srid. 4120:

select unit_of_measure sys.spatial_reference_systems spatial_reference_id = 4120 

gives 'metre'

you therefore adding 500m buffer point. now, what's distance between 2 (unbuffered) points?

declare @circle geography = geography::point(39.10591303215, 21.923140028856, 4120) declare @geogpoint geography = geography::point(51.590294, 25.16387, 4120) select @circle.stdistance(@geogpoint)  1410017.60306578 metres 

which explains why stintersects returns false.

for geometery, working in 'units'. what's distance between 2 points?

declare @circle1 geometry = geometry::point(39.10591303215, 21.923140028856, 4120) declare @geomgpoint geometry = geometry::point(51.590294, 25.16387, 4120) select  @circle1.stdistance(@geomgpoint)  12.898143234446 'units' (in case degrees) 

which why second query returns true.

have @ section "measurements in spatial data types" https://msdn.microsoft.com/en-us/library/bb964711.aspx


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -