Michael J. Swart

February 17, 2010

More images from the Spatial Results tab

Filed under: SQLServerPedia Syndication,Tongue In Cheek — Michael J. Swart @ 1:00 am

Inspired by Itzik Ben Gan’s Geekiest Sig Challenge and Michael Cole’s virtual Christmas Card. I came up with a query that forces SQL Server’s spatial results tab to display something pretty. In recognition of Valentine’s Day, I chose a detail of Botticelli’s Birth of Venus.

The Query

The query isn’t too large, but it’s 120 KB, you can download it here:

http://michaeljswart.com/wp-content/uploads/2010/02/venus.sql

The Results

Not quite as pretty as the original

Not quite as pretty as the original

The Process

  • First reduce the color depth to a given color pallet (SQL Server’s icky pastels). I personally use a custom technique for this.
  • Use a program like Adobe Illustrator to turn into an svg file.
  • From there use your C# and VI savvy to convert into a SQL query.

Cheers guys

18 Comments »

  1. Michael, this is simply amazing! That’s way beyond what I expected when posting the challenge. Kudos!
    BTW, did you need to do anything special to get the graphical results in SSMS? When I run your query and look at the Spatial results tab it just waits for the graphical depiction forever. Works fine with mine and with Will’s queries. Any clue?

    Comment by Itzik Ben-Gan — February 19, 2010 @ 11:24 am

  2. That is pretty cool

    Does is really run in o seconds on your box? tales me 7 seconds on mine

    Comment by SQLDenis — February 19, 2010 @ 2:39 pm

  3. Hey! Thanks for the feedback!

    It does take 0 seconds on my box and I didn’t have to do anything special with the query I provided in the post. Even retesting just now: 0 seconds.

    I could try digging into finding the reasons for the discrepancy between running times on my computer and others. For some reason (maybe cause it’s Friday) but the curiosity and the motivation just aren’t there.

    One thing I did learn in this experiment: Is that overlapping areas of polygons in the same geometrycollection show up darker. Which explains Microsoft’s motivation for starting out with pastel colors.

    Comment by Michael J. Swart — February 19, 2010 @ 3:07 pm

  4. Yes, it is also 0 seconds when it run it again since it is probably cached

    Comment by SQLDenis — February 19, 2010 @ 3:19 pm

  5. Of course you’re right Denis, I get two seconds after a server restart. Afterwards, switching to the spatial results tab shows the image immediately.

    Comment by Michael J. Swart — February 19, 2010 @ 3:26 pm

  6. [...] More images from the Spatial Results tab – Who said working with SQL Server is not art….. [...]

    Pingback by Something for the Weekend: SQL Server Links for the week | John Sansom - SQL Server DBA in the UK — February 21, 2010 @ 6:00 am

  7. Wow, this is absolutely amazing! Who woulda thunk: Creation of art using SQL Server! Brilliant!

    Comment by Colin — February 25, 2010 @ 8:13 am

  8. Sorry, but you’ve got me curious now. How in the world did you get the detail in the picture the way you did?!? Itzik Ben-Gan said that he sat there for a good few hours drawing his picture, so I can’t imagine that you did the same manually?

    Comment by Colin — February 25, 2010 @ 8:31 am

  9. Nothing here was manual.
    The hardest part was to get an svg image with the right colors.
    For example, take a look at this one. http://upload.wikimedia.org/wikipedia/commons/c/cf/Flag_of_Canada.svg
    I mean open it up in a text editor. Once you realize paths are polygons the rest is easy:
    Me, myself and I

    Comment by Michael J. Swart — February 25, 2010 @ 10:42 am

  10. Actually the image in the last comment was cheating a bit. After I realized that shape colors are displayed with a certain amount of transparency. I realized I could get more colors by overlapping polygons. The image in the last comment is composed of only 6 multi-polygons. That took some C#, but again, nothing manual.

    Comment by Michael J. Swart — February 25, 2010 @ 10:45 am

  11. Ah Ok, brilliant! Thanks for sharing Michael :-D

    Comment by Colin — February 26, 2010 @ 12:39 am

  12. [...] what I wanted to say, some people are just talented: check out this submission by Michael J. Swart!  No further words [...]

    Pingback by A Developer's Blog · Drawing In SQL Server 2008 — February 26, 2010 @ 4:18 pm

  13. Bob Beauchemin explains why the query doesn’t display properly when using a 64-bit edition SQL Server. (See first comment above)

    Comment by Michael J. Swart — March 1, 2010 @ 9:03 am

  14. VERY very cool, thanks for sharing. Absolutely amazing.

    Comment by Jorge Segarra — March 5, 2010 @ 3:14 pm

  15. [...] of story to tell in the session, and I will be opening this session with the beautiful script of Botticelli’s Birth of Venus created by Michael J. [...]

    Pingback by SQL SERVER – What is Spatial Database? – Developing with SQL Server Spatial and Deep Dive into Spatial Indexing « Journey to SQL Authority with Pinal Dave — April 13, 2010 @ 9:31 pm

  16. [...] kicked off this session with Michael J Swart‘s beautiful spatial image. This session was the last one for the day but, to my surprise, I [...]

    Pingback by SQLAuthority News – TechEd India – April 12-14, 2010 Bangalore – An Unforgettable Experience – An Oppertunity of Lifetime « Journey to SQL Authority with Pinal Dave — April 29, 2010 @ 9:32 pm

  17. I am in awe of this. It is wonderful.

    Comment by Phil Factor — July 13, 2010 @ 2:52 pm

  18. Thanks Phil… It’s one of my favorite aesthetic things I’ve produced with a computer.

    Comment by Michael J. Swart — July 16, 2010 @ 3:36 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress