Michael J. Swart

May 5, 2017

Drawing (again) with SQL Server

Filed under: Miscelleaneous SQL,SQLServerPedia Syndication,Tongue In Cheek — Michael J. Swart @ 10:41 am

You have my permission to skip this post. This one’s just for me. So I’ve been drawing again with SQL Server’s spatial results tab, the first time I posted something was with Botticelli’s Birth of Venus in More images from the Spatial Results Tab.

Why Michael??

Because it’s a stupid challenge and I wanted to see what I could do with it. The SSMS spatial tab is a lousy crummy medium for images. It really is quite terrible and using SSMS to draw imposes restrictions and rules. It’s fun to see what I can do by staying within that framework. It’s something to push against just because it’s challenging. Others do crosswords, This week, I did this.

Why Now?

I realized a couple things lately.

The Colors Seem Dull … But Don’t Have to Be
I used to think the spatial results tab uses lousy colors, pastel and dull. I realized that they’re not dull, they’re just transparent. I can overlap polygons inside a geometry collection to get more solid colors. Here are the top 100 colors without transparency.

Grid

The Colors Seem Arbitrary … But Don’t Have to Be
The palette that SSMS uses is terrible. It’s almost as if the nth color is chosen using something like Color.FromArgb(new Random(n).Next()); Notice that color 6 and 7 (the beige colors on the left side of the grid) are almost indistinguishable from each-other. But I can use that. I can overlap different colors to get the color I need. And I can write a program to pick the best combination of overlaps. Here’s a nice red and blue:

SSB

But black remains difficult.

Curves Are Supported Now
I can use arc segments called CIRCULARSTRING. SVG files mostly use Bézier curves which cannot be translated easily to arc segments.
Here’s a logo that I rebuilt using arcs instead of Bézier curves:
d2l

For some reason, if you begin to use CIRCULARSTRING, then the transparent colors won’t blend with itself (just other colors).
Also arc segments are rendered as several small line segments anyway, so for my purposes, it’s not a super feature.

Polly

One last picture/query of a scarlet macaw. Click on it or any other picture in this post to get the query that generated it.
Parrot

6 Comments »

  1. magnificent work 🙂 belfast salutes you

    Comment by george — May 5, 2017 @ 2:21 pm

  2. Thank you George and Belfast!

    Comment by Michael J. Swart — May 5, 2017 @ 2:23 pm

  3. Pretty Polly!

    How did you construct the polygons required for the parrot?
    (please don’t say you hand-coded them, I’ll have a heart attack)

    Warm regards from Brighton, UK!

    Comment by Oz — May 8, 2017 @ 7:51 am

  4. Hi Oz!

    I got a picture, reduced the colors, saved it as svg (which is xml) and then wrote a kind of translation program to take it the rest of the way.

    Comment by Michael J. Swart — May 8, 2017 @ 9:05 am

  5. Hi, Michael,
    I am really blow-minded with your excellent work !!!
    I really admire your dedication and drawing skills … Let me confess something …
    I didn’t know this kind of job can be executed on SQL Server …

    Beautiful parrot, by the way,
    Best Regards from Mexico City …

    Thanks,
    Sincerely,

    Alberto Sanchez

    Comment by Alberto Sarabia — May 8, 2017 @ 8:47 pm

  6. Thanks Alberto! I appreciate those words.

    Comment by Michael J. Swart — May 10, 2017 @ 10:19 am

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress