Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
825
ESRI REST Service
posted

Can the xamMap control be used for the ESRI REST Service?

I am using the following REST for their maps:

http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer

Thanks

Parents
No Data
Reply
  • 5124
    posted

    flowerdj,

    As I mentioned in the support case you have opened, this support is coming in v11.1, planned for May release.

    As an interim work-around, Engineering has provided the following:  

    Please find attached the ESRI Tile source. To setup the XamMap, you can use the following code with the attached file if you want to use only the ESRI REST service, but if your goal is to overlay a shapefile or add MapElements (SurfaceElement, SymbolElement or PathElement) then you will need to wait for the 11.1 release:

    <Grid x:Name="LayoutRoot" Background="White">

            <ig:XamMap Name="igMap" Loaded="igMap_Loaded" MapProjectionType="SphericalMercator">

                <ig:XamMap.MapTileSource>

                    <local:ESRIMapTileSource />

                </ig:XamMap.MapTileSource>

            </ig:XamMap>

        </Grid>

     

    public partial class MainPage : UserControl

        {

            public MainPage()

            {

                InitializeComponent();

            }

     

            private void InitMapCoordinates()

            {

                // define world dimensions

                var worldTopLeft = new Point(-180, 90);

                var worldBottomRight = new Point(180, -90);

     

                // Convert Geodetic to Cartesian coordinates

                var winTopLeft = this.igMap.MapProjection.ProjectToMap(worldTopLeft);

                var winBottomRight = this.igMap.MapProjection.ProjectToMap(worldBottomRight);

                // Create Rect structure the map control's WindowRect and WorldRect

                var winRect = new Rect()

                {

                    X = Math.Min(winTopLeft.X, winBottomRight.X),

                    Y = Math.Min(winTopLeft.Y, winBottomRight.Y),

                    Width = Math.Abs(winTopLeft.X - winBottomRight.X),

                    Height = Math.Abs(winTopLeft.Y - winBottomRight.Y)

                };

                this.igMap.IsAutoWorldRect = false;

                this.igMap.WindowZoomMaximum = 80;

     

                // Change the map control's WindowRect and WorldRect

                this.igMap.WindowRect = this.igMap.WorldRect = winRect;

            }

     

            private void igMap_Loaded(object sender, RoutedEventArgs e)

            {

                InitMapCoordinates();

            } 

        }

    }

     

    Thanks,

    EsriTileSource.cs.zip
Children