Situational Awareness Development Overview • Beginning Stages of App Development • Had the idea/need, but what API to use? • Confusion and Revelations – learn from our trials • Demonstration of Situational Awareness Application • Data Feeds from external (non-GIS) data sources • How accomplished and future changes
Beginning Application Development • Which ArcGIS Server Web API to use? • ArcServer installed on a Test Web Server (“hand me down” server) • Taken training • But so many options!! • Experienced programmers but not with web apps • What is the best to use? • Which has least steep learning curve? http://resources.esri.com/arcgisserver/index.cfm?fa=applications
Source: ESRI ArcNews Online Fall 2009 Application Development – Which API? Just as we were trying to make a decision … ESRI-Charlotte held a half-day seminar for Emergency Operations personnel: • VIPER demonstration – built with Adobe FlexBuilder and the ArcGIS Server Flex API • ESRI FlexViewer sample download and configuration • Integrating non-GIS data with GIS enabled content Weather radar, warnings Dispatch calls Vehicle locations Traffic cameras VIPER Application
App. Development – FlexViewer Sample • Let’s try the FlexViewer sample! • Downloaded “Sample Flex Viewer” from Code Gallery: • http://resources.esri.com/arcgisserver/apis/flex/index.cfm?fa=codeGalleryDetails&scriptID=15905 • Quick “How-To” document to configure the FlexViewer application with your ArcGIS Server services • http://www.esri.com/events/seminars/webmaps/pdfs/handout.pdf All clients viewing FlexViewer Sample will need Adobe FlashPlayer 9 or 10
App Development – FlexViewer Sample • Configured to use our ArcGIS Server services including a cache of our 2009 Aerial Photography to replace the ESRI Imagery used by default. • Configured to use Weather Radar • ESRI StreetMap service used at small scales for cartography and speed. • Configured “Live Layer Widget” in FlexViewer to display live data feeds from non-GIS data sources at the City and beyond • Fire and Police Dispatch calls (Active and Closed last 24 hrs) – From County E911 server • Fire Vehicle locations – from iTrak server in Colorado (iTrak API not publicly avail) • SCDOT Traffic Cameras – SCDOT and shapefile we created • Local weather station data – Weather Underground API, publicly avail. • FireHouse Incident Management reports – SQLExpress database that Fire Dept uses • Public Service Requests and Road Closures from CityWorks Work Order Management System’s database at the City. • Utilized SQL Server 2005 SSIS packages designed in SQL Server Business Intelligence Studio for regular data extractions (discussed after Demo) • Widgets use REST Services created from ArcGIS Server Manager
Example: We wanted to change behavior of the LiveLayerWidget in the FlexViewer sample. Forums or ESRI would send us a new LiveLayerWidget.mxml or told to “add this to your ‘src’ folder”. Problem: FlexViewer Sample that is the configurable application contains zero .mxml files or ‘src’ folders Customizing the App – Flex Confusion • ESRI Sample code from here is not meant to be copied and pasted into FlexViewer:
Using the ArcGIS Server FLEX API • Three ways of working with ArcGIS Server FLEX API • Use Adobe FlexBuilder to build FLEX apps from “scratch” • Download the FlexViewer Sample and configure the web app (as mentioned previously) by altering .xmls • Download the entire FlexViewer Source project and alter code using Adobe FlexBuilder
1. Build Flex Project from “Scratch” • Requires Adobe Flex Builder – development environment to build rich Internet applications. • THIS is where the samples can be used best http://resources.esri.com/help/9.3/arcgisserver/apis/flex/samples/index.html • Must add the ARCGIS API for Flex library (.swc) into the Flex Project
2. Utilize the FlexViewer Sample (configurable) • City started with this • Download from Code Gallery (previous slide) • Directory containing built and compiled Web Application (contents of bin-release folder from FlexViewer Project – next page) • Ready to be deployed on a Web Server • Configure the config.xml and widget .xmls to utilize your services/data. • Cannot use .mxmls from forums or Code Gallery
3. Utilize the FlexViewer Project Source Code using Adobe FlexBuilder • City now using. • Requires Adobe Flex Builder – development environment (60 day trial avail.) • Download from Code Gallery (previous slide) but use the flexviewier_src_v##.zip • Must Have: Developer’s Guide Create: GeoWeb Applications with the Sample Flex Viewer • FlexViewerDevelopersGuide.pdf • 60 pages of information • How to import and work with the FlexViewer Project • How to create your own widget • Create the final web application • Indispensable to us in the beginning
FlexViewer Project within FlexBuilder • Work with .mxml, .xml, .as, etc. files within “src” folder to customize • When ready to deploy the FlexViewer Application, will perform Export Release Build • Creates bin-release folder that contains files needed to deploy web app. Copy paste files to webserver and deploy as any other web app • Bin-release will not have .mxmls or action scripts (.as) – only .swf and .xml (and other supporting files). • FlexViewer Sample (configurable - #2 option with FLEX API) is the contents of this folder.
Data sources that are not GIS based Question: How to extract data from external sources into usable format on a regular basis Initial Goal: Pull from other sources and place into SQL tables with X and Y Coordinates Each situation can be very different Depends on how we can access the data: Database connection to another server Web API (API is another potentially confusing term) GeoRSS feed Created a SQL Server Database (NON-SDE) for use with most external feeds. Data Feeds from external data sources
County E911 office maintains in SQL Server (YEAH!) DBA of E911 allowed us access to Database County GIS accessing every 30 mins, so he allowed us access if we agreed to that time Hope to talk him into more frequent time intervals. Coordinates in CAD are in SC State Plane CS Started by using Import/Export utility in SQL Server 2005 to create the initial database table within our database from County Dispatch. Data Feeds – Dispatch (CAD) Calls
Created SQL Server SSIS Package in Business Intelligence Studio for regular updates Set up a Job in SQL Server Agent within SQL Server 2005 that runs the SSIS package Data Feeds – Automate updating Dispatch (CAD) Calls • Result is SQL Table with fields containing X and Y coordinates. SQL Server 2005 Job
In ArcMap, use SQL table to “Display X-Y data” (create x-y event theme) Table in SQL with Coordinates - Display in FlexViewer • IMPORTANT for tables that will be updated regularly and coordinates are in State Plane and FlexViewer is using WGS84: Choose the projection for the X-Y data by “Importing” from one of your existing data layers that has the extent needed (ie. City Limit or County boundary). Do NOT just select the correct projection/coordinate system.
Publish Map document as a Map Service with ArcGIS Server Find REST URL for the Service and layer number for Dispatch Calls and update the config.xml and/or LiveLayerWidget.xml accordingly (see doc on configuring FlexViewer) Run application and layer will appear Note: Data layers added through this method will project on the fly! Dispatch (CAD) Calls - Display in FlexViewer
City Fire Dept. uses iTRAK AVL system for fire trucks – locations stored at iTRAK in Colorado Chief uses iTRAK’s web app to monitor locations iTRAK offers an web API to customers We utilize this API to access fire truck locations API in this case is actually a “connection to info that they are supplying”. AKA – web service iTRAK supplied us with a query, username, and password. The query supplies a text file….. Data Feeds – Fire Vehicle Locations
Need to get from Text file to SQL Table with Vehicle Names and Lat /Lon as numbers vs. text That can be updated every minute! Data Feeds – Fire Vehicle Locations
SQL Server and SSIS package that can be scheduled to run as SQL job every minute Only dealing with 12-15 records Data Feeds – Fire Vehicle Locations Runs query to iTrak API and returns text file using HTTP connection Pushes info from text file to SQL table Runs several sql statements to extract latitude, longitude, vehicle name from long text string and convert lat/lon to numbers
Use SQL View vs. Table for final Fire Truck Locations Use in FlexViewer using same method as other Data Feeds Display X-Y Data using View Publish as Map Service Add to widget Adjust refresh rate of widget to a minute so that it will show changes in data. Data Feeds – Fire Vehicle Locations
Future changes – Data Feeds • Examine using a web handler example to convert the tables to GeoRSS feeds • Use GeoRSS feed widget to display data • Bypass using XY event theme, publishing map as service for Live Layer Widget “Data Feeds” • May solve some of the error issues • Provided by ESRI • Bring in other layers! • Road temperature sensors, stream gauges, etc.
Conclusion • FlexViewer with source code provided great “starter” code for Situational Awareness application. • Determining how to extract data from other sources on a regular basis is time consuming. • Don’t worry too much about the “best” way to extract data from other sources. Just get something to work first, then make it more efficient. • Fun!
Connect to iTRAK API, download text file • Uses HTTP Connection option in SSIS Connection Manager • Set iTrak Query, login, password • Script found on SQL forum to download to a text file
Text File to SQL Table These fields still empty after this task
SQL commands to update table Extract Latitude from text string Converts lat string to number and places into number field Extract Longitude from text string Converts lon string to number and places into number field Extract Vehicle number from text string