Welcome to EMC Consulting Blogs Sign in | Join | Help

Steve Wright's Blog

I am also posting my updates to the following location: http://zogamorph.blogspot.com

Business Intelligence with SQL Server 2008 Geometry Data Type.

I am currently working on a project which is automating a business intelligence process base upon images and image recognition. The process is as follows:

  • Take a photography
  • Put the photography through the image recognition software and record the recognition data.
  • Process the recognition data into meaningful business metrics
  • Produce a report on metrics

The part of the process, from above, that I am helping with is processing the recognition data (the hit data) into meaningful business data. This process simply takes the hit data (which is a point), then creates some square blocks, which I use to group the hits data and perform some metric operations. The metrics currently use data about the area and the density of hits within the area. To help process this data I decided to make use of the SQL Server 2008 spatial type: Geometry.

Firstly I would like to point out that I didn’t have to use the geometry type. As I am currently dealing with square areas, I can group or locate all the hits that fall within area by using the following filter clause: HitY between MinY and MaxY and HitX between MinX and MaxX. However by reading the filter alone can cause misunderstanding on what the filter is suppose to be doing. As I am using the geometry data type that filter is replaced by something which does state what the filter is doing, like so: area.STIntersects(HitPoint) = 1 with the added bonus of less code being written and read as well as less chance of a bug being created.

Another point I would to make is that by using the geometry type my code is adaptable to changes. Currently our process is working to square areas and in the future that might change. Using the standard SQL filters that would mean all the filter clauses of the data would have to be updated. Also I would need to be more sophisticated, which could take a longer development and testing cycle which could increase the risk of issues. With the use of the geometry type, only the way that the area polygon is created would need to be updated which will help in reducing the development and testing cycle which interns reduces the risk of issues.

Another benefit of having some of the data stored as the geometry spatial data type is that I was able to evaluate or debug the steps of the process far easier. This is due to the way that SQL Server Management Studio display spatial data as shown below.

SpatialGrid

Published 19 January 2009 21:23 by steve.wright

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

 

Ayyappan said:

This artical is a good start for the beginners...can you please explain spatial datatype and the free software to read and draw those shapes.

i am interested in learning this feature and like to implement in my innovative BI projects

seek for assistance

thanks in advance

October 8, 2009 12:46
 

Steve J said:

This is a very interesting article and would also be interested in additional information related to spatial datatypes.

Thanks

March 9, 2010 23:55
 

Jim S said:

Great Article

Thanks

<a href='http://www.nationaldatasource.com'> More Information </a>

March 16, 2010 00:36

Leave a Comment

(required) 
(optional)
(required) 
Submit

This Blog

Syndication

News

Locations of visitors to this page
Powered by Community Server (Personal Edition), by Telligent Systems