SQL Server 2008 geography - spatial result - color

2019-09-05 23:06发布

问题:

I have a table like this in SQL Server 2008:

serv_type   coords
------------------------
shop        0xE6100000010CE4857478080B49401CD2A8C0C9DE2C40
shop        0xE6100000010C54C6BFCFB80A49408A592F8672DA2C40
restaurant  0xE6100000010C2A00C63368064940B5C189E8D7162D40
shop        0xE6100000010CF9F884ECBC0B49405D6A847EA6FE2C40
restaurant  0xE6100000010CD3BEB9BF7A004940BC202235EDF22C40
restaurant  0xE6100000010CEE76BD3445004940508D976E12F32C40
restaurant  0xE6100000010CFFAECF9CF50B49400ABDFE243EE72C40
...        ...

If I SELECT * FROM this_table, I automatically obtain spatial results - something like points on a map.

What I would like to get is the very same thing, but with the points colored based on the serv_type column, i.e., I want the same "map", but all restaurants should be, say, blue and all shops should be red.

Is it possible to do this in SQL Server? Thanks.

回答1:

SQL Server is only going to give you the data. If you want to format that data for presentation according to attributes of that data, you're going to have to build a UI which contains your presentation logic.