User Tools

Site Tools


map_suite_wms_server_edition_quick_start_guide

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
map_suite_wms_server_edition_quick_start_guide [2015/09/10 02:36]
admin [Implementing a Sample Plugin]
map_suite_wms_server_edition_quick_start_guide [2017/03/17 05:11] (current)
tgwikiupdate
Line 1: Line 1:
 ====== Map Suite WMS Server Edition Quick Start Guide ====== ====== Map Suite WMS Server Edition Quick Start Guide ======
 +
 +{{section>​upgrade_map_suite_to_10.0}}
  
 <div msgbox> <div msgbox>
Line 13: Line 15:
  
 ===== Download the Sample ===== ===== Download the Sample =====
-<faicon fa fa-download>​ {{:File:HelloWorld WMSServer.zip|Download Sample Code From This Exercise}} //(1.75 MB)//+<faicon fa fa-download ​ fa-lg {{filehistory:HelloWorld WMSServer.zip|Download Sample Code From This Exercise}} //(1.75 MB)//
  
 ===== Setting Up Your Environment ===== ===== Setting Up Your Environment =====
Line 26: Line 28:
 The Class Library is created in a new solution called "​HelloWmsPlugin",​ which includes a default file named "​Class1.cs"​. Let's change its name, as well as the class name, from "​Class1"​ to "​Countries02Plugin"​. The Class Library is created in a new solution called "​HelloWmsPlugin",​ which includes a default file named "​Class1.cs"​. Let's change its name, as well as the class name, from "​Class1"​ to "​Countries02Plugin"​.
  
-Right-click the "​HelloWmsPlugin"​ project in Solution Explorer and select "Add Reference..."​ Next, navigate to the <kbd>C:\Program Files (x86)\ThinkGeo\Map Suite 9.0\Map Suite WMS Server\Current Version\Managed Assemblies</kbd> ​directory and add "​WmsServerEdition.dll",​ "​MapSuiteCore.dll",​ "​GeoAPI.dll"​ and "​MapSuiteCore.dll"​ to the project references. The references should then look like the image below.+Right-click the "​HelloWmsPlugin"​ project in Solution Explorer and select "Add Reference..."​ Next, navigate to the //C:\Program Files (x86)\ThinkGeo\Map Suite 9.0\Map Suite WMS Server\Current Version\Managed Assemblies/directory and add "​WmsServerEdition.dll",​ "​MapSuiteCore.dll",​ "​GeoAPI.dll"​ and "​MapSuiteCore.dll"​ to the project references. The references should then look like the image below.
  
 {{wmsserveredition:​QSG_WMSServerEdition_Img03.png}} {{wmsserveredition:​QSG_WMSServerEdition_Img03.png}}
Line 63: Line 65:
 {{wmsserveredition:​QSG_WMSServerEdition_Img05.png}} {{wmsserveredition:​QSG_WMSServerEdition_Img05.png}}
  
-The next step is to implement all of the abstract methods. The majority of our sample code is placed in the <​code>​GetMapConfigurationCore</​code> ​method. In this sample, we will add two layers: BackgroundLayer and WorldLayer. The following code shows how we accomplish this.+The next step is to implement all of the abstract methods. The majority of our sample code is placed in the ''​GetMapConfigurationCore''​method. In this sample, we will add two layers: BackgroundLayer and WorldLayer. The following code shows how we accomplish this.
  
 <code csharp> <code csharp>
Line 80: Line 82:
         protected override MapConfiguration GetMapConfigurationCore(string style, string crs)         protected override MapConfiguration GetMapConfigurationCore(string style, string crs)
         {         {
-            ​<​nowiki>​//</​nowiki> ​NOTE: Please make sure you are using the absolute file path name, also you can use the relative file path name,  +            // NOTE: Please make sure you are using the absolute file path name, also you can use the relative file path name,  
-            ​<​nowiki>/​/</nowiki> ​but please remeber the path is relative to the built .dll of the plugin ​+            // but please remeber the path is relative to the built .dll of the plugin ​
             string worldLayerFilePath = @"​C:​\**\Web\HelloWmsPlugin\HelloWmsPlugin\AppData\Countries02.shp";​             string worldLayerFilePath = @"​C:​\**\Web\HelloWmsPlugin\HelloWmsPlugin\AppData\Countries02.shp";​
  
Line 112: Line 114:
  
 ===== Managing Your Plugins ===== ===== Managing Your Plugins =====
-Add the existing WmsPluginService Project where you can download it from {{Filelink}}[[:​File:​WorldMapWmsService.zip|worldmapwms service]] to the "​HelloWmsPlugin"​ solution we just created, as illustrated by the screenshot below. ​+Add the existing WmsPluginService Project where you can download it from <faicon fa fa-download> ​{{filehistory:​WorldMapWmsService.zip|worldmapwms service}} to the "​HelloWmsPlugin"​ solution we just created, as illustrated by the screenshot below. ​
  
-**Important Notes: You may need to delete the files within the <​code>​WmsLayerPlugins</​code> ​folder to remove any existing plugins. Also, if you are using Windows 7 or Windows Server 2008, you may need to copy the WmsPluginService Project to another folder where you have permission to write; otherwise you may not be able to compile the project properly.**+**Important Notes: You may need to delete the files within the ''​WmsLayerPlugins'' ​folder to remove any existing plugins. Also, if you are using Windows 7 or Windows Server 2008, you may need to copy the WmsPluginService Project to another folder where you have permission to write; otherwise you may not be able to compile the project properly.**
  
-{{Figure|QSG_WMSServerEdition_Img06.png}}+{{wmsserveredition:​QSG_WMSServerEdition_Img06.png}}
  
 Set the "​WmsPluginService"​ project as the startup project and set "​Default.aspx"​ as the startup page, press F5 to run your application and you'll see the WMS Server Admin page pictured below: Set the "​WmsPluginService"​ project as the startup project and set "​Default.aspx"​ as the startup page, press F5 to run your application and you'll see the WMS Server Admin page pictured below:
  
-{{Figure|QSG_WMSServerEdition_Img07.png}}+{{wmsserveredition:​QSG_WMSServerEdition_Img07.png}}
  
-Copy "​HelloWmsPlugin.dll"​ to the //​WmsPluginService\WmsLayerPlugins//​ folder (which is specified by <​code>​appSetting</​code> ​in "​Web.config";​ feel free to change it if you prefer) and then the default page should look like the screenshot below: ​+Copy "​HelloWmsPlugin.dll"​ to the //​WmsPluginService\WmsLayerPlugins//​ folder (which is specified by ''​appSetting'' ​in "​Web.config";​ feel free to change it if you prefer) and then the default page should look like the screenshot below: ​
  
-{{wiki:​QSG_WMSServerEdition_Img08.png?​800}}+{{wmsserveredition:​QSG_WMSServerEdition_Img08.png?​800}}
  
 As you can see, your WmsPlugin has been loaded and is displaying on the management page. You can click the "​Preview"​ link to open a new window and see the result as follows: As you can see, your WmsPlugin has been loaded and is displaying on the management page. You can click the "​Preview"​ link to open a new window and see the result as follows:
  
-{{Figure|QSG_WMSServerEdition_Img09.png}}+{{wmsserveredition:​QSG_WMSServerEdition_Img09.png}}
  
 ===== Viewing the WMS Server'​s Capabilities ===== ===== Viewing the WMS Server'​s Capabilities =====
 On the top of the WMS Server default page, you'll see a link called "View Capabilites."​ Click this link to view the current WMS Server Capabilities,​ which include the general information about the service itself and specific information about its available layers. On the top of the WMS Server default page, you'll see a link called "View Capabilites."​ Click this link to view the current WMS Server Capabilities,​ which include the general information about the service itself and specific information about its available layers.
  
-{{wiki:​QSG_WMSServerEdition_Img10.png?​800}}+{{wmsserveredition:​QSG_WMSServerEdition_Img10.png?​800}}
  
 The WMS Server capabilities are displayed in XML format in your browser, similar to the screenshot below: The WMS Server capabilities are displayed in XML format in your browser, similar to the screenshot below:
  
-{{wiki:​QSG_WMSServerEdition_Img11.png?​800}}+{{wmsserveredition:​QSG_WMSServerEdition_Img11.png?​800}}
  
 ===== Adding Another Plugin ===== ===== Adding Another Plugin =====
Line 144: Line 146:
 First, add a new class to the "​HelloWmsPlugin"​ project and call it "​WorldMapKitPlugin"​. It will use the WorldMapKit Layer and supports two projections – EPSG: 4326 and EPSG: 900913. The implementation will be like this: First, add a new class to the "​HelloWmsPlugin"​ project and call it "​WorldMapKitPlugin"​. It will use the WorldMapKit Layer and supports two projections – EPSG: 4326 and EPSG: 900913. The implementation will be like this:
  
-<source lang="csharp">+<code csharp>
 using System; using System;
 using System.Collections.ObjectModel;​ using System.Collections.ObjectModel;​
Line 211: Line 213:
     }     }
 } }
-</source>+</code>
  
 After adding this class, rebuild the project and upload the new "​HelloWmsPlugin.dll"​ to the //​WmsLayerPlugins//​ folder mentioned in the previous section. Then, refresh the WMS Server management page and you will see two plugin items on the list. Mouse over each item's "​Preview"​ link and you will see a small preview image on the left that gives you a general idea of what the plugin will look like. After adding this class, rebuild the project and upload the new "​HelloWmsPlugin.dll"​ to the //​WmsLayerPlugins//​ folder mentioned in the previous section. Then, refresh the WMS Server management page and you will see two plugin items on the list. Mouse over each item's "​Preview"​ link and you will see a small preview image on the left that gives you a general idea of what the plugin will look like.
  
-{{Figure|QSG_WMSServerEdition_Img12.png}}+{{wmsserveredition:​QSG_WMSServerEdition_Img12.png}}
  
 ===== Consuming the WMS on a Client App ===== ===== Consuming the WMS on a Client App =====
Line 222: Line 224:
 **Example 1:** Using the default projection "EPSG: 4326" with "​DEFAULT"​ style in Map Suite Web Edition. **Example 1:** Using the default projection "EPSG: 4326" with "​DEFAULT"​ style in Map Suite Web Edition.
  
-<source lang="csharp">+<code csharp>
 using System; using System;
 using System.Web.UI;​ using System.Web.UI;​
Line 244: Line 246:
                 wmsOverlay.Parameters.Add("​STYLES",​ "​DEFAULT"​);​                 wmsOverlay.Parameters.Add("​STYLES",​ "​DEFAULT"​);​
  
-                ​<​nowiki>​//</​nowiki>​Here you add your WMS Server uri+                //Here you add your WMS Server uri
                 wmsOverlay.ServerUris.Add(new Uri("​http://​localhost:​62626/​WmsHandler.axd"​));​                 wmsOverlay.ServerUris.Add(new Uri("​http://​localhost:​62626/​WmsHandler.axd"​));​
                 Map1.CustomOverlays.Add(wmsOverlay);​                 Map1.CustomOverlays.Add(wmsOverlay);​
Line 251: Line 253:
     }     }
 } }
-</source>+</code>
  
  
 **Example 2:** Using the projection "EPSG: 900913"​ with "​DEFAULT"​ style in Map Suite Web Edition. **Example 2:** Using the projection "EPSG: 900913"​ with "​DEFAULT"​ style in Map Suite Web Edition.
  
-<source lang="csharp">+<code csharp>
 using System; using System;
 using System.Web.UI;​ using System.Web.UI;​
Line 279: Line 281:
                 wmsOverlay.Parameters.Add("​SRS",​ "​EPSG:​900913"​);​                 wmsOverlay.Parameters.Add("​SRS",​ "​EPSG:​900913"​);​
  
-                ​<​nowiki>​//</​nowiki>​Here you add your WMS Server uri+                //Here you add your WMS Server uri
                 wmsOverlay.ServerUris.Add(new Uri("​http://​localhost:​62626/​WmsHandler.axd"​));​                 wmsOverlay.ServerUris.Add(new Uri("​http://​localhost:​62626/​WmsHandler.axd"​));​
                 Map1.CustomOverlays.Add(wmsOverlay);​                 Map1.CustomOverlays.Add(wmsOverlay);​
Line 286: Line 288:
     }     }
 } }
-</source>+</code>
  
  
 **Example 3:** Using the projection "EPSG: 4326" with "​DEFAULT"​ style in Map Suite Desktop Edition. **Example 3:** Using the projection "EPSG: 4326" with "​DEFAULT"​ style in Map Suite Desktop Edition.
  
-<source lang="csharp">+<code csharp>
 using System; using System;
 using System.Windows.Forms;​ using System.Windows.Forms;​
Line 324: Line 326:
     }     }
 } }
-</source>+</code>
  
 ===== Summary ===== ===== Summary =====
 You have now explored the basics of using Map Suite WMS Server Edition and are able to start adding this functionality into your own applications. Let's recap what we have learned about the object relationships and how the pieces of Map Suite work together: You have now explored the basics of using Map Suite WMS Server Edition and are able to start adding this functionality into your own applications. Let's recap what we have learned about the object relationships and how the pieces of Map Suite work together:
  
-#A WMS plugin assembly contains one or more public classes, and each of them should inherit from the WmsLayerPlugin abstract class. A WMS plugin assembly should have a name that ends with "​plugin"​. +  - A WMS plugin assembly contains one or more public classes, and each of them should inherit from the WmsLayerPlugin abstract class. A WMS plugin assembly should have a name that ends with "​plugin"​. 
-#You must implement the <​code>​GetMapConfigurationCore</​code> ​method, which is used to define your own layers. +  ​- ​You must implement the ''​GetMapConfigurationCore'' ​method, which is used to define your own layers. 
-#You must implement the <​code>​GetBoundingBoxCore</​code> ​method, which returns the boundingBox of all the layers you defined. +  ​- ​You must implement the ''​GetBoundingBoxCore'' ​method, which returns the boundingBox of all the layers you defined. 
-#You need to implement the <​code>​GetNameCore</​code> ​method to specify the name of a WMS layer. +  ​- ​You need to implement the ''​GetNameCore'' ​method to specify the name of a WMS layer. 
-#You need to implement the <​code>​GetProjectionsCore</​code> ​method, which is used to add the projection string code (such as "EPSG: 4326") that you want to support. +  ​- ​You need to implement the ''​GetProjectionsCore'' ​method, which is used to add the projection string code (such as "EPSG: 4326") that you want to support. 
-#Each public class inherited from the WmsLayerPlugin abstract class represents one Layer element in the WMS specification. +  ​- ​Each public class inherited from the WmsLayerPlugin abstract class represents one Layer element in the WMS specification. 
-#All custom WmsPlugin DLLs need to be copied to a specified directory, which can be changed in the "​Web.config"​ file. +  ​- ​All custom WmsPlugin DLLs need to be copied to a specified directory, which can be changed in the "​Web.config"​ file.
- +
-<​br>​ +
-{{Filelink}}[[:​File:​HelloWorld WMSServer.zip|Download Sample Code From This Exercise]] //(1.75 MB)//+
  
-[[Category:Map Suite WMS Server Edition]] [[Category:​Web GIS]] [[Category:​ASP.NET]] [[Category:​GIS]] [[Category:.NET]]+<faicon fa fa-download ​ fa-lg> ​ {{filehistory:HelloWorld WMSServer.zip|Download Sample Code From This Exercise}} //(1.75 MB)//
  
map_suite_wms_server_edition_quick_start_guide.1441852561.txt.gz · Last modified: 2015/09/10 02:36 by admin