How does SQL STBuffer measure distance around polygons?

Joined
Feb 20, 2023
Messages
2
Reaction score
0
How does the STBuffer function measure distances around a polygon?

I am looking at the expression:

Code:
select SP_GEOMETRY.STBuffer(100)

and wondering how the 100-meter buffer is calculated around the geometry of polygons.

e.g., is it from the centre of the polygon? or does the buffer start from the edges of the polygon?

I am struggling to find helpful documentation on this so if you have any links let me know!

Thanks heaps

I am wondering because the function is trying to pick up boundaries which are within 100m from each other, but when running the function, not all the properties within 100m are being selected.
 
Joined
Mar 5, 2023
Messages
36
Reaction score
12
The STBuffer function in SQL Server's spatial data types creates a new geometry that represents a buffer zone around the input geometry. The buffer zone is created by constructing a series of circles centered at each point on the boundary of the input geometry, with a radius equal to the buffer distance. The resulting buffer zone is the union of these circles.

The buffer distance is measured outward from the exterior boundary of the input geometry. So, if the input geometry is a polygon, the buffer will be measured from the edges of the polygon. The resulting buffer geometry will enclose the original geometry, with a buffer zone extending outward from the polygon's edges.

The STBuffer function in SQL Server uses the Euclidean distance metric to compute the buffer. This means that it assumes a flat, two-dimensional plane and measures distances as straight lines between points. If you need to measure distances along the surface of the Earth (i.e., on a spherical or ellipsoidal model), you will need to use a different distance function.

As for why not all the properties within 100m are being selected, it could be due to a variety of factors, such as the shape and distribution of the input polygons, the specific buffer distance used, or the specific implementation of the STBuffer function being used. Without more information, it's difficult to say for sure.
 
Joined
Feb 20, 2023
Messages
2
Reaction score
0
Thanks for the detailed explanation @thatstooeasyman!

Would it only pick up surrounding polygons which are fully enclosed in the 100m buffer? Or polygons which intersect any portion of the buffer? Or if the polygon's centre point is in the buffer?
 
Joined
Mar 5, 2023
Messages
36
Reaction score
12
The STBuffer function in SQL Server creates a buffer zone around a given geometry based on a buffer distance. This buffer zone will include all polygons that intersect any part of the buffer, regardless of whether they are fully enclosed by the buffer or if their center point is within the buffer.

So, if a polygon overlaps with any part of the buffer, it will be selected as part of the result set. This means that polygons that are partially within the buffer, those that overlap with the buffer, or those that are fully enclosed by the buffer will all be included in the buffer zone.

It's important to keep in mind that the buffer distance used will determine which polygons are included in the buffer zone. A larger buffer distance will include more polygons, while a smaller buffer distance will include fewer polygons. Also, the shape and distribution of the input polygons can also impact which polygons are included in the buffer zone.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top