Monday, May 25, 2015

Using SQL Spatial to create polygon features

I was assigned a task to generate polygon features using SQL Spatial. SQL Spatial has many features to create geometric/geographic features. When I was working on this assignment , for some reason, some of the generated polygons were not appearing correctly. They were too big or it didn't look right.

For example, when I tried to generate all the US state polygons, some states showed up correctly but some was too big and not of the right size.

After doing some searching, I found out that the polygons are not drawn in the right orientation.

I checked the envelope angle of each polygon feature using the following command.

EnvelopeAngle

If the envelope angle is greater than 180 degrees then I re-oriented the polygon using the following command

ReorientObject

After this fix, then all the 'Polygons' showed up correctly.

Hope this tip helps.

Have fun coding.

 

All Blogs so far ...