This is a migrated thread and some comments may be shown as answers.

Switching map providers has no effect.

1 Answer 78 Views
Map
This is a migrated thread and some comments may be shown as answers.
Clint Singer
Top achievements
Rank 1
Clint Singer asked on 21 Mar 2011, 11:55 PM
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

1 Answer, 1 is accepted

Sort by
0
Accepted
Andrey
Telerik team
answered on 24 Mar 2011, 11:09 AM
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
Tags
Map
Asked by
Clint Singer
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or