SQLTeam.com | Weblogs | Forums

Create points in a polygon


I would like to create points in a polygon, using SQL Server, that use x and y spacing.

Secondly, they also need to take into account the direction of the resultant grid lines (ie they don't align north) so they will need to be rotated.

There are points on the ground with precise spacing and I need to recreate this without going to each and every point and taking precision gps points.

To break it down into distinct,manageable steps, I was thinking of finding the bounds of the polygon (plus a user defined margin to allow for rotation in a later step), then create points within that using x and y spacing, then rotate using either the centroid of the polygon or a defined point, then move all points by a user defined lat and lon adjustment so that the points overlay the points on the ground (and in the map), then eliminate points not in the polygon.

I am happy to receive feedback on why not to use the database for this, but why do we have spatial capabilities within SQL Server if we don't use them?

I am going to use SQL Server 2016.