views:

181

answers:

1

I get my information from my SQL query (Name, Description, Latitude, Longitude) but I'm having problems getting it into the proper format for GeoRSS so that it may be consumed by my Virtual Earth map. FOR XML AUTO isn't giving me quite what I want and I can't seem to find any examples of how to extract the output of a SQL query to GeoRSS.

Here is a sample of the GeoRSS format that I'm looking for:

  <channel>
    <title>Reported Road Hazards</title>
    <link/>
    <description>Road hazards reported to the city</description>
<item>
      <title>Traffic Light</title>
      <description>Traffic light on north west corner out</description>
      <geo:lat>43.64887</geo:lat>
      <geo:long>-79.385362</geo:long>
    </item>
 </channel>
+1  A: 

I've gotten my desired output via SQL.

With XMLNAMESPACES ( 'http://www.w3.org/2003/01/geo/wqs84_pos#' as geo)
Select Name as title, [Description], Lat as 'geo:lat', Long as 'geo:long'
From myTable
FOR XML PATH ('item'), ROOT('rss')

This basic pattern will give you XML in GeoRSS format for consumption by services such as Bing Maps, Google Maps, etc....

jstell