Derek Chan


I noticed that this can't be found anywhere but here's a sample GeoRSS file for those who need something basic to start off with:

Code Snippet

< xml version="1.0" encoding="utf-8" >

<rss version="2.0" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#">

<channel>

<title>test</title>

<link>http://localhost/default.aspx</link>

<description>Hello world!</description>

<item>

<name>Sample location</name>

<description>Aspen, CO</description>
<geo:Point>

<geo:lat>39.1930007935</geo:lat>

<geo:lon>-106.820999146</geo:lon>

</geo:Point>
</item>

</channel>

</rss>

There's a nice sample application here: http://brainoff.com/test/ve.html





Re: Sample GeoRSS File

Amateur20


How is the text formatted in the bubble on the linked page your provided





Re: Sample GeoRSS File

Derek Chan

The text in the bubble is just HTML inside a <description> tag





Re: Sample GeoRSS File

Derek Chan

Also to help out for all:

There's a bug with VE rendering the <link> element inside your XML file that will cause a "..." text to appear rather than the link on the page (you can see it on the demo page provided above). Rather than store your url inside a <link> tag, a workaround would be to store it in an anchor tag in the <description> element. You won't be able to throw it inside a "<![CDATA[" escaper so you'll need a bit of grunt work to get your anchor tag in there. Here's a sample below that will redirect anyone to www.helloworld.com if placed inside your <description> element:

&lt;a href=&quot;http://www.helloworld.com&quot;&gt;&lt;/a;&gt;click to go to helloworld site

it will look like this on the page source:
<a href='http://www.helloworld.com'></a>click to go to helloworld site




Re: Sample GeoRSS File

kj2w

Derek, could you provide the georss.xml file for your example I tried loading the page found at http://brainoff.com/test/ve.htmllocally

Code Snippet

<html>

<head>

<title></title>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<script src="http://dev.virtualearth.net/mapcontrol/v3/mapcontrol.js"></script>

<script>

var map = null;

var layerid=1;

function GetMap()

{

map = new VEMap('myMap');

map.LoadMap();

}

function AddMyLayer(source)

{

var veLayerSpec = new VELayerSpecification();

veLayerSpec.Type = VELayerType.GeoRSS;

veLayerSpec.ID = layerid;

veLayerSpec.LayerSource = source;

veLayerSpec.Method = 'get';

veLayerSpec.FnCallback = onFeedLoad;

map.AddLayer(veLayerSpec);

layerid++;

}

function onFeedLoad(feed)

{

alert('RSS or Collection loaded. There are '+feed.length+' items in this list.');

}

</script>

</head>

<body onload="GetMap(); AddMyLayer('rss.xml');">

<div id='myMap' style="position:relative; width:400px; height:400px;"></div>

Loading <a href="rss.xml">rss.xml</a>

</body>

</html>

and made this as a georss file:

Code Snippet

http://www.w3.org/2003/01/geo/wgs84_pos#">

http://localhost/default.aspx

Hello world!

Sample location

Aspen, CO

39.1930007935

-106.820999146


but i got this error: 'RSS or Collection loaded. There are 0 items in this list.'

J





Re: Sample GeoRSS File

kj2w

Ok I got it to work. I didnt notice that your xml file was named 'rss.xml'. I had named it 'georss.xml', once i named everything correctly it worked fine.

J





Re: Sample GeoRSS File

ssuing8825

Derek ,

Thanks for posting this, I had to peice this information from a couple different places before you posted your message. Do you know of any other formates besides the one you posted that will work. Also about your link example, I tried putting javascript into it and it didn't seem to run. Can you confirm that you can not have Javascript execute in the description field.

I also think it would be nice to beable to set the set OnMouseOverCallback and ShowDetailOnMouseOver directly in the feed as I have not figured out how to change these values for pushpins added in this manner

Thanks





Re: Sample GeoRSS File

Derek Chan

I haven't had any success actually embedding <script> tags inside the description element but your probably looking for inline javascript. Below is a sample which generates an alert('hi') when the anchor tag is clicked

Code Snippet
<description>bla bla info here &lt;a href=&quot;http://www.helloworld.com&quot;onclick=alert(&quot;hi&quot;);&gt;&lt;a;&gt;click to go to helloworld site</description>