SQL Spatial polygon inside out

后端 未结 5 2582
攒了一身酷
攒了一身酷 2021-02-19 21:27

I am allowing users to draw a polygon in Silverlight by clicking to draw. Then I loop through the points, convert them to longitude and latitude and then save to SQL (in a

5条回答
  •  独厮守ぢ
    2021-02-19 21:59

    Left hand rule governs this... as you 'walk' the perimeter of your polygon, your left hand must always be inside... so things should 'appear' to be digitized counter-clockwise. this hold true for donuts and polys with holes as well.

    if you keep your left hand 'inside' the polygon area you are interested in, they will be digitized in a clockwise fashion.

    A simple way to determine which one is correct is to always take the one with the SMALLER area... in just about any workflow I can thing of, there are no polygons that would be digitized that are larger than half the world...

    The workflow would go like this: have your users create their polygons, create another polygon with the opposite orientation (ReorientObject () in SQL Server) and then compare their areas... Logically, the smallest is correct.

    Just another way to solve this.

提交回复
热议问题