Switching map providers has no effect.

2 posts, 1 answers
  1. Clint Singer
    Clint Singer avatar
    133 posts
    Member since:
    Oct 2012

    Posted 21 Mar 2011 Link to this post

    Hi,

    I have an application that access a couple custom map providers.  I have now upgraded to Q1 2011 and am trying to use the multiple tile providers option.

    Previously I would switch using the following code, which works fine:

    switch (mapProvider)
    {
      case MapProviders.Provider1:
        map.Provider = new Provider1();
      break;
      case MapProviders.Provider2:
        map.Provider = new Provider2();
      break;
    }

    Now I tried the following, which doesn't work:
    switch (mapProvider)
    {
      case MapProviders.Provider1:
        {
          map.Providers.Clear();
          map.Providers.Add(new OpenStreetMapProvider());
          map.Providers.Add(new Provider1());
        }
        break;
      case MapProviders.Provider2:
        {
          map.Providers.Clear();
          map.Providers.Add(new OpenStreetMapProvider());
          map.Providers.Add(new Provider2());
        }
        break;
    }

    The map loads the first time with the OpenStreet and custom provider one but switching to the second one doesn't cause anything to change.  The map stays the same as if nothing had happened.  I would have expected that I could switch between the different sets of map providers.

    Is this a bug?  Is there a work around for the issue that I could use until a bug fix is made available?

    I have also tried just setting the map.Provider directly afterwards and it didn't make any difference either.

    Cheers,
    Clint
  2. Answer
    Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 24 Mar 2011 Link to this post

    Hello Clint Singer,

    We are aware of a problem with Clear method. The problem is in the implementation of these method in the standard ObservableCollection and code in the RadMap which relates on it. We've created fix for this problem already. We've extended MapProviderCollection with RemoveAll method which should be used instead of Clear method. We also fixed code in the RadMap which relates to this problem. Fix will be available in the nearest internal build.

    Regards,
    Andrey Murzov
    the Telerik team
  3. DevCraft banner
Back to Top