How to pick the right Points to draw the Polygon RRS feed

  • Question

  • Hi,

    I need to draw a polygon with the Latitude and Longitude Points. I am getting all the points from SQL Server 2008 from the Table. How to pick the Border Points to draw polygon.  Is there any method to pick the outer Border points to draw polygon. Thank's in Advance.


    Thanks and Regards

    Parthiban. R

    Thursday, August 29, 2013 1:09 PM

All replies

  • Hi Parthiban,

    Thank you for your question. I am trying to involve someone more familiar with this topic for a further look at this issue. Sometime delay might be expected from the job transferring. Your patience is greatly appreciated.

    Thank you for your understanding and support.

    Sofiya Li

    Sofiya Li
    TechNet Community Support

    Monday, September 2, 2013 8:30 AM
  • Hi,

    You can get it from these few articles below:

    - http://stackoverflow.com/questions/16410757/bounding-box-for-polygon

    - http://blogs.msdn.com/b/davidlean/archive/2008/10/27/sql-2008-spatial-samples-part-n-3-of-n-performance-improvement-methods.aspx

    - http://technet.microsoft.com/en-us/library/bb933896.aspx

    Christian HL
    Microsoft Online Community Support

    Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.

    Tuesday, September 3, 2013 1:38 AM
  • The problem here is that there are many potential polygons that could be drawn around these points. You have drawn a relatively simple one, but you could also have drawn a far more complex one with many concave areas that fit more tightly around your points.

    There is the method STConvexHull that will give you the convex polygon around a geometry (you could create a single multipoint instance for your points above) and this is suitable for giving an approximate representation of the area covered by the points. This may be enough for your needs.

    But if you want a closer fit around your points then you will need to decide how close that fit should be and generate an alpha shape. Unfortunately, there isn't a SQL Server method to do this but it's described really well by Alastair Aitchison  (sorry can't provide link here for some reason so search for alastair aitchison alpha shapes) and he has example code in his book (for spatial sql server 2012). However, it does involved writing .NET code and importing it into SQL Server as CLR functions, which might be a bit too much for a quick, approximate polygon.

    Tuesday, October 15, 2013 10:35 AM
  • What you are looking to do is called k-Means clustering. This will generate groups of polygons based one the density of data points. This is covered really well in regards to SQL in chapter 13 of this book: http://www.apress.com/9781430234913 You can download the code samples from that site as well.


    Wednesday, March 19, 2014 12:05 PM