ArcGIS Runtime SDK - How to use Gall's Stereographic Map

3354
7
Jump to solution
09-16-2015 11:19 AM
MichaelSibilio
New Contributor

I'm writing a c# application using the ArcGIS 10.2.6 Runtime SDK for .Net.  I'm trying to figure out a way to utilize a basemap that is using Gall's Stereographic projection.  Can this be done?  If so, can I get an offline version?

0 Kudos
1 Solution

Accepted Solutions
FreddieGibson
Occasional Contributor III

Could you provide a small sample to show what you're doing in your application? I tested these coordinate systems on my end and everything appears to be working fine.

World Imagery (3857)

http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer

2015-09-17_1614_001.png

World Street Map (3857)

http://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer

2015-09-17_1616.png

World Topo Map (3857)

http://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer

2015-09-17_1614.png

Esri Imagery World 2D (4326) ** Extended Support **

http://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer

2015-09-17_1616_001.png

Esri StreetMap World 2D (4326) ** Extended Support **

http://services.arcgisonline.com/arcgis/rest/services/ESRI_StreetMap_World_2D/MapServer

2015-09-17_1617.png

** Code I used to test **

XAML

<Window x:Class="GallMap.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
  Title="Gall Stereographic Map" 
  Height="350" 
  Width="800">
    <Grid>
        <Grid.Resources>
            <Style TargetType="{x:Type Border}">
                <Setter Property="Margin" Value="10" />
                <Setter Property="Padding" Value="5" />
                <Setter Property="Background" Value="White" />
                <Setter Property="BorderBrush" Value="Black" />
                <Setter Property="BorderThickness" Value="2" />
            </Style>
            <Style TargetType="{x:Type TextBlock}">
                <Setter Property="FontSize" Value="20" />
                <Setter Property="FontWeight" Value="Bold" />
                <Setter Property="Background" Value="White" />
                <Setter Property="Foreground" Value="Black" />
                <Setter Property="TextAlignment" Value="Center"/>
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <esri:MapView x:Name="MyMapView1" Margin="3" />
        <esri:MapView x:Name="MyMapView2" Grid.Column="1" Margin="3"/>
        
        <Border VerticalAlignment="Bottom" HorizontalAlignment="Center" Grid.ColumnSpan="2">
            <Border.Effect>
                <DropShadowEffect />
            </Border.Effect>
            
            <StackPanel Orientation="Horizontal">
                <StackPanel.Resources>
                    <Style TargetType="{x:Type RadioButton}">
                        <Setter Property="Margin" Value="4,0,4,0" />
                    </Style>
                </StackPanel.Resources>
                <RadioButton Content="World Imagery" Checked="ToggleButton_OnChecked"/>
                <RadioButton Content="World Street"  Checked="ToggleButton_OnChecked" />
                <RadioButton Content="World Topo"  Checked="ToggleButton_OnChecked" IsChecked="True" />
                <RadioButton Content="World Imagery 2D"  Checked="ToggleButton_OnChecked" />
                <RadioButton Content="World Street 2D"  Checked="ToggleButton_OnChecked" />
            </StackPanel>
        </Border>
        
        <Border HorizontalAlignment="Left" VerticalAlignment="Top">
            <Border.Effect>
                <DropShadowEffect />
            </Border.Effect>
            
            <TextBlock Text="{Binding ElementName=MyMapView1, Path=SpatialReference.Wkid, StringFormat=Map WKID: {0}}" Padding="5" />
        </Border>

        <Border HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="1">
            <Border.Effect>
                <DropShadowEffect />
            </Border.Effect>

            <TextBlock Text="{Binding ElementName=MyMapView2, Path=SpatialReference.Wkid, StringFormat=Map WKID: {0}}" Padding="5" />
        </Border>
    </Grid>
</Window>

XAML.cs

using Esri.ArcGISRuntime.Controls;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Layers;
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;


namespace GallMap
{
    public partial class MainWindow : Window
    {
        private readonly Dictionary<string, string> m_urls = new Dictionary<string, string>
        {
            {"World Imagery", "http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer"},
            {"World Topo", "http://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer"},
            {"World Street", "http://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer"},
            {"World Imagery 2D", "http://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer"},
            {"World Street 2D", "http://services.arcgisonline.com/arcgis/rest/services/ESRI_StreetMap_World_2D/MapServer"}
        };

        public MainWindow()
        {
            InitializeComponent();
        }

        private void ToggleButton_OnChecked(object sender, RoutedEventArgs e)
        {
            var tag = (sender as RadioButton).Content.ToString();

            var mapviews = new[] {MyMapView1, MyMapView2};

            foreach (var mapview in mapviews)
            {
                var layer = new ArcGISDynamicMapServiceLayer(new Uri(m_urls[tag]));
                
                var wkid = Array.IndexOf(mapviews, mapview) == 0 ? 53016 : 54016;
                var map = new Map
                {
                    SpatialReference = SpatialReference.Create(wkid),
                    InitialViewpoint = new Viewpoint(new Envelope(-141, 7, -51, 78, SpatialReference.Create(4326)))
                };
                
                map.Layers.Add(layer);
                mapview.Map = map;
            }
        }
    }
}

View solution in original post

7 Replies
FreddieGibson
Occasional Contributor III

Are you having problems using a layer with this particular projection? I can see two Gall Stereographic projections listed in the list of supported coordinate systems for runtime. Are you using either of these?

53016 : Sphere_Gall_Stereographic

54016 : World_Gall_Stereographic

Projected Coordinate Systems

https://developers.arcgis.com/net/desktop/guide/projected-coordinate-systems.htm

MichaelSibilio
New Contributor

Sorry for being a noob to ArcGIS.  Maybe I'm getting confused between Spatial Reference and Projections.  Let me experiment with it.  Thanks for the suggestion.

0 Kudos
MichaelSibilio
New Contributor

I'm only able to get 54016 : World_Gall_Stereographic to work with the deprecated services, such as ESRI_StreetMap_World_2D.  Is there another map that can be used to represent this correctly?

0 Kudos
FreddieGibson
Occasional Contributor III

Could you provide a small sample to show what you're doing in your application? I tested these coordinate systems on my end and everything appears to be working fine.

World Imagery (3857)

http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer

2015-09-17_1614_001.png

World Street Map (3857)

http://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer

2015-09-17_1616.png

World Topo Map (3857)

http://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer

2015-09-17_1614.png

Esri Imagery World 2D (4326) ** Extended Support **

http://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer

2015-09-17_1616_001.png

Esri StreetMap World 2D (4326) ** Extended Support **

http://services.arcgisonline.com/arcgis/rest/services/ESRI_StreetMap_World_2D/MapServer

2015-09-17_1617.png

** Code I used to test **

XAML

<Window x:Class="GallMap.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:esri="http://schemas.esri.com/arcgis/runtime/2013"
  Title="Gall Stereographic Map" 
  Height="350" 
  Width="800">
    <Grid>
        <Grid.Resources>
            <Style TargetType="{x:Type Border}">
                <Setter Property="Margin" Value="10" />
                <Setter Property="Padding" Value="5" />
                <Setter Property="Background" Value="White" />
                <Setter Property="BorderBrush" Value="Black" />
                <Setter Property="BorderThickness" Value="2" />
            </Style>
            <Style TargetType="{x:Type TextBlock}">
                <Setter Property="FontSize" Value="20" />
                <Setter Property="FontWeight" Value="Bold" />
                <Setter Property="Background" Value="White" />
                <Setter Property="Foreground" Value="Black" />
                <Setter Property="TextAlignment" Value="Center"/>
            </Style>
        </Grid.Resources>
        <Grid.ColumnDefinitions>
            <ColumnDefinition />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <esri:MapView x:Name="MyMapView1" Margin="3" />
        <esri:MapView x:Name="MyMapView2" Grid.Column="1" Margin="3"/>
        
        <Border VerticalAlignment="Bottom" HorizontalAlignment="Center" Grid.ColumnSpan="2">
            <Border.Effect>
                <DropShadowEffect />
            </Border.Effect>
            
            <StackPanel Orientation="Horizontal">
                <StackPanel.Resources>
                    <Style TargetType="{x:Type RadioButton}">
                        <Setter Property="Margin" Value="4,0,4,0" />
                    </Style>
                </StackPanel.Resources>
                <RadioButton Content="World Imagery" Checked="ToggleButton_OnChecked"/>
                <RadioButton Content="World Street"  Checked="ToggleButton_OnChecked" />
                <RadioButton Content="World Topo"  Checked="ToggleButton_OnChecked" IsChecked="True" />
                <RadioButton Content="World Imagery 2D"  Checked="ToggleButton_OnChecked" />
                <RadioButton Content="World Street 2D"  Checked="ToggleButton_OnChecked" />
            </StackPanel>
        </Border>
        
        <Border HorizontalAlignment="Left" VerticalAlignment="Top">
            <Border.Effect>
                <DropShadowEffect />
            </Border.Effect>
            
            <TextBlock Text="{Binding ElementName=MyMapView1, Path=SpatialReference.Wkid, StringFormat=Map WKID: {0}}" Padding="5" />
        </Border>

        <Border HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="1">
            <Border.Effect>
                <DropShadowEffect />
            </Border.Effect>

            <TextBlock Text="{Binding ElementName=MyMapView2, Path=SpatialReference.Wkid, StringFormat=Map WKID: {0}}" Padding="5" />
        </Border>
    </Grid>
</Window>

XAML.cs

using Esri.ArcGISRuntime.Controls;
using Esri.ArcGISRuntime.Geometry;
using Esri.ArcGISRuntime.Layers;
using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Controls;


namespace GallMap
{
    public partial class MainWindow : Window
    {
        private readonly Dictionary<string, string> m_urls = new Dictionary<string, string>
        {
            {"World Imagery", "http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer"},
            {"World Topo", "http://services.arcgisonline.com/arcgis/rest/services/World_Topo_Map/MapServer"},
            {"World Street", "http://services.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer"},
            {"World Imagery 2D", "http://services.arcgisonline.com/arcgis/rest/services/ESRI_Imagery_World_2D/MapServer"},
            {"World Street 2D", "http://services.arcgisonline.com/arcgis/rest/services/ESRI_StreetMap_World_2D/MapServer"}
        };

        public MainWindow()
        {
            InitializeComponent();
        }

        private void ToggleButton_OnChecked(object sender, RoutedEventArgs e)
        {
            var tag = (sender as RadioButton).Content.ToString();

            var mapviews = new[] {MyMapView1, MyMapView2};

            foreach (var mapview in mapviews)
            {
                var layer = new ArcGISDynamicMapServiceLayer(new Uri(m_urls[tag]));
                
                var wkid = Array.IndexOf(mapviews, mapview) == 0 ? 53016 : 54016;
                var map = new Map
                {
                    SpatialReference = SpatialReference.Create(wkid),
                    InitialViewpoint = new Viewpoint(new Envelope(-141, 7, -51, 78, SpatialReference.Create(4326)))
                };
                
                map.Layers.Add(layer);
                mapview.Map = map;
            }
        }
    }
}
MichaelSibilio
New Contributor

Thank you so much for the detailed explanation.  It is greatly appreciated.  I am able to get the map to work when connected to the internet now.  The issue is trying to use them offline.  I'm confused on how to get a .tpk file of the maps for offline use.  I downloaded the standard topology.tpk file that came with the sample package, but I cannot make it look like the Gall's Stereographic Maps.

0 Kudos
FreddieGibson
Occasional Contributor III

I think for the offline workflow you'd need to have tiles that are already projected to the Gall's Steographic coordinate system. I'm looking at the REST endpoint for the Export Tiles operation and I don't see anything available here to allow you to reproject the tiles.

Export Tiles operation of World Street Map (MapServer)

http://sampleserver6.arcgisonline.com/arcgis/rest/services/World_Street_Map/MapServer/exportTiles

Export Tile Cache (Sample for Runtime .NET)

https://developers.arcgis.com/net/sample-code/ExportTileCache/

I believe that this information is mentioned in the .NET Runtime help as follows:

Tiled layers

Tiled layers are precached layers. At the time of caching, a spatial reference is used and is therefore predefined. It's typically not possible to request tiled layers in a different spatial reference from that defined in the service (unless the server supports doing this on the fly; most do not). If an ArcGIS tiled layer is added to a map in a different spatial reference, it cannot be drawn.

Spatial references—ArcGIS Runtime SDK for .NET | ArcGIS for Developers

MichaelSibilio
New Contributor

Thanks again for all of your time.  I will look into trying to cache the maps with the correct projections.

0 Kudos