User Tools

Site Tools


map_suite_world_map_kit_online_quick_start_guide

Map Suite World Map Kit Online Quick Start Guide

Note: The page was created before Map Suite 10. Map Suite 10.0 organized many classes into new namespaces and assemblies as well as had a few minor breaks in compatibility. The majority of previously built code should work without modification assuming the new namespaces are added. For guidance on upgrading your existing code, please check out MapSuite 10 Upgrade Guide.

The Map Suite World Map Kit Online QuickStart Guide will guide you through the process of creating a simple application that consumes map data from the World Map Kit Online service. This edition of the QuickStart Guide supports all Map Suite products from version 7.0.0.0 and higher, and shows you how to create four types of applications: WinForms Desktop, WPF Desktop, Silverlight, and a web-based application.

Welcome to the Map Suite World Map Kit Online from ThinkGeo, delivering complete maps of the world directly to your GIS applications! The Map Suite World Map Kit Online is a hosted service, offering detailed maps of the globe that your applications can consume directly over the Internet. Because ThinkGeo maintains the servers for you, you won't have to worry about distributing huge datasets to your clients. Just add a few lines of code to your application and the entire world is at your fingertips.

The purpose of this guide is to help you quickly start building your own GIS applications that consume maps from the World Map Kit Online. Like any new software, there is some learning to be done.

How do we start to learn how to take advantage of Map Suite World Map Kit Online? The best way is to make a sample application with it.

Accessing Map Suite World Map Kit Online from a Desktop Application

In this example, we'll create a desktop application with Map Suite Desktop Edition that accesses the World Map Kit Online. There are two ways to consume these maps: If you have purchased an access license for the World Map Kit Online, you can request watermark-free maps that do not contain our logo image. All other users can freely access the World Map Kit Online for no charge, but there will be a ThinkGeo watermark on your map images.

The first example below shows you how to access the World Map Kit Online for free, which delivers watermarked maps. The second example shows how to access World Map Kit Online using your premium paid account, which requires a client ID and a private key to login.

Example 1: Access the World Map Kit Online with a Free Account

Here is an example showing how to access the World Map Kit Online with Map Suite Desktop Edition using a free unauthenticated connection.

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);
 
            // You can access to the World Map Kit Server for free, but with watermark on every tile image
            WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay();
            winformsMap1.Overlays.Add(worldMapKitDesktopOverlay);
 
            winformsMap1.CurrentExtent = new RectangleShape(-139.2, 92.4, 120.9, -93.2);
 
            winformsMap1.Refresh();
        }
    }

Example 2: Access the World Map Kit Online with a Premium Account

Here is an example showing how to access the World Map Kit Online with Map Suite Desktop Edition, using a premium paid account. This requires that you pass in a client ID and a private key as shown.

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);
            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-126, 57, -70, 18);
 
            // You can access to the World Map Kit Server for free, but with watermark on every tile image
            TiledWmsLayer tiledWmsLayer = new TiledWmsLayer(new Uri("http://worldmapkit1.thinkgeo.com/CachedWmsServer/WmsServer.axd"));
 
            // Also you can access to the World Map Kit Server with billable account, 
            // otherwise you will get watermark on every tile image
            tiledWmsLayer.ClientId = "YourClientId";
            tiledWmsLayer.PrivateKey = "YourPrivateKey";
 
            // You need to specify the name and style of Layer you want to consume
            tiledWmsLayer.ActiveLayerNames.Add("WorldMapKitLayer");
            tiledWmsLayer.ActiveStyleNames.Add("WorldMapKitDefaultStyle");
 
            LayerOverlay staticOverlay = new LayerOverlay();
            staticOverlay.Layers.Add("WorldMapKitServer", tiledWmsLayer);
            winformsMap1.Overlays.Add(staticOverlay);
 
            winformsMap1.Refresh();
        }
}

Accessing the Map Suite World Map Kit Online from a WPF application

This section shows how you can use a WPF application created using Map Suite WPF Desktop Edition to access the World Map Kit Online.

Example 1: Access the World Map Kit Online with a Free Account

Here is an example showing how to access the World Map Kit Online with Map Suite WPF Desktop Edition using a free unauthenticated connection.

public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }
 
        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeographyUnit.DecimalDegree;
            Map1.CurrentExtent = new RectangleShape(-155.733, 95.60, 104.42, -81.9);
 
            WorldMapKitWmsWpfOverlay worldOverlay = new WorldMapKitWmsWpfOverlay();
            Map1.Overlays.Add("WMK", worldOverlay);
 
            Map1.Refresh();
        }
    }

Example 2: Access the World Map Kit Online with a Premium Account

Here is an example showing how to access World Map Kit Online with Map Suite WPF Desktop Edition, using a premium paid account. This requires that you pass in a client ID and a private key as shown.

public partial class Window1 : Window
    {
        public Window1()
        {
            InitializeComponent();
        }
 
        private void Grid_Loaded(object sender, RoutedEventArgs e)
        {
            map1.MapUnit = GeographyUnit.DecimalDegree;
            map1.CurrentExtent = new RectangleShape(-126, 57, -70, 18);
 
            // You can access to the World Map Kit Server for free, but with watermark on every tile image
            TiledWmsLayer tiledWmsLayer = new TiledWmsLayer(new Uri("http://worldmapkit1.thinkgeo.com/CachedWmsServer/WmsServer.axd"));
 
            // Also you can access to the World Map Kit Server with billable account,
            // otherwise you will get watermark on every tile image
            tiledWmsLayer.ClientId = "YourClientId";
            tiledWmsLayer.PrivateKey = "YOurPrivateKey";
 
            // You need to specify the name and style of Layer you want to consume
            tiledWmsLayer.ActiveLayerNames.Add("WorldMapKitLayer");
            tiledWmsLayer.ActiveStyleNames.Add("WorldMapKitDefaultStyle");
 
            LayerOverlay staticOverlay = new LayerOverlay();
            staticOverlay.Layers.Add("WorldMapKitServer", tiledWmsLayer);
            map1.Overlays.Add(staticOverlay);
        }
    }

Accessing the Map Suite World Map Kit Online from a Website or Web Application

A web-based application made with Map Suite Web Edition can also be used to access the World Map Kit Online. Let's have a look at the code below to see how it works.

Example 1: Access the World Map Kit Online with a Free Account

This example shows how to access the World Map Kit Online with Map Suite Web Edition using a free unauthenticated connection.

public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"));
 
                Map1.CurrentExtent = new RectangleShape(-125, 72, 50, -46);
 
                Map1.MapUnit = GeographyUnit.DecimalDegree;
 
                WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay();
 
                Map1.CustomOverlays.Add(worldMapKitOverlay);
            }
        }
    }

Example 2: Access the World Map Kit Online with a Premium Account

This example shows how to access the World Map Kit Online with Map Suite Web Edition, using a premium paid account. This requires that you pass in a client ID and a private key as shown.

public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            map1.MapUnit = GeographyUnit.DecimalDegree;
            map1.CurrentExtent = new RectangleShape(-126, 57, -70, 18);
 
            // You can access to the World Map Kit Server for free, but with watermark on every tile image
            TiledWmsLayer tiledWmsLayer = new TiledWmsLayer(new Uri("http://worldmapkit1.thinkgeo.com/CachedWmsServer/WmsServer.axd"));
 
            // Also you can access to the World Map Kit Server with billable account,
            // otherwise you will get watermark on every tile image
            tiledWmsLayer.ClientId = "YourClientId";
            tiledWmsLayer.PrivateKey = "YOurPrivateKey";
 
            // You need to specify the name and style of Layer you want to consume
            tiledWmsLayer.ActiveLayerNames.Add("WorldMapKitLayer");
            tiledWmsLayer.ActiveStyleNames.Add("WorldMapKitDefaultStyle");
 
            LayerOverlay staticOverlay = new LayerOverlay();
            staticOverlay.Layers.Add("WorldMapKitServer", tiledWmsLayer);
            map1.Overlays.Add(staticOverlay);
        }
    }

Accessing Map Suite World Map Kit Online from a Silverlight Application

Now let's have look at how to access World Map Kit Online from a Silverlight application, such as one you could build with Map Suite Silverlight Edition. Here is the sample code that makes it work.

Example 1: Access the World Map Server with a Free Account

This example shows how to access World Map Kit Online with Map Suite Silverlight Edition using a free unauthenticated connection.

public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
        }
 
        private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
        {
            Map1.MapUnit = GeographyUnit.DecimalDegree;
 
            WorldMapKitWmsSilverlightOverlay worldMapKitWmsSilverlightOverlay = new WorldMapKitWmsSilverlightOverlay();
 
            Map1.Overlays.Add(worldMapKitWmsSilverlightOverlay);
 
            Map1.CurrentExtent = new RectangleShape(-135.7, 83.6, 113.5, -53);
 
        }
    }

Example 2: Access the World Map Server with a Premium Account

This example shows how to access World Map Kit Online with Map Suite Silverlight Edition, using a premium paid account. This requires that you pass in a client ID and a private key as shown.

Client Side:

    private void UserControl_Loaded(object sender, RoutedEventArgs e)
    {
        Map1.MapUnit = GeographyUnit.DecimalDegree;
        Map1.CurrentExtent = new RectangleShape(-135.7, 83.6, 113.5, -53);
 
        ServerLayerOverlay serverLayerOverlay = new ServerLayerOverlay("NativeServer", "SilverlightMapConnector1");
        Map1.Overlays.Add(serverLayerOverlay);
 
        Map1.Refresh();
    }

Server Side:

public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                TiledWmsLayer tiledWmsLayer = new TiledWmsLayer(new Uri("http://worldmapkit1.thinkgeo.com/CachedWmsServer/WmsServer.axd"));
 
                // Also you can access to the World Map Kit Server with billable account,
                // otherwise you will get watermark on every tile image
                tiledWmsLayer.ClientId = "YourClientId";
                tiledWmsLayer.PrivateKey = "YOurPrivateKey";
 
                // You need to specify the name and style of Layer you want to consume
                tiledWmsLayer.ActiveLayerNames.Add("WorldMapKitLayer");
                tiledWmsLayer.ActiveStyleNames.Add("WorldMapKitDefaultStyle");
 
                ServerLayerOverlay layerOverlay = new ServerLayerOverlay("NativeServer");
                layerOverlay.Layers.Add(tiledWmsLayer);
 
                SilverlightMapConnector1.ServerLayerOverlays.Add(layerOverlay);
            }
        }
  }

Conclusion

You have now learned the basics about how to consume maps from the World Map Kit Online. If you have further questions about using the World Map Kit Online, please visit the Map Suite World Map Kit support forum.

Summary

You now know the basics of using Map Suite World Map Kit Online and are able to get started adding functionality to your own applications. Let's recap what we have learned about the object relationships and how the pieces of the World Map Kit Online work together:

  • There is a WorldMapKitWms overlay that inherits from TileOverlay for each application type.
  • If you have purchased a license to use the World Map Kit Online without watermarks, you need to enter your client ID and private key when connecting.
map_suite_world_map_kit_online_quick_start_guide.txt · Last modified: 2017/03/17 05:09 by tgwikiupdate