The ArcPad Team Blog

Unofficial stuff from the team behind the World's leading mobile GIS platform

Monday, April 23, 2007

Welcome Luke!

Luke Paine has crossed the treacherous Bass Strait to join the Maptel / ArcPad Team.
Luke intends to use his finely tuned tennis and volleyball skills and years of precision surveying training to further enhance the testing regime at Maptel. We have thrown Luke in the deepend with his first project to be the focus for ArcPad 7.1 testing . Welcome Luke!

Tuesday, April 10, 2007

ArcPad Customization Demos Available at ArcScripts

The 2nd annual ESRI Developer Summit was held March 19–22, 2007, at the Palm Springs Convention Center in Palm Springs, California. I presented 3 demos in the ArcPad Customization which are now all available for download on ArcScripts.

QuickRoute Applet

This sample ArcPad applet shows how you can implement a simple/quick routing for any polyline shapefile. The sample requires ArcPad 7.0.1 to function.

Back to the Future Demo

This is the "Back to the Future demo" that was presented in the ArcPad Customization (Deep Dive) as a simple implementation of a Utility extension. Use utility extensions whenever straight Applet/VBScript code is not enough. i.e. For either performance or for functionality reasons, a compiled ArcPad Utility extension DLL is needed.

The sample contains 3 folders, ARM_QVGA_VBScript, Win32_QVGA_VBScript and Win32_VGA_VBScript which are ready-to-run versions of the Back to the Future demo. Choose a version that's appropriate to you (i.e. if you're running ArcPad on a PDA with a 320x240 screen use the ARM_QVGA_VBScript version). Copy the files from the Applets folder and Extensions folder into the corresponding folder of your ArcPad 7 installation and run ArcPad.

In ArcPad you should see the Back to the Future toolbar with an arrow button. Click the button and it launches the Back to the Future form with two big buttons, "FORWARD 30 YEARS >>>" and "<<< BACK 30 YEARS". Clicking on either button will modify the System Clock by 30 years.

Some notes of the Visual Studio 2005 C++ source code.

- It's a single project that can target both Win32 and Pocket PC platforms.
- Appropriate use of extern "C" __declspec(dllexport) means we don't require a module .DEF file.
- Pre-compiled headers have been turned off on APEx.cpp

Road Runner Multi-Tier Demo

This is the "Road Runner demo" that was presented in the ArcPad Customization (Deep Dive) in the ESRI Developer's Summit 2007 in Palm Strings. It is a demonstration of ArcPad and its INET internet object in a 3-tier business application.

In the scenario, we have a point shapefile (RoadRunner.shp) with fields ID, TXT, UPLOADED and a VALUEMAPRENDERER on the TXT field to display bitmaps for "cactus", "coyote", "roadrunner" and "rocket". We also have a business table in SQL Server 2005 called RoadDemo.dbo.ASSETS with fields ID, TXT, X and Y. The demonstration shows how you can make use of the INET internet object to upload changes from ArcPad to SQL Server 2005.

In order for this demo to work, a number of assumptions have been made:

- You have Windows PC named: NW8240 *
- You have SQL Server 2005 installed and a database named: RoadDemo *
- You have Visual Studio 2003 installed *.
- You have IIS installed.
- You have ArcPad 7.0 installed in C:\Program Files\ArcPad 7.0 **.
- The SQL Server supports Windows Authentication logins.
- There is a RoadDemo.dbo.ASSETS table can be edited by the Internet Guess account (e.g. IUSR_NW8240).

* N.B. if you want to make changes you'll need to edit and recompile the middle-tier SQLExec.DLL project in Visual Studio 2003.
** N.B. if you install ArcPad in a different directory, you will need to edit Data/RoadRunner.apm so that it can find the Redlands sample data.

This is a demonstration of a 3 tier business application consisting of an ArcPad thin-client, an IIS ISAPI application and SQL Server.

The first tier is a thin-client RoadToolbar Applet that runs in ArcPad. It has 3 buttons on the toolbar. The first button uploads new records in the RoadRunner.shp to the ASSETS table and marks those records as UPLOADED = 'Y' so that they will not be uploaded a second time. This illustrates how one can carry out disconnected editing on a shapefile and upload the edits back to server when connectivity is present. The second button is a delete tool which deletes records from both RoadRunner.shp and from the server at the same time. The third button resets both the shapefile and the server to a common initial state (i.e. 3 cactus points).

The second tier is a middle-tier an ISAPI DLL that you need to install on an IIS or an equivalent web server. This tier is acts as a relay; it forwards requests from ArcPad to SQL Server 2005. However, it's been design in such a way so that you can test the middle tier standalone. i.e. once installed correctly, you can use any web client, such as Internet Explorer, to communicate with it. Just navigate to the SQLExec.DLL and a form should appear which allows you to execute adhoc SQL commands on SQL Server. A Visual Studio 2003 C++ application with all of it's source code is provided. I recommend that you study it since it has a lot of useful information. Note that the name of the SQL Server, the database and the connection to it has been hardcoded. Tips and tricks to installing the middle tier:

- You'll need IIS.
- You should place the SQLExec.DLL in the C:\InetPub\Scripts directory.
- You need to verify that the Virtual Directory 'Scripts' is linked to C:\InetPub\Scripts
- Although not essential, it's recommended you turn on directory browsing.
- If installing on Windows Server 2003 ISAPI extensions and filters are turned off by default and you need to turn them back on.
- The ISAPI DLL is run using Internet Guest account privileges (so access to files and registry will be limited).

The final tier is merely SQL Server 2005 with a database called RoadDemo and a table called ASSETS. i.e. you can use the following SQL to create this table.


During the DevSummit, I was putting a Hollywood spin on this demo by calling it a Road Runner demo since that sounded more interesting than presenting it as a multi-tier asset management demonstration. At the start of the demo, both the RoadRunner.shp and the SQL Server database table RoadDemo.dbo.ASSETS had 3 "CACTUS" records in it.

I began by adding "ROADRUNNER", "COYOTE" and "ROCKET" records to the RoadRunner.shp with the UPLOADED attribute unset. If we take an inventory of both the shapefile and the database table, we see that the shapefile has 6 records, whilst the database table only has 3. If we now push the first button on the RoadApplet it will upload these new records to SQL Server and set UPLOADED = 'Y' for these records in the shapefile. If you push the first button again, it will not do anything since there have been no new records added to the shapefile. If you take an inventory of both the shapefile and the database table, we see that they both have 6 records and are in sync.

Now, I demonstrate the second button which is a Delete tool. I remove all 3 "CACTUS" records stating that the Road Runner now has paths to flee the Coyote, so I also remove the "ROADRUNNER" record. If I take an inventory of both the shapefile and the database table, they both show exactly 2 records, namely "COYOTE" and "ROCKET".

The final button resets the demo to containing just 3 "CACTUS" records in both the shapefile and on the database table.

Labels: , , ,