locked
v5 Custom Icons in GeoRSS RRS feed

  • Question

  •  

    Am I being thick here or what?

     

    The example on the v5 online SDK has an example of loading an GeoRSS feed which has custom icons on. Using exactly the same RSS file on my server doesn't bring in the custon icons (it uses the default). Why not?

     

    It appears that the relevant line is

    <mappoint:icon>dot.gif</mappoint:icon>

     

    But that appears to not work. I've also seen examples on the forum of using <icon>dot.gif</icon> within the <item> object this also seems to not be working either unless some kind of parsing is being done in the callback function. I've also seen examples using the VELayerSpecification.IconUrl property but this seems to be a v3 or v4 class and property. I feel like I'm missing something obvious here. Any ideas?

     

     

    Tuesday, June 5, 2007 11:45 AM

Answers

  • There actually is a way to do this in V5.  It's tricky as it's not really supported yet (the functionality is there, but it seems they haven't fully implemented it).  I've posted a general strategy on how to do this here:

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1664041&SiteID=1

    I'll see if I can write a separate article with some sample code for everybody to work with when I have time.

    Regards,
    Wednesday, June 6, 2007 12:35 AM
  • Yep, saw that post -- doing it recursively one way or another after the initial load is an option, although it's a workaround for functionality that should be there, but isn't.    I've been stepping through the v5 parser line by line and it's hard to see why its ignoring the icon urls as supplied by the GeoRSS file (and as you point out, applied to the undocumented IconId property).  Initially I thought it had to do with not defining a specific ShapeLayer at first (where the objects are added to the "base" layer of the map...like when you add a single pin to the map, not a layer).  I'm suprised that someone on the VE development team hasn't weighed in on this one way or the other yet.  Anyhow, if I have any epiphanies I'll post away, and will keep an eye out as to anything you add on the topic!
    Wednesday, June 6, 2007 11:33 AM

All replies

  • You are not being thick; the parsing behavior changed from v4 to v5 from what I can tell.  I have no problems rendering custom icons from a source <icon> node in the GeoRSS file in v4.  I have not been able to accomplish this in v5 without recursively setting the custom icons as you mention in the callback.  I've started stepping through the exact parsing logic in the mapcontrol.js file but that type of debugging takes time.  I'll put out a post if I make any progress with the v5 parser.
    Tuesday, June 5, 2007 1:09 PM
  • There actually is a way to do this in V5.  It's tricky as it's not really supported yet (the functionality is there, but it seems they haven't fully implemented it).  I've posted a general strategy on how to do this here:

    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1664041&SiteID=1

    I'll see if I can write a separate article with some sample code for everybody to work with when I have time.

    Regards,
    Wednesday, June 6, 2007 12:35 AM
  • Yep, saw that post -- doing it recursively one way or another after the initial load is an option, although it's a workaround for functionality that should be there, but isn't.    I've been stepping through the v5 parser line by line and it's hard to see why its ignoring the icon urls as supplied by the GeoRSS file (and as you point out, applied to the undocumented IconId property).  Initially I thought it had to do with not defining a specific ShapeLayer at first (where the objects are added to the "base" layer of the map...like when you add a single pin to the map, not a layer).  I'm suprised that someone on the VE development team hasn't weighed in on this one way or the other yet.  Anyhow, if I have any epiphanies I'll post away, and will keep an eye out as to anything you add on the topic!
    Wednesday, June 6, 2007 11:33 AM
  • As far as I can tell, looping through after adding the GeoRSS layer is the only way to get it to work. Unfortunately, you then hit a different problem: If you're not zoomed out far enough to see all the points you just imported, your loop isn't going to hit those points and change their icon. This results in you having some with you custom icon, and some with the normal pushpin.
    Thursday, June 7, 2007 3:28 PM