locked
SqlGeography.STBuffer() bug RRS feed

  • Question

  • declare @g geography = geography::STGeomFromText('LINESTRING (45.000514 53.163967, 45.000086 53.164266, 45.000044 53.164336)', 4326)
    select @g.STBuffer(13.0).ToString()

    Result in SQL Server 2012 compatibility mode database:

    FULLGLOBE

    Result in SQL Server 2008 database:

    NULL

    It works with size=12.959 (returns valid POLYGON) and does not with size=12.960. It works again with size=14.0 or greater.

    Monday, February 17, 2014 12:38 PM

All replies

  • Hi,

    STBuffer (geography Data Type) returns a geography object that represents the union of all points whose distance from a geography instance is less than or equal to a specified value.

    Only in SQL Server 2012, this geography data type method supports FullGlobe instances or spatial instances that are larger than ahemisphere. STBuffer() returns a FullGlobe instance when the buffer distance is greater than the distance from the equator to the poles.<o:p></o:p>

    I also do a test in SQL Server 2008, it can return valid POLYGON when the size is 12.595, 12.960, 13.0, 14.0 or greater.

    For more information about STBuffer (geography Data Type), you can review the following article.
    http://technet.microsoft.com/en-us/library/bb933965(v=sql.100).aspx

    Regards,
    Sofiya Li

    Sofiya Li
    TechNet Community Support

    • Marked as answer by Sofiya Li Monday, February 24, 2014 2:38 AM
    • Unmarked as answer by Х Wednesday, March 19, 2014 12:03 PM
    Tuesday, February 18, 2014 1:30 PM
  • Now I run same script in SQL Azure. It returns NULL when 13, and valid POLYGON when 12 or 14.

    How it can be possible? It is small line 52 meters long.

    If it does not work in our local SQL - OK - it can be even hardware issue. Run this in SQL Azure and check results.

    It seems like deep bug in SQL Server Spatial for me.

    Wednesday, March 19, 2014 12:03 PM