Download presentation
Presentation is loading. Please wait.
Published byDarcy Johnston Modified over 9 years ago
1
TACCIMO A CASE STUDY OF MIGRATING TO THE ARCGIS SERVER API FOR FLEX www.forestthreats.org/taccimotool2011 ESRI SERUG Jennifer Moore Myers, Rob Herring, Emrys Treasure, Steve McNulty, and Chris Liggett USDA Forest Service, Eastern Forest Environmental Threat Assessment Center Todd Pierce, Jeff Hicks, Amber Ramirez, Caroline Dougherty UNC Asheville’s National Environmental Modeling and Analysis Center
2
Purpose of presentation: Describe TACCIMO product Explain migration to Flex environment Provide lessons learned Overview
3
Project History TACCIMO (Template for Assessing Climate Change Impacts and Management Options) helps users integrate climate change science into land management planning provides land and resource managers and planners with the best available science they need to effectively and efficiently sustain forests and the services they provide under a changing climate.
4
Project History TACCIMO was developed through a partnership between the USDA Forest Service’s Southern Research Station and Southern Region Planning divisions. Initial version released in 2010 as a web-based assessment and reporting tool included: Geospatial explorer shows climate data maps Geospatial report provides climate model projections for national forests through 2090 Content explorer displays climate change impacts on forests, along with management options, objectives, and design criteria for creating forest response plans Report wizard generates custom reports that provide climate change specific impacts and management options
5
Initial Version Geospatial Explorer: initial version used out-of-the-box ArcGIS Server web application; data in ESRI geodatabases
6
Initial Version Content Explorer and Report Wizard: HTML and ASP.NET Geospatial Report: manually generated reports in MS Word
7
Initial Version The initial version was successful, but the TACCIMO development team wanted to bring the various components together into one single web application. The team also wanted to have a richer web interface using the Adobe Flex/Flash platform. UNC Asheville’s NEMAC was brought in to migrate TACCIMO to the new platform – and to combine the components into one application (the “integrator”).
8
Flex Migration New version combines previous components into one interface. Demonstration GIS data in ESRI geodatabases Data served with ESRI ArcGIS Server 10.NET Climate model projection data in SQL Server 2008 database
9
Flex Migration Flex SDK 3.2 ESRI ArcGIS Server Flex API 1.3 Geospatial explorer included in GIS Viewer window
10
Flex Migration Flex SDK 3.2 ESRI ArcGIS Server Flex API 1.3 PHP 5.3.3 Zend 1.11 Geospatial explorer supports charts of climate model projections for clicked map points
11
Flex Migration Flex SDK 3.2 PHP 5.3.3 Zend 1.11 Climate Chart window shows climate data projections in tables and charts
12
Flex Migration Flex SDK 3.2 PHP 5.3.3 Zend 1.11 Content Explorer available in Science and Planning pane – shows management options for areas
13
Flex Migration Flex SDK 3.2 PHP 5.3.3 Zend 1.11 Content Explorer available in Science and Planning pane – also shows desired conditions, objectives, design criteria for forests
14
Flex Migration Flex SDK 3.2 Menu box lets user switch between states, counties, regions, and US National Forests
15
Flex Migration Flex SDK 3.2 PHP 5.3.3 tcpdf 5.9 Geospatial Report now accessible from menu box
16
Flex Migration PHP 5.3.3 tcpdf 5.9 Map images from WMS services in ArcGIS Server Geospatial Report generated on-the-fly for selected area and exported to PDF
17
Lessons Learned Communicate, communicate, communicate TACCIMO team in Raleigh, NEMAC in Asheville NEMAC team Flex beginners; TACCIMO team Flex newcomers Many phone calls and emails Four team visits over seven month period
18
Lessons Learned Moving from text based code language to compiled language presents some challenges Flex uses ActionScript and MXML, both compiled into a SWF file for deployment Code can no longer easily be opened in Notepad and edited on the server environment – requires a development environment such as Flex Builder or Flash Builder (Eclipse is open source version) Had to coordinate versions of Flex SDK (Software Development Kit), ESRI APIs, and Flex Builder
19
Lessons Learned FlexBuilder 3 interface
20
Lessons Learned Connecting Flex to databases requires use of server side language separate from ActionScript and MXML For a data driven application, the Flash SWF app (client) must make requests to a database (server) First attempts using ColdFusion worked easily, but USFS needed an open source solution Final version uses PHP with Zend library to connect PHP to Flex (Zend located at http://framework.zend.com/)
21
Lessons Learned Connecting Flex to databases requires use of server side language separate from ActionScript and MXML Zend connection required several steps Write PHP queries to database as functions Create a PHP ‘gateway’ file that loads PHP functions Edit services-config.xml in Flex to point to gateway file Add the services XML file into the Flex project compile arguments Set up Remote Object in Flex to connect to the PHP functions through the gateway file Write functions to call the Remote Object and to process results returned from PHP
22
Lessons Learned Zend step 1: write PHP functions File name: TACCIMO_integrator_queries.php <?php class clsTaccimoIntegratorQueries{ public function __construct() { //this function is needed to make the class } public function getPrismTemp($areaID) { $Temp= 0; $conn = odbc_connect(DSN, USER, PW); if($conn) { $sql="select TempC from AreaPrismValue where AreaID = ".$areaID; $rs=odbc_exec($conn, $sql); $row=odbc_fetch_row($rs); $Temp = odbc_result($rs,"AreaPrismAvgTempC"); odbc_close($conn); } return $Temp; } //other functions.... } ?> Function name – multiple functions allowed Class name – only one class needed
23
Lessons Learned Zend step 2: gateway file File name: TACCIMO_zend_gateway.php <?php error_reporting(E_ALL | E_STRICT); //optional require_once "Zend/Amf/Server.php"; //Path to file in Zend folder require_once "PHP/TACCIMO_integrator_queries.php"; $server = new Zend_Amf_Server(); //declare the server $server->setClass("clsTaccimoIntegratorQueries"); $handle = $server->handle(); echo $handle // needed to start the server ?> Name of PHP functions file (step 1) Name of class in PHP functions file (step 1)
24
Lessons Learned Zend step 3: create services config file in src folder in Flex Builder File name: services-config.xml * Gateway file path (step 2) Channel ID for gateway (see step 5) Destination ID for gateway (see step 5)
25
Lessons Learned Zend step 4: link services-config.xml file to Flex project Project >> Properties >> Flex Compiler
26
Lessons Learned Zend step 5: create Remote Objects in Flex code to call gateway <mx:RemoteObject destination="zend" id="zendTaccimoChartPHP" showBusyCursor="true" source="clsTaccimoIntegratorQueries"> <mx:method name="getPrismTemp" result="setPrismTemp(event)" fault="onError(event)"> {null} Zend destination ID (step 3) Flex ID for PHP remote object (step 6) Class name in PHP functions file (step 1)
27
Lessons Learned Zend step 5: create Remote Objects in Flex code to call gateway <mx:RemoteObject destination="zend" id="zendTaccimoChartPHP" showBusyCursor="true" source="clsTaccimoIntegratorQueries"> <mx:method name="getPrismTemp" result="setPrismTemp(event)" fault="onError(event)"> {null} Arguments to pass to function call (step 6) Function name in class in PHP file (step 1)
28
Lessons Learned Zend step 5: create Remote Objects in Flex code to call gateway <mx:RemoteObject destination="zend" id="zendTaccimoChartPHP" showBusyCursor="true" source="clsTaccimoIntegratorQueries"> <mx:method name="getPrismTemp" result="setPrismTemp(event)" fault="onError(event)"> {null} Flex function to call when result returned from PHP function (step 7) Flex function to call if error returned from PHP function (step 7)
29
Lessons Learned Zend step 6: write function in Flex to call Remote Object method public function getDatagridNumbers(areaID:int):void { //get datagrid numbers from db query zendTaccimoChartPHP.getPrismPrecip(areaID); zendTaccimoChartPHP.getPrismTemp(areaID); } Name of Remote Object ID (step 5) Name of Remote Object method (step 5) – also name of function in PHP function file (step 1) – with passed parameter
30
Lessons Learned Zend step 7: write functions in Flex to handle results and errors from Remote Function call public function setPrismTemp(evt:ResultEvent):void { var prismTemp:Number = new Number; prismTemp = Number(evt.result); // do something with number } private function onError(err:FaultEvent):void { Alert.show(err.message.toString(),"ERROR!"); } Name of function called when result returned (step 5) Name of function called when error returned (step 5)
31
Lessons Learned Flex requires a team of programmers with different skills Previous projects at NEMAC done by one or two persons TACCIMO required a larger team with multiple skills One member specialized in the interface – colors, styles, graphics, transitions, effects One member focused on the GIS-Flex interaction using the ESRI API for Flex One member focused on the database schema and the PHP code needed to query the database One member focused on the Flex-database interactions and Zend for PHP
32
Lessons Learned Dedicated team programming efforts make a big difference NEMAC staff usually work on several projects at once For this project, 2 members were 100% dedicated, and the other 2 members were roughly 75% dedicated Led to rapid strides in development; initial prototype completed in just a couple months Final version delivered five months after project start Such concentration of resources often not possible – has not been done again due to competing project deadlines
33
Lessons Learned Large teams need code management software and version control Subversion plugin (open source) used for Flex Supports code check in/out and change synchronization Worked well most of the time – as long as team remembered to commit changes, and to get latest changes when opening code Requires setting up a subversion repository
34
Lessons Learned Use external configuration file(s) to minimize coding changes Similar to approach used by ESRI’s Flex Viewer application Have XML configuration file store items that end user might want to change, without need for developers to edit code and recompile SWF file ArcGIS services to load to map Choices for background map (streets, image, terrain, etc) Initial extent of map Spatial bookmarks for quick zooming Hyperlinks to external resources in links bar Combinations of services into map ‘themes’ Settings for map tools (print, find, identify, export, etc)
35
Lessons Learned Use external configuration file(s) to minimize coding changes
36
Lessons Learned Use external configuration file(s) to support portability Similar to approach used by ESRI’s Flex Viewer application Have configuration file store items likely to change as application is moved across servers, or as data changes Path to ArcGIS Server REST folder (different server names) Location of needed images Connection information for SQL server database Path to export reports and resulting URL
37
Lessons Learned Don’t be afraid to hard code things that don’t change, if you get faster performance List of states, counties, forests – not expected to change – store in code file instead of querying database
38
Lessons Learned Don’t be afraid to value speed over disk space Maps of climate change projections for areas in geospatial report – data not expected to change – create pre-generated images at needed scale rather than query WMS server on the fly (saved several minutes per report) But, took 735 MB of space just for states, regions, forests – counties not done (would add another 9 GB)
39
Lessons Learned Transferring working application to another organization requires considerable planning and probably on-site work Setting up same environment on server (PHP, ArcGIS Server) Moving spatial and SQL databases Setting up ArcGIS Services Finding hard coded paths and URLs and making generic Using subversion or other method to keep code files in synch Handing off needed documentation and metadata Ensuring everyone has needed skills to keep application running Often, simple things cause most hassle – such as USFS email not allowing zip files to be mailed
40
Conclusion The TACCIMO product serves as a useful case study of migration to Flex Many lessons learned being applied to other development projects at NEMAC tpierce@unca.edu http://nemac.unca.edu/ jmooremyers@fs.fed.us www.forestthreats.org/taccimotool
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.