none
With 1909 18363.535 switching from Aerial3DWithRoads .Globe to .Road .Globe gives Mercator projection RRS feed

  • Question

  • Hi, when we switch a map with

    .Aerial3DWithRoads and .Globe

    to

    .Road and .Globe

    the map ends up in a Mercator projection, not .Globe.

    We are just setting the former with:

    myMap.Style = MapStyle.Road;
    myMap.MapProjection = MapProjection.Globe; 

    And, sometimes, this makes the app hang.

    Is this the wrong sequence?


    Karhu Koti


    • Edited by karhukoti Wednesday, December 18, 2019 10:39 PM
    Wednesday, December 18, 2019 10:36 PM

Answers

  • The Style property is there for legacy support and it appears there's a quirk in the implementation. For legacy support reasons, It will force both a style change and a projection change, and since this property set is queued and executed asynchronously it looks like the projection is getting overridden after you set the projection property in your code.

    Try using the new stylesheet API to set the style like this:

    myMap.StyleSheet = MapStyleSheet.RoadLight();

    Then you shouldn't have to even re-set the projection, it should stay unchanged as globe.

    • Marked as answer by karhukoti Saturday, December 21, 2019 3:05 PM
    Friday, December 20, 2019 12:49 AM
    Moderator

All replies

  • The Style property is there for legacy support and it appears there's a quirk in the implementation. For legacy support reasons, It will force both a style change and a projection change, and since this property set is queued and executed asynchronously it looks like the projection is getting overridden after you set the projection property in your code.

    Try using the new stylesheet API to set the style like this:

    myMap.StyleSheet = MapStyleSheet.RoadLight();

    Then you shouldn't have to even re-set the projection, it should stay unchanged as globe.

    • Marked as answer by karhukoti Saturday, December 21, 2019 3:05 PM
    Friday, December 20, 2019 12:49 AM
    Moderator
  • Thanks Duncan, using .StyleSheet worked.

    I am noticing that MapStyleSheet. does not have an entry for Terrain as MapStyle. does -- are you recommending that MapStyle just no longer be used going forward?


    Karhu Koti

    Saturday, December 21, 2019 3:07 PM
  • Correct. The terrain style is also there for legacy reasons and currently gives you exactly the same style as road. MapStyleSheet should be the preferred way of setting any map style (and also allows you full customization if you want).
    Tuesday, December 31, 2019 1:08 AM
    Moderator