August 1, 2008

FLEX api for ArcGIS Server released

I was browsing the ESRI resource center this morning, and I saw an unfamiliar link. I was excited to see that the beta release of the Flex api for ArcGIS Server has been released. Us Adobe fanboys are going to have a good time with this...From ESRI:

"Develop rich internet applications with ArcGIS services using the Flex framework. The API enables creating applications with intuitive, visually rich and responsive user interface. The ArcGIS API for Flex takes full advantage of the powerful mapping, geocoding, and geoprocessing capabilities of ArcGIS services."

Check it out here

July 17, 2008

Simple ArcGIS Server Layer list - Pure Javascript Example

Thanks to Jeremy Bartley from the the Arcgis Server Team (and MapDex.org fame)for sending this pure javascript version of the ArcGIS Server layer list sample I did in my previous post.

Check it out here:

http://maps.roktech.net/demo/layerlist_js.html

July 15, 2008

Creating a Simple Layer List With The ArcGIS Server Javascript / REST api

I thought it was time to put my money where my mouth has been these past couple of months. I have been yapping about how easy the new ArcGIS javascript api is to work with, so I thought I'd share a very simple example. This example will show how to create a simple layer list for a DYNAMIC map service and give you the ability to turn layers on and off. Maybe I'll follow this post up with one for a tiled service.

In my example, I use Coldfusion, but you could easily adapt this to your langauge of choice. Actually, you could do this with pure javascript, but using something like Coldfusion just makes sense to me - as you will see from this example. Also, lets be clear - I am terrible with javascript - and I'll be the first to admit that. However, there are thousands and thousands of examples out there to help you along.

I'll show you the important parts here, but essentially its broken down into 3 parts. 1. Make a simple REST call to get a list of all the layers in the map service 2. Loop over the results to display the Layer name and a simple check box (with a onclick event) 3. Create the javascript that turns on and off the layers and then refreshes the map

The simple REST call:

<!--- Create the cfc object and make a simple REST call. You can use any language that you
   are comfortable with. Coldfusion I find to be the most straightforward. --->

   <cfset esri = createObject("component","esri")>      
   <cfset LayerInfo = esri.ServiceInfo('http://snake/ArcGIS/rest/services/pickenscounty/MapServer?f=json')>


<!--- Create the initial list of layers that should be turned on --->
    <cfset LayerVisible = ''>
    <cfloop query="LayerInfo">
      <cfif DEFAULTVISIBILITY eq 'YES'>
         <cfset LayerVisible = listAppend(LayerVisible,#ID#)>
      </cfif>
   </cfloop>

Now display the results of the REST call:

<cfoutput query="LayerInfo">
<input type="checkbox" id="#id#" onclick="toggleDynamicVisibility(#id#);"<cfif DEFAULTVISIBILITY eq 'YES'>checked</cfif>>#Name#<br>
</cfoutput>

Lastly, add some javascript functions that will keep track of the layers to turn on and off and then refresh the map:

<script>
//I am using a coldfusion variable to populate this array. again, any language can be used here.    var dynamiclayerlist = new Array(#LayerVisible#);
   function removeItems(array, item) {
   var i = 0;
   while (i < array.length) {
   if (array[i] == item) {
   array.splice(i, 1);
   } else {
   i++;
   }
   }
   return array;
   }
   
   function addItems(array, item) {
   array.push(item);
   }
   function toggleDynamicVisibility(layerid) {
   if    (dynamiclayerlist.indexOf(layerid) != -1){
      removeItems(dynamiclayerlist,layerid);
   }else{
      addItems(dynamiclayerlist,layerid);
      }
   dynamiclayer.setVisibleLayers([dynamiclayerlist]);
   }
   </script>

Note that when I make the REST call, I am using a Coldfusion component (CFC). I have included that cfc in the code download (see below for the link or get it here). So, hopefully when you see the finished code you see just how easy it really is.

This simple demo is available to actually try and view here: http://maps.roktech.net/demo/layerlist.cfm. Hopefully I can get some kind of regular series of simple ArcGIS Server javascript and REST api demos going...

July 8, 2008

The unexpected surprise...

I hadn't counted on this.

For you ArcIMS veterans, you know that it can be very, er, temperamental at times. If you are responsible for a high volume site, you dont just know it, you live it. You've written scripts to start and stop it. You've written scripts to ping your mapserver. You can refresh your services via the cmd line. You have full logging on more than you'd like too. Heck we have a utility that we wrote to send us a text message if a service comes back as unresponsive.

I really wasnt looking forward to the management of a production ArcGIS server. We have been using it since its inception at version 9, and have always found it to be temperamental as well. However, with the advent of the REST api (plus its Javascript wrapper), and the extensive use of tile caching, we have found an most unexpected benefit. ArcGIS Server, when utilizing REST & JS, is very easy to manage. No more corrupted sez files. No more runaway aimserver.exe's. Strange. I'm not used to it yet.

Of course, there are some obvious reasons for this - which I would say is mainly due to heavy use of caches and client side code. Granted, these apps are simple in comparison (lets say vs a heavy duty ArcIMS site). My hope is that as these new API's continue to evolve and our apps increase in complexity, that the management of the server remains to be straightforward as it is now.

June 24, 2008

Installing the WMS Connector with Coldfusion, Jrun, and Tomcat

Recently I was asked to install the ArcIMS WMS connector on a server that was running ColdFusion (JRun) as the Servlet Connector. I searched for ways to configure the two to work together but I had no luck. My next thought was to see if Tomcat 5.5 and JRun could run on the same server, it turns out they can. Below are the steps to set this up.

Step 1:
If you already have ArcIMS installed, uninstall it.

Step 2:
Follow the instructions located here. An important piece of the instructions from that link that is misleading comes in to play when you are installing Tomcat. It says you can install it to C:\Program Files\Apache Software Foundation\Tomcat 5.5 or C:\Tomcat5.5. I highly recommend installing to C:\Tomcat5.5, I was unable to get the redirect working with it installed to C:\Program Files\Apache Software Foundation\Tomcat 5.5. When installing ArcIMS: at the Web Server-Servlet Engine Configuration dialog box, select 'IIS with Tomcat 5.5'. You will still need to follow the instructions for configuring CF and ArcIMS, found here. This is so CF and ArcIMS can still communicate.

Step 3:
Now we need to test to see if the WMS connector is configured correctly. http:///wmsconnector/com.esri.wms.Esrimap?cmd=connectorping The display will say Enabled=False at this point. Now go to the following link: http:///wmsconnector/index.htm Select the Connector Properties link at the top and fill in the form. Change Enabled to from False to True. Click submit.Check to see if the Map Services have wms capabilities. If you refresh a map service you must choose Update Services in order for the changes to take place.


ArcGIS Server 9.3 WebADF

Today, I installed the Release Candidate of ArcGIS Server 9.3 WebADF for Visual Studio. Unfortunately, I had to completely remove any references to 9.2 from my machine before starting the install.

To start off, I created a standard out of the box application via Visual Studio. The first change I noticed was in the MapResourceManager. There is a new section called LayerDefintions.

The LayerDefinitions section is a very helpful addition. It lets you choose symbology for search and identify results. In addition, it lets you fully customize the attribute table that is returned with the results. By the way, the attribute results are now displayed like map tips for points, lines, and polygons.

Next I wanted to take a look at performance. From a quick test, the application seemed to load faster than 9.2. The page_load event is called on 4 times in the initial startup, which is better than the 6 to 8 times I have seen in 9.2 As the map is loading, a progress bar has been added to map which is much better than waiting on a blank white map.

Here are a few very noticeable changes in the Web Mapping Application: - Task Items are displayed across the top of the map where the standard toolbar used to be. (Visually, I like the change. However, I can see this becoming a problem if you have a lot of tasks or tasks with long names)

- The standard toolbar is now positioned on the right side above the map.

- The ZoomLevel control is now visible even with non-cached maps and is displayed above the map with the Navigation control.

- The overview map has been added to the standard toolbar and can be turned on and off.

- There are zoom to previous and zoom forward extent buttons on the standard toolbar

I am very eager to see how much effort will go into migrating my customized 9.2 applications to 9.3.

Trent Tinker

GIS Application Developer

ROK Technologies