What is the measurement of distance with STBuffer when using a GEOMETRY object? RRS feed

  • Question

  • All,

    My question revolves around using "STBuffer()" on a GEOMETRY object. (see code below)

    DECLARE @ogc varchar(MAX); DECLARE @geogObj GEOGRAPHY; DECLARE @geomObj GEOMETRY; DECLARE @SRID int; DECLARE @PAsqft float; 
    DECLARE @ValidDetailNumber nvarchar(250); DECLARE @geogObjBuffer GEOGRAPHY; DECLARE @geomObjBuffer GEOMETRY; DECLARE @meter_per_foot FLOAT = 0.3048; 

    SET @ogc='POLYGON((-79.88181757341647 40.37953822119024,-79.88585161577487 40.37823054411052,-79.88580870043063 40.37424197225611,-79.87872766863131 40.374209278068605,-79.87902807604098 40.37760938860622,-79.88181757341647 40.37953822119024))';

    SET @geogObjBuffer = @geogObj.STBuffer(150 * @meter_per_foot);
    SET @geomObjBuffer = @geomObj.STBuffer(150 * 0.00004);

    I realized that with a GEOGRAPHY object, the size of the buffer is in meters (which is why I pre-calculate the amount of meter in one foot); however, with GEOMETRY, from what I have researched, it DOES NOT go by meters.  What is the measurement it does go by?

    I ask because if I drop the value down (like in my code above) to 0.00004 I can begin to see the buffer take shape properly (instead of it just being a circle).  Is there some type of unit converter I can use to make the "STBuffer" be "150 feet" for a GEOMETRY object (Like I did for a GEOGRAPHY) ?

    Thank you for your time.

    Thanks! Nick

    • Edited by NickWM Wednesday, July 10, 2019 8:58 PM changed title
    Wednesday, July 10, 2019 8:58 PM

All replies

  • UPDATE - Still looking for confirmation; however, I did find this out.

    If I query the following:  SELECT * FROM sys.spatial_reference_systems;

    I will get a full list of all the SRID values and their "unit_of_measure".  In my case, I am using Lat/Long NAD 83; therefore, I am using SRID 4269.  The "unit_of_measure" is "metre" or meter. (majority are meter)

    3.28084 feet = 1 meter, which would mean 150 feet (desired) = 45.71999 meters

    I'd want my buffer line in SQL to be:

    SET @geomObjBuffer = @geomObj.STBuffer(45.71999);

    My problem is I am still getting a big circle for my buffer.  The only way I can get the buffer to actually begin to shape properly is if I severely reduce the value of the buffer to below 1. (see below) 

    SET @geomObjBuffer = @geomObj.STBuffer(0.01); 

    I presume means 0.01 meters buffer size??

    Does anyone know if my assumption is accurate?

    Thanks! Nick

    Thursday, July 11, 2019 1:57 PM
  • I am using SRID 4269.  The "unit_of_measure" is "metre" or meter. (majority are meter)

    The data type geometry has no SRID definition, it's a planar figure and the values are simple values without any measure.

    Olaf Helper

    [ Blog] [ Xing] [ MVP]

    Friday, July 12, 2019 6:31 AM
  • Olaf,

    Thanks for your reply.  Quick question then, does this mean that when working with a GEOMETRY type field, I would be un-able to apply a spatial buffer to the GEOMETRY field with a specific distance?  

    I assume the answer is yes, but I am just double-checking.

    Thank you for your help

    Thanks! Nick

    Friday, July 12, 2019 12:40 PM