This gave me a laugh

Saw this on a google search, it made me laugh, so I thought I would share. Names have been blurred to protect the stupid.

Using ESRI's ArcGIS Server To Help Get Relief Flights Into Haiti

One of our long time clients, FltPlan.com is in the business of helping private and corporate pilots file flight plans with the FAA.

Filing flight plans, along with navigating customs can be a daunting task. Fltplan.com has really simplified this process by storing aircraft and pilot profiles. Access to this data makes these filing procedures a snap. We have worked with them over the years to help enhance their service with GIS. First with ArcIMS, and for the past 3 years, ArcGIS Server.

When the Haitian earthquake occurred and humanitarian efforts began, FltPlan asked themselves, how could they help? With the largest online community of corporate and private pilots on the internet it was a natural step to offer a clearing house to share information about flying in and out of Haiti to assist with the relief efforts. Fltplan.com has a huge database of airports, waypoints and other flight related data. However, to date, none of this Haitian flight related data, had been available on a internet based map. That's where we (ROK) came in.

We took the data and did our GIS thing that we do so well, and the result is a Javascript API based, ArcGIS Server application dedicated to displaying information about flying in and out of Haiti and the Dominican Republic. If you are interested, check out what a pilot would see when planning a flight from Ft. Lauderdale to Port-au-Prince Haiti with this ArcGIS Server site

Now, the legions of private and corporate pilots can better assist these ongoing relief efforts and get their full planes of supplies and doctor on the ground where they are needed.

ArcGIS Server Security::Token Based Authentication w/ JavaScript API

Securing services for ArcGIS Server is not as difficult as one would think. The ArcGIS Server Manager works as a great tool to lock down services, create and manage a security database, and grant permissions for specific services and or folders.


Check back later for screen grabs.

Step 1: Before you lock down your server, you will need to create a database to manage the security.
Log in into the ArcGIS Server Manager and click on the "Security" tab. Then click on "Settings".

The settings window will have a wizard that allows you to connect to a database server. The wizard will then create a new database with the needed tables to store permissions.  As you are going through the wizard, be sure that you check the box that automatically creates a user and role for "Everyone." We will use this later.

Step 2: Create roles and users

Permissions for the services are managed via roles. After you successfully create a role, you can create a new user or add existing users to that role.  Creating users and roles can be done easily via the ArcGIS Server Manager wizard.


Step 3: Lock down your server

Now that you have a database set up, you are ready to lock down your services.
Go back to the "Setting" section of the "Security" tab.
You will see a section that says: "Security for GIS Services is:   Not Enabled". Beside this text is a button that says "Enable"

Note: Once you Enable security, you cannot undo this via the ArcGIS Server manager.  Don't get frightened away yet, you will see in the next step that this is not a big deal.

Step 4: Grant permission for "Everyone" at the root level

Now that your site is locked down, you need to grant permissions to your services.

 The next few steps are going to assume you have some public services and some private services. Even though security is turned on, we want to make sure that our public services remain public, not requiring a username / password.

Click on the "Services" tab.  It should automatically load the "Manage Services" section. If you are not already there, change the "Services In" pulldown value to your root directory. Then Click Manage Folders -> Permissions. At the root level, grant "Everyone" permission by adding the role to the Access List.

Now security is turned on, but all of your services are public.  I recommend this set up for any initial installation of ArcGIS Server. This will allow you to quickly add permissions when needed.

Step 5: Lock down a folder in your ArcGIS Server

Now that all of our sites are public, we want to lock down specific services.

If your services are organized into folders, this can be done easily. Let's assume you have a folder called "Private".  Switch the "Services in" value to your private folder. Then, click Manage Folders - > Permissions.  Add the role you created to this folder. Be sure to remove "Everyone" from the Access list.

Now your services in this folder will require the a username and password that is associated to that role.

Step 6: Access the Secure Folder via REST interface.

If you're developing applications with the ArcGIS Server Javascript API, the REST interface should be your best friend. However after you lock down a folder, you will notice the interface for that folder is gone from your root services directory:
http://<servername>/ArcGIS/rest/services

To access the "Private" folder, simply type in the URL for your secure folder:
http://<servername>/ArcGIS/rest/services/Private

This will open up a login screen. You can now access the folder with a username / password.

Step 7: Using a secure service in your ArcGIS Server JavaScript API application

The following setup will work great if you would like to have a public ArcGIS Server Javascript API application with secure services embeded into the application. As a result, users will not be able to grab your service URLs and use them in their own applications.

To keep this blog from getting to long, we are going to assume you already have a proxy page set up in your application.  If you do not, that probably means 2 things. You are not printing your maps, and you are not receiving data back in IE where the queries are longer than 2000 characters. Here is a link to setting up your proxy: http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jshelp/ags_proxy.htm#webprint

Since we're assuming you already have a proxy set up, the first step is going to be an updating your settings for the proxy in your JavaScript.

The sites are now secure, so you will need to use the proxy page for each request. If you have not done so already, change the "alwaysUseProxy" setting to "true" in your application.
esri.config.defaults.io.alwaysUseProxy = true;
Additionally, change your http references to https for your secure servcies.

Step 8: Token Based Authentication

Token based authentication is used for authorization of ArcGIS Server Services via the JavaScript API.  You have two options:  1. Create a token via the Token generation page. 2. Create a token Dynamically

Option 1. Create a token via the Token generation page
After you turn on security for your ArcGIS Server installation, you will have access to a token generation page. http://<servername/ArcGIS/Tokens/ gettoken.html (You can also get to this page from the REST interface.) Type in a valid user name/password and it will return a token value.  

Change the http reference in the proxy.config to https. Copy  and paste the token into the service url references in your proxy.config file.
Sample from ESRI's Help:
<serverUrl url="https://www.example.com/arcgis/rest/services/MyMapSecureService/MapServer" matchAll="false"token="5fFo4%2fI4Tv8IGSqSYbpUNORRD%2fYxXMSPo6NEHNNGMpt9CMknpXIjEVqYGm3uuQnU" ></serverUrl>

You will notice on the token generation page that by default this token is only good for 10 days. You can change this if needed in the ArcGIS Server Manager. Optionally, you can set up your services as done below.

Option 2. Create a token dynamically:
If you wish to create tokens dynamically, you will need to download a new proxy.ashx page.

We posted a question on ESRI's users forums about this setup. Thang Le from ESRI Support, provided us with the new proxy file. You can download it from the user forums here:
http://forums.esri.com/Thread.asp?c=158&f=2396&t=297001#926770

After you download the zip file, replace your existing proxy.ashx page with the new one. Then, you will need to update your server url references in your proxy.config file. Change the http reference to https. Add the following new attributes:
dynamicToken="true"
host=""
userName=""
password=""

D-ATLAS (Diabetes Atlas) - How it works

What is the D-ATLAS?
The D-ATLAS (Diabetes Atlas) maps the prevalence and costs associated with type 2 diabetes.

Press Release:
The D-ATLAS: A Tool Supporting the Fight Against Diabetes

To View the Atlas, register here:
http://www.z-atlas.com/content.php?sec=diabetes

Overview
The Diabetes Atlas was built using a combination of ESRI's ArcGIS Server JavaScript API and Microsoft's .NET Framework. ArcGIS Online data is used to show the street data in the Atlas. The Disease information is displayed using ArcGIS Server MultiLayer Cached Services. Finally, the demographic boundaries are displayed using ArcGIS Server 9.3.1 Optimized Map Services and GraphicsLayers.

Managing the Cache
Although fused caches perform the best, we needed to be able to turn layers on and off. Consequently, we decided to use multilayer services that are cached. Now that 9.3.1 is out, we are looking more towards migrating these services to optimized map services. This would eliminate the struggles to manage large cached datasets. However, we've found that performance at the national level is still slower with optimized map services due to the amount of information (or polygons) that need to be rendered on the server. Using the multilayer services that are cached draws the national maps quickly by grabbing the images directly from the cached folders.

Printing:
Printing on the web is never fun. Consequently, it has by far been the biggest challenge. We have gone through many versions of printing during the lifetime of the Atlases. Now, we are using the print sample found in DS2009: Developing Advanced Applications with the ArcGIS JavaScript API. We modified the code to work with a hidden "whiteout layer" from the main page. A definition query on the "whiteout layer" is updated as users change the regions. Then when map is printed, the whiteout layer's visibility is set to true. The whiteout layer covers the non-selected areas showing only the specific region the user wants to print.

Managing the Atlases:
All the information displayed in the Atlases are managed from a SQL Sever database. The database stores information at the Disease, Disease Year, and Demographic levels. Consequently, we can easily update information in the Atlases (Legend Images, Legend Titles, Active and Inactive Services, methodology, etc) without having to touch the code. For example, if we need to update the cache for a service, we can simply set the service to inactive in the database, and it will not show up in the Atlas while the cache is being built.

Screen Grabs:
D-Atlas:


Print Page:

ArcGIS Server JavaScript API version 1.5 - Bug with Drawing Toolbar deactivation?

After upgrading our ArcGIS Server JavaScript API sites to version 1.5, we have noticed some strange behavior with our Drawing Toolbars.

We use a Drawing Toolbar to allow users to draw a line or polygon to select features on the map. The geometry from the drawing toolbar is used as the geometry in the Query for the QueryTask.

At version 1.5, we noticed the last segment of the line or polygon was not being used in the QueryTask results. Consequently, no features in the last segment of the geometry were selected on the map. All other segments of the geometry were working fine.
User Selection:

Parcel Results:  (Notice the last segment did not return features)


Bug:
We use 3 different drawing toolbars on our site for measuring distances, selecting features, and drawing graphics.

The problem came when we activated 1 drawing toolbar, then deactivated another toolbar after the activation.

//switch to select toolbar
selectToolbar.activate(esri.toolbars.Draw.POLYLINE);drawingToolbar.deactivate();

Soultion:
At version 1.5, you must deactivate any toolbars before you activate one.

//switch to select toolbar
drawingToolbar.deactivate();selectToolbar.activate(esri.toolbars.Draw.POLYLINE);

At previous versions of the ArcGIS Server JavaScript API this was not a problem. I'm not sure if this falls into the category of a bug, but it is certainly something to be aware of when you migrate your applications to Version 1.5.

The ESRI Fourm blog referencing this issue can be seen here. Thanks to xiaoming - Prince William County for finding the work around.

Trent Tinker
Developer - ROK Technologies

Hey You, Dummy, Read The Docs

I just wasted a good 2 hours trying to debug an issue with a AGS Flex application I am doing. I could not, for the life of me, figure out how I was able to deactivate a Draw Toolbar without explicitly calling drawToolbar.deactivate. It was driving me crazy.

So, I decided to revert back to the Flex 1.2 API and sure enough, it was necessary to explicitly call drawToolbar.deactivate to stop drawing. However, I reason I had to revert back was because I think I may have found a bug with the ArcGISTiledMapServiceLayer tileServers. It was just coincidence that I tried 1.2.

Turns out, the big dummy that I am, this is new (and very welcomed) behavior as of 1.3. I should have stopped, and read the docs and could have saved myself some time and frustration.

Sorting a FeatureSet by Attribute - JavaScript API

Here is a simple example that shows you how to sort your FeatureSet in the JavaScript API.

The javascript array sort function is actually a very powerful tool. You can pass a function to the sort method that will run each time the items in your array are compared. Since the features in a featureset are stored as an array, you can write your own sort function to sort all the features by an attribute.

Here is the code:

//note: CONDITION is the attribute we are sorting on.
//you will need to change this the appropriate attribute
//a & b are the two features be compared from your array of features

function sortByAttribute(a, b) {
var x = a.attributes.CONDITION.toLowerCase();
var y = b.attributes.CONDITION.toLowerCase();
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
}

//call this from within your result function
featureSet.features.sort(sortByFirstName);



Trent Tinker
Developer - ROK Technologies

Combining ArcGIS Server Images - Serverside

Printing aint what it used to be. The days of sending that request off to ArcIMS and getting back a print - ready image are long gone. In fact, I can safely say that one of the few things that ArcIMS does much better than ArcGIS Server is printing.

These days, we have multiple services, markup, etc all on different layers being combined (layered), client side to create the illusion of a nice neat merged image. That illusion doesn't translate very well when it comes to printing. There have been a few hackish (in my opinion) attempts working around this by combining these different layers of images serverside. Personally, I it looked like a mess, and it was difficult to configure. I set out a few months back to try and figure out an easy way to combine these images using my serverside language of choice, Coldfusion. I was extremely surprised to find out that I couldn't not do it. I tried about everything in Coldfusion's image processing function library, and I was just stumped. I asked around and I could get anyone that could get this to work either. Until today.

The other day, I got an email from Ann, and she was looking for some advice on using REST calls to ArcGIS server from serverside. Then more specifically, she asked about combining images from a cached service and a dynamic service (or really any two services):

"Is it possible to use arcGIS to produce static images which consist of one base layer (cached) and an overlay? "

I, having tried this already, quickly replied no way. To my surprise, this morning, she sent over the following code (modified slightly for example purposes) that's using the Coldfusion ImagePaste function:



<!--- Create the envelope --->
<cfset MaxX = '-81.202'>
<cfset MaxY = '29.483'>
<cfset MinX = '-81.239'>
<cfset MinY = '29.461'>
<cfoutput>
    
<!--- make a call for the base map image --->
<cfimage name="baseimg" source="http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer/export?bbox=#MinX#,#MinY#,#MaxX#,#MaxY#&size=400,400&imageSR=&format=jpg&transparent=false&dpi=&f=image">

<!--- make a call for the overlay map image --->
<cfimage name="flagler" source="http://arcgis.roktech.net/ArcGIS/rest/services/Flagler/FlaglerDefault/MapServer/export?bbox=#MinX#,#MinY#,#MaxX#,#MaxY#&size=400,400&imageSR=&format=png8&transparent=true&dpi=&f=image">
</cfoutput>

<!--- use the elusive Imagepaste function to combine them --->
<cfset ImagePaste(baseimg,flagler,0,0)>


<!-- Send it out to the browser -->
<cfimage source="#baseimg#" action="writeToBrowser">


I cant believe that I missed something that easy. Here is the example: Image Merge Demo

Thanks Ann!

ArcGIS Beta 9.4

Wow, 2 posts in the same day. This is just a quick heads up to fellow ESRI beta testers. Looks like the first cut is out the door. I'm downloading right now. Good for ESRI for making the betas downloadable. I cant tell you many hundreds of cd's and dvd's I have amassed over the years of beta testing ESRI software...MOIMS, ArcIMS 3 Alpha, ArcInfo, oh my. Just about every one of them went in to the trash anyway. SDE/Oracle 8i for Sun - Release Candidate...ah no thanks.

Article on Map Cache Hosting in ArcUser

Those of you that get ArcUser, make sure to check out the Article 'Tiles On A Cloud'. Its a good rundown of what we have been doing for our clients that need to offload some bandwidth for their cached tile-intensive applications.

I have blogged about this service before, but this article does a good job in putting it in laymans terms.

Coldfusion 9 Launched

Wow...Adobe just keeps wowing me with what they are doing with Coldfusion. Coldfusion 9 was released today. Check it out: Coldfusion 9

What a great time to be a Coldfusion developer...especially with the tight Flex integration...this make my ArcGIS Server development a breeze.

I tend to do most of my searching via Coldfusion cfcs with front ends in Flex. Using serverside cfc's to construct straight REST calls to ArcGIS Server has also proved to be dead simple and powerful.

ArcGIS Sever In The Cloud Gets A Little Closer

I just opened up my inbox to an announcement from Amazon. Looks like they are continuing to push their cloud computing services. Now this one can make all the difference for us GIS nerds. Its called Virtual Private Cloud. Giving it a quick read, it looks like you'll me able to add an Amazon Cloud based server to your existing network, via a standard VPN connection. Here are the details from Amazon:

* Create a Virtual Private Cloud on AWS's scalable infrastructure, and specify its private IP address range from any block you choose.

* Divide your VPC's private IP address range into one or more subnets in a manner convenient for managing applications and services you run in your VPC.

* Bridge together your VPC and your IT infrastructure via an encrypted VPN connection.

* Add AWS resources, such as Amazon EC2 instances, to your VPC.

* Route traffic between your VPC and the Internet over the VPN connection so that it can be examined by your existing security and networking assets before heading to the public Internet.

* Extend your existing security and management policies within your IT infrastructure to your VPC as if they were running within your infrastructure.

The first thing that came to my mind was spinning up ArcSOC servers to handle additional load if your main box (on your own physical network) gets swamped. Just add a new SOC server (an EC2 instance) to your existing ArcGIS Server. I have no idea if the network latency would be an issue in a distributed environment like this, but I suspect it will be. I'm going to test this out as soon as I can and will report back.

You could move your entire ArcGIS server operation up to the cloud, but as we have discussed before, it can be prohibitively expensive to do so. With this new method, you can bring them online only when you really need them. I'm sure James Fee has 'ArcGIS Server Cloud' setup as a Google Alert...so what do you think James?

Geoworld - Resource Of The Month

Our recent HivAtlas application (ArcGIS Server Javascript API site) was just highlighted in the latest issue of GeoWorld. Its on page 9 - "Resource Of The Month". I always find it strange when the folks who publish these articles never give you a heads up. Anyway, its nice to be recognized. Lots and lots of work went into that application. And - its one of the many ArcGIS Server sites that are hosted here at ROK...If you would like any information on our ArcGIS Server hosting services, drop us a line

Dojo and Coldfusion - A Fix for Using the Dojo TitlePane with CFGrid

We are automatically updating a coldfusion grid with results from a database as users type in a search box. This grid is contained in a dojo dijit.TitlePane. The TitlePane is a collapsible window.

Recently, we discovered an issue in IE. If the Cfgrid has results, then you collapse and open the dojo TitlePane, the grid will disappear. Here is how we fixed it:

Step 1: Set the duration in the TitlePane to 0
Code:div dojoType="dijit.TitlePane" id="resultsDivholder" duration="0"

Step 2: Attach an event to the toggle function using dojo.connect
Code: dojo.connect(dijit.byId('resultsDivholder'),"toggle",gridToggle);
Note: The TitlePane is a dijit. Therefore, you must use dijit.byId and not dojo.byId

Step 3: Refresh the coldfusion grid when the title pane is toggled to open
Code:
function gridToggle() { if(dijit.byId('resultsDivholder').open == true) { ColdFusion.Grid.refresh('ResultsGrid'); } }

Coldfusion 9 and CF Builder (the new IDE) Public Beta Launched

Wow...The opening of the ESRI user conference and the release of the public ColdFusion 9 beta on the same day. Doesn't get much better than that.

Someone already submitted it to DIGG, so if you want to digg it up: http://digg.com/programming/Adobe_Labs_Adobe_ColdFusion_9

The coolest feature of Coldfusion 9 has to be the ability to use Coldfusion as services from within other languages...I think especially Flex. It was always been extremely easy to call ColdFusion Components (CFCs) from Flex, but now, wow its even easier to use CF functionality from within Flex (and other languages). Check out this intro to CF 9 by the man himself, Ben Forta: http://www.adobe.com/devnet/coldfusion/articles/coldfusion9_whatsnew.html

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.9.1.002. Contact Blog Owner