简体   繁体   中英

SQL Server spatial STBuffer

I am new to sql server spatial. I had a problem with STBuffer function when applying to geography data type in SQL server 2014 or 2012 (not in 2008).

After applying STBuffer function, the resulting shape is completely different from the original, not just buffered some distance from original shape.

See code below:

select (geography::STGeomFromText('POLYGON ((-78.17498995969072 40.511906814179383, -78.174936763010919 40.512004616786726, -78.174837516853586 40.512342629022896, -78.175599932204932 40.512442785082385, -78.176346572581679 40.5125408685999, -78.17645655060187 40.512555316090584, -78.176824942231178 40.512603710405529, -78.177308602025732 40.512666257680394, -78.178199267713353 40.51277746737469, -78.181078517111018 40.51316248846706, -78.181189002934843 40.513158924411982, -78.1812548530288 40.51315680029802, -78.181430931901559 40.513151120278053, -78.181524405721575 40.5131481050048, -78.181649426696822 40.513150648796, -78.181668272824027 40.512921414221637, -78.17498995969072 40.511906814179383))',4326)).

Then I applied a STBuffer(0.01), the shaped is totally different from the original. I am not allow to post shape images, so you may need to run in your sql server to see the results.

However, if I applying other buffer distance such as 0.001 or 0.1, the shapes all looks alright. Only the buffer distance 0.01 gives the strange/unexpected results.

Any thoughts and helps are appreciated.

The amount of precision you have for each of these points is serious overkill. 15 decimals is probably in the subatomic realm and I would guess if you rounded each point to a more reasonable level this wouldn't be an issue.

Try rounding to 7 or 8 decimals and see what happens. Regardless, it should handle the buffer so it's probably a bug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM