Translate

Saturday, June 2, 2012

Creating an ArcGIS web application (.Net tech)

For Whom: Who have little knowledge of ArcGIS and familiar with C# and ASP.net technologies.

I will elaborate the topics in following flow:

Software Needed & Installation Requirements.
Configurations.
Prerequisites.
ArcGIS template based application.
Raw customized .Net application.
Other technology options & tools available in market.


Well, lots of topics lets start eating with the not so hot but the tasty part of the pasta i.e. "Software Needed".

Software Needed & Installation Requirements:
Version depends on your choice. I am using ArcGIS 9.3 here:
ArcGIS 9.2 supports programming in MS Visual Studio 2005.
ArcGIS 9.3 supports programming in MS Visual Studio 2008.
ArcGIS 10 supports programming in MS Visual Studio 2010.

So you need:

  • ArcGIS Server 9.x or above.
  • ArcGIS Server Web ADF Runtime for the .NET Framework (no separate downloads. It comes with ArcGIS server licensed version only).
  • Microsoft .Net framework 2.0 or above.
  • Microsoft Windows Server 2000/2003/2008/2010 or above.
  • Microsoft Windows XP Professional (SP1 or above) or later.
  • Browsers e.g. Chrome, IE, Firefox etc.
  • Microsoft IIS 5.0 and above
  • Microsoft Visual Studio 2005/ 2008/ 2010 or above. (I had used 2008).
  • AJAX Control Toolkit.
Note: All ArcGIS installations need uninstallations of any previous versions ArcGIS softwares. The installation takes 1500 MB disk space and 176 MB of system drive space. I had taken the installation of ArcGIS Server (not WebADF) on a different machine having MS Windows Server 2000 installed. Rest installations are on my machine (MS Windows XP SP3).

For more information about requirements refer to link:

Configurations:
I had left the server configuration for the sake of focus to web application development only. But broadly, you need to have SOC (Server Object Container) and SOM (Server Object Manager) user accounts configured at Server.

After WebADF installation the Visual Studio will show the "Web Mapping Application" a.k.a. WMA template in its "New Website" box.

Also, check out for the toolbar which show you the ArcGIS Web Controls (if not then add it in Visual Studio).

Prerequisites:
If you want to use your own data, you should have a folder consisting of layer data in .mxd format. Take a note that this folder will be on the server machine and it need to be a shared folder. If you have data in other formats like .tab etc. Use ArcMap or other tools for making an ArcGIS project and then having conversion of data to .mxd format with you. For e.g. have a look at the image below which shows you sample data consisting of .mxd project files.

Data Layers for Map

You need to make a map service by using this data through the ArcGIS Server Manager.

ArcGIS template based application:
Start MS Visual Studio. Go to File >New Website and select the "Web Mapping Application" template.


It may show you ready to run customized template with common tools and toolbars configured for you. It may show a dialog box like:


Click "NO" on this dialog box as we would be running the application on .Net framework 2.0 only here. However if you need to switch to higher versions of framework act accordingly. The solution explorer will look like:


Right click on "Default.aspx" and set it as start page. The design view of "Default.aspx" would be like as below:

Default.aspx design view.
It displays control like TOC (Table of Contents which actually display open layers and checkbox to switch them on/off), Map window which will display the map configured, basic function toolbar for the purpose of zoom in/out, pan, scale, overview map, info etc. I think they pretty much solve the requirements of most of the web gis applications.

Also, the most important control (manager) is there viz. MapResource Manager. Without configuring it, you may end up in errors like "The Map Resource Manager does not have a valid Resource Item". Obviously, we need to define what map we wanna show in the window.

So as to configure the "Map Resource Manager", hover on it you may look the smart menu arrow. Click on "Edit Resources" from the menu shown as below:


Click on "Add" button. Configure the "Definition" field by clicking on the ellipsis in that field. You may end up in a dialog box like:


So, now you have a choice menu for selecting the map service type. If you have your own service running on server (service creation in my different post kindly refer to it) then select "ArcGIS Server Internet" from the drop-down menu and in the "Data Source" field enter the url for the service. In case you wanna use sample server provided by ArcGIS then also select "ArcGIS Server Internet" and in the "Data Source" field enter this url: 

"http://services.arcgisonline.com/arcgis/services".

Now on clicking the ellipsis button of "Resource", it may show you a dialog box of the services provided by the server as below:


Select the service you want and click on "OK" to close the dialog box.

Click further "OK"s to close the "Map Resource Definition Editor" dialog box and the "Map Resource Collection Editor" dialog box respectively.

Run the application and yeeeaaahhhhh you had got your web GIS app ready.


Browse through the tools and customization to make your required formats.

Yes there is one more way of making the customized application and generating the code automatically. It is through the server portal itself. Collect all the files generated and start coding on it.

Raw customized .Net application:
Starting with selecting the File >New Website. But now choosing a normal "ASP.Net website" or "Empty Website" as the case may be. 

From the "ArcGIS Web Controls" in the toolbox, add the "Map" and "Map Resource Manager" controls to your aspx page as shown below:

In the properties of "Map" control look for "Map Resource Manager" property and set it to the manager(which you had already added) selecting it from the drop-down.



Now, checking for the "Map Resource Manager" control, we do the same configuration setting as discussed above. Set the Type, Data Source and Resource for the control.

Run the application and hurray the map application is ready. Well, I know this is just the map implementation without any toolbar and any other formatting or tools. But I suppose you may go with that in a more detailed chapter possible in some other post of mine or on adding controls discussed on ArcGIS portals.

Other technology options & tools available in market:
ArcGIS provides other technology options too for the development purposes. It through Java and Flex. You may develop applications using Web ADF for Java too. Also, it provides you API's for JavaScript, Flex and Silverlight.

Use following link to reach there:

Download and take help of various sample websites for their implementations.

Other tools available in market for GIS development; truly said are many including:
  • SuperGeo
  • MapInfo
  • Microstation etc.
But my referral and priority goes to ArcGIS for its superb support, customized interface, usability and dependable architecture.

Wait for more post of mine on ArcGIS development (like creating Map Service etc.) soon.

Till then Enjoy development!!

1 comment:

  1. Thanks for the post.How to add the 'HTML Popup' like 'ArcMap HTML Popup' in the WEB ADF toolbar control?

    ReplyDelete

Your Views