GISi AG4LG Deployment

We at GISi have been very happy with our client successes using GISi HealthCheck and GISi ArcGIS 4 Local Government (AG4LG)  jumpstart toolkit.  Most recently, the GISi & the City of Southfield, MI GIS group has been working diligently to implement Esri’s AG4LG information model into the City’s existing Enterprise GIS infrastructure.  The City has adopted the newly released common information model, core GIS tools, templates, and applications to help the City improve operations and communicate more effectively with the public while saving both time and money.

We are very excited that Southfield has joined our client, Effingham County, GA, to become one of the first communities in the country to truly embrace the new information model, applications and services being provided by GISi & Esri. The work GISi and the City have been doing in the AG4LG space has already generated a wealth of positive word of mouth throughout the region.

The City of Southfield GIS group has deployed the apps and maps gallery template: Destination Southfield and three applications; “GISi Silverlight Template Viewer”, “Polling Places”, “Parks & Rec Finder” and the City plans to have many more apps added in the coming months.

The GISi Silverlight Template Viewer application provides a wealth of geospatial information to its residential and business community, supporting public service delivery 24/7.  The City and GISi migrated its current WebADF application to the ArcGIS Server 10 platform using Microsoft Silverlight™ version 4.  Resources like the City’s Internet Mapping Portal reflect the type of investments Southfield is making to ensure a vibrant business climate exists.  This site helps promote the growth of existing business and attract new investments into the city while providing vital information to its citizens. Residents and nonresidents alike are able to view property ownership, zoning, voting districts, refuse and recycling information and many more commonly used data layers.

The Election Polling Places application helps citizens locate their election polling place and obtain information about current elected officials. This application is typically used by citizens during an election season, but can be used throughout the year to determine which elected official represents the precinct they reside in. To locate a polling place, simply click on the map or enter an address in the search box. The polling place and respective voting precinct will then be highlighted on the map and relevant information about the polling place and elected officials will be presented in two tabs at the bottom of the application. The application will also provide directions from the searched address to the associated polling place location.

The Park and Recreation Finder application helps residents locate a park and obtain information about recreation activities in their community. This application is typically used by residents in a community, but can be used by visitors to locate a park or recreation area near them, or one that offers the activity they are interested in. To locate a park, simply enter an address or activity in the search box. The park(s) or recreation area(s) will then be highlighted on the map and relevant information about available recreation activities are presented to the user.

The City now plans to release new applications on a consistent basis over the upcoming months. Sally Price feels the release of these applications will offer significant value to both City of Southfield staff as well as its citizens.  The City is using the GISi HealthCheck prescription to guide these future apps.

I would like to thank everyone at Esri who made this implementation possible through education and commitment to the success of our clients, to the GISi staff (Steve Gogola, Sean Savage & Christopher Fricke) and Sally Price sprice@cityofsouthfield.com.

GISi will soon be deploying AG4LG apps to ArcGIS online, visit: http://www.arcgis.com/home/item.html?id=881d4967817241db818795135a12ab09

For more information on the GIS HealthCheck, visit http://www.GISHealthCheck.com

For more information on AG4LG, visit: http://resources.arcgis.com/content/local-government/about

For a link to Destination Southfield, visit: http://maps.cityofsouthfield.com/destinationsouthfield/

For more information on the GISi Silverlight Template Viewer, contact sales@gisinc.com and try it live: http://maps.cityofsouthfield.com/GISViewer/

For more information on Elections Polling Place Template, visit: http://www.arcgis.com/home/item.html?id=14290c7441b34ea984ad9310f4cf6435 and try it live: http://maps.cityofsouthfield.com/Apps/Elections/PollingPlaces/

For more information on the Park and Recreation Finder Template, visit: http://www.arcgis.com/home/item.html?id=734512384d3b4b849aba2db0e33a80f2 and try it live: http://maps.cityofsouthfield.com/Apps/Recreation/ParkFinder/

Esri Mobile 10 SDK and WPF Beginner’s Tutorial

WPF stands for Windows Presentation Framework and we are going to see how quick it is to utilize Esri’s Mobile 10 SDK’s new ability to work in WPF. In this blog I am not going to go into depth about WPF except to say it is Microsoft’s (MS) equivalent to Adobe AIR. Say goodbye to WinForms and welcome to a whole range of slick animations, affects and all that other jazzy stuff you now expect from any Silverlight or Flex web applications. But with this blog we are just going to focus on the nuts and bolts of quickly standing up a mobile application designed for a tablet that runs a Windows operating system. Plus I will point out some gotchas I stumbled across along the way.

Prerequisites:

  • MS Visual Studio 2008 sp1 or higher (I personally prefer 2010- more built in features I make use of)
  • Esri Mobile 10 SDK (make sure and run the uninstaller application first to identify any conflicts with prior installed versions of ArcGIS products)
  • ArcGIS 10 (optional- but need if you want to use geoprocessing tools to create mobile caches)
  • Created mobile caches
  • Running mobile map service (unless you want to skip the sync part)

Map Tutorial Application

Once the prerequisites are installed, open Visual Studio and create a new project.  In the new project dialog, select the WPF Windows Application template. For this tutorial, I chose to go down the path of C# (sorry you VB.NET programmers- but just Google a translator. None of the code snippets will be too difficult to translate). Name your new project WpfMobileTutorial (or whatever you want) and click OK. When your new project solution opens you will see two files- App.xaml and MainWindow.xaml. Expanding them and you see their corresponding cs files. For this tutorial we will ignore the App.xaml file. The only thing I will point out is in App.xaml you can set what xaml file in your project is the start up window-  StartupUri=”MainWindow.xaml”

Now let’s pull in our Mobile SDK. Right click References folder and select to Add References. Add ESRI.ArcGIS.Mobile. If you had used Mobile 9.3.1 SDK or earlier you are probably used to going to the Toolbox window and seeing your Esri controls like map. There is a bug in the current release of this SDK and you will not see them in Toolbox but don’t despair- there are there. We just need to add them the old fashion way before we had fancy dandy IDEs that did all that work for us. First add the reference to the SDK to the Window header tag like so:

<Window x:Class="WpfMobileTuturial.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:esrimap="clr-namespace:ESRI.ArcGIS.Mobile.WPF;assembly=ESRI.ArcGIS.Mobile"  
        Title="MainWindow" Height="450" Width="650">

Add the following line inside your Grid container.

<Grid>
<esrimap:Map x:Name="map1"  />
</Grid>

You could compile and launch but nothing fun will happen- we need to add the cache to the map. Now, I have done Flex development and I love the config files they use so things can be changed without recompiling. So, I mimic that by adding an xml file to my project that I call Settings.xml. You can setup how you want but this is the format I typically use to store my cache information:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <cacheLocations>
    <operationalCacheLocation>C:\Caches\OperationalCache\MobileCache</operationalCacheLocation>
    <baseMapCacheLocation>C:\Caches\BaseMapCache\Layers</baseMapCacheLocation>
  </cacheLocations>
  <mobileServiceInfo>
    <mobileServiceURL>http://serverTutorial/ArcGIS/services/Panhandle/tutorial/MapServer/MobileServer</mobileServiceURL>    
  </mobileServiceInfo>
</configuration>

For now let’s focus on what is between the cacheLocations tags. Most mobile applications will have separate caches. One for the stuff they plan to edit and sync- operationCacheLocation tag. And the base stuff used for reference and not typically synced- baseMapCacheLocation tag.  OK- back in MainWindow.xaml add the following event to the Window header tag Loaded=”Window_Loaded”. Switch over to MainWindow.xaml.cs and add the following code:

MobileCache mobileCache;
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {            
                       string xmlPath = getAppPath() + "Settings.xml";
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(xmlPath);
            XmlNodeList elemList;
        }
        public static bool IsDesignMode()
        {
            return (System.Diagnostics.Debugger.IsAttached);
        }
        public static string getAppPath()//make sure return with trailing \
        {
            bool check = IsDesignMode();
            if (check)
            {
                return @"C:\Projects\WpfMobileTuturial\WpfMobileTuturial\";
            }
            else
            {
                return System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\";
            }
        }
      private MobileCache getMobileCache(String cachePath)
        {
            MobileCache m_mobileCache = new MobileCache();
            m_mobileCache.StoragePath = cachePath;
            m_mobileCache.Open();
            return m_mobileCache;
        }

Let’s go over what is going on here. First, if you had done mobile development prior to 10 MobileServices was replaced with MobileCache. But be warned- it is not an exact switch out between them. So, I would try and forgot how MobileServices worked in 9.3.1 and treat MobileCache as something new you are learning. The helper methods getAppPath() and IsDesignMode() just do some of the leg work of finding where Settings.xml is- if debugging I did go ahead and hardcode the path but if it is installed I just pull out it of Assembly.  I will discuss getMobilCache later. Let’s now add the code to our Window_Loaded method for adding the caches after the line XmlNodeList elemList;

elemList = xmlDoc.GetElementsByTagName("baseMapCacheLocation");
            string streetCache = elemList[0].InnerXml;
            if (streetCache != null && streetCache.Length > 0)
            {
                //rasterdata- local Tile Map Cache
                TileCacheMapLayer mpLayer = new TileCacheMapLayer(streetCache);
                mpLayer.Name = "Base Tile Cache";
                mpLayer.Open();
                map1.MapLayers.Add(mpLayer);
            }
            elemList = xmlDoc.GetElementsByTagName("operationalCacheLocation");
            string localCache = elemList[0].InnerXml;
            if (localCache != null && localCache.Length > 0)
            {
                mobileCache = getMobileCache(localCache);
                //update the cache
                elemList = xmlDoc.GetElementsByTagName("mobileServiceURL");
                string mapurl = elemList[0].InnerXml;
                int index = 0;
                //map1.MapLayers.AddRange(mobileCache);
                //this method AddRange doesn't always behave as expected so here is my work around- make a renderable mobilcachemaplayer for each layer
                //and then add to WPF map
                ReadOnlyLayerCollection clc = mobileCache.Layers;
                int iCnt = mobileCache.Layers.Count;
                for (int i = 0; i < iCnt; i++)
                {
                    Layer layer = mobileCache.Layers[i];
                    MobileCacheMapLayer mobileCacheMapLayer = new MobileCacheMapLayer((MobileCacheLayer)layer);
                    map1.MapLayers.Insert(index, mobileCacheMapLayer);
                    index++;
                }               
            }

So, all this code snippet does is first get the value from our tag baseMapCacheLocation and uses one of the new features of 10;using Tile Caches created from a Tile Map Service. You just need to copy _alllayers folder, conf.cdi and conf.xml locally and just have your Settings.xml store where they  are saved locally.

The next part adds the operational layers to the MobileCache. And now you see us utilize the getMobileCache helper method. Just pass in the path location grabbed out of the Settings.xml and all this method does is initialize the mobile cache. Next we add these layers to the map. Here you will notice some comments in the code. I have had very inconsistent luck with using the map’s method AddRange. To be safe I always do the long way of casting the layers into MobileCacheMapLayer and add that to the map. Feel free to do whichever.

At this point you can compile and run and see a new window open showing your cache data..

Cool. Now let’s add some navigation. In MainWindow, drag three button controls onto your window and position where you would like them. Here you could get real fancy and add in some wicked style/animation affects. What I will do is just change text to Pan, Zoom In, and Zoom Out respectfully. I know, lame, but you can stop here and play with styling and if you have Expression Blend it is even easier. Here is a cool one to try- http://www.codeproject.com/KB/WPF/glassbuttons.aspx.

But back to the boring stuff let’s add the tiny bit of code snippets for adding in basic navigation:

private void btnPan_Click(object sender, RoutedEventArgs e)
        {
            map1.CurrentNavigationMode = ESRI.ArcGIS.Mobile.WPF.NavigationMode.Pan;
        }
        private void btnZoomIn_Click(object sender, RoutedEventArgs e)
        {
            map1.CurrentNavigationMode = ESRI.ArcGIS.Mobile.WPF.NavigationMode.ZoomIn;
        }
        private void btnZoomOut_Click(object sender, RoutedEventArgs e)
        {
            map1.CurrentNavigationMode = ESRI.ArcGIS.Mobile.WPF.NavigationMode.ZoomOut;
        }

And hooking our WPF button controls to our methods add Click events to each of your buttons and point to corresponding method (e.g. Click=”btnPan_Click”). Now compile and run and you can navigate around your map by panning and zooming in and out.

Since this is a mobile application the last thing I will cover here is synchronization- especially since the process changed in 10. Let’s add a fourth button to our application. Again, I am not going to utilize any wicked cool affects and just change the text to ‘Sync’.  And put the following method in MainWindow.xaml.cs:

private void btnSync_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                string xmlPath = getAppPath() + "Settings.xml";

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(xmlPath);

                XmlNodeList elemList;

                elemList = xmlDoc.GetElementsByTagName("mobileServiceURL");
                string url = elemList[0].InnerXml;

                MobileServiceConnection mobileServiceConnection1 = new MobileServiceConnection();
                //link the mobile classes to put the data into the display 

                mobileServiceConnection1.Url = url;

                ReadOnlyLayerCollection clc = mobileCache.Layers;
                int iCnt = mobileCache.Layers.Count;
                for (int i = 0; i < iCnt; i++)
                {
                    //synch just be feature test
                    FeatureLayer featureLayer = mobileCache.Layers[i] as FeatureLayer;
                    FeatureLayerSyncAgent featLayerSync = new FeatureLayerSyncAgent(featureLayer, mobileServiceConnection1);
                    FeatureLayerSyncResults featLayerResults = new FeatureLayerSyncResults();
                    featLayerResults = featLayerSync.Synchronize() as FeatureLayerSyncResults;
                    IDictionary<int, string> synErrors = featLayerResults.UploadedFeaturesErrors;
                    if (synErrors.Count > 0)
                    {
                        foreach (KeyValuePair<int, string> kvp in synErrors)
                        {
                            int v1 = kvp.Key;
                            string v2 = kvp.Value;
                            System.Windows.MessageBox.Show("Error uploading " + featureLayer.Name + ". Contact administrator. " + "Key: " + v1.ToString() + " Value: " + v2);
                        }
                    }
                    if (featLayerResults.Exception != null)
                    {
                        Exception e = featLayerResults.Exception;
                        if (e.Message != null && e.Message.Length > 0)
                        {
                            System.Windows.MessageBox.Show("Error uploading " + featureLayer.Name + ". Contact administrator. " + "Message: " + e.Message);
                        }
                    }
                }
                return;
            }
            catch (Exception e)
            {
                System.Windows.MessageBox.Show(e.Message, "Error in OpenCacheConnection", System.Windows.MessageBoxButton.OK, System.Windows.MessageBoxImage.Error);
                return;
            }

Looking at the code you now see the mobileServiceURL tag come into play. The URL to the mobile map service I also like to put in the Settings.xml. This, makes moving things to another environment much easier. Once we pull out the URL we assign to MobileServiceConnection. Now there was something I noticed about the sync process that annoyed me- it will run and not return any errors automatically. You actually have to dive into either FeatureLayerSyncResults or MobileCacheResults. In the above code snippet I actually show how to loop through cache and sync each layer. Then pull out if there were any errors in UploadedFeaturesErrors or in Exception. Makes debugging sync issues so much easier. So, go ahead and compile again and if you have your mobile service set up go ahead and sync. If there are any errors you will get an alert stating the problem.

So, that ends the tutorial for getting up and running with Mobile 10 and WPF. I will be following this with a blog extending this tutorial to start incorporating aspects of the design framework MVVM and utilizing WPF binding capabilities. Also, if you would like to see how cool WPF can look check out our project showcase (http://showcase.gisinc.com/) and look for the Panhandle Energy Pilot Patrol Application or City of Appleton Sign Retro-reflectivity Solution projects.

GISi ArcGIS for Local Government Initiative

As we finish the final touches of GISi’s State & Local Government Business Plan, I couldn’t help but reveal one of our goals as we are planning to launch a campaign this week at the 2011 Esri International User Conference and we already have a success story (Effingham County, GA). One of our goals is to align with Esri’s ArcGIS for Local Government initiatives.  The strategies we have laid out will help our customers successfully implement GIS in cities, counties, and other local authorities.  This is a relatively new concept; the ArcGIS for Local Government includes a series maps and applications built on a common information model that are designed to work together across various departments.  For more information, visit: http://resources.arcgis.com/content/local-government/about

Our objective is to help cities and counties deliver value to their organizations by applying their geographic information to support daily government activities – that is, to run their operations more efficiently, to communicate more effectively, to save money, to engage with their citizens, and to understand, plan, and make improvements in their communities.

The strategies & actions to accomplish this goal are designed to be focused on the local government industry verticals and work more closely with Esri to build complimentary applications that are based on the ArcGIS System and use the ArcGIS for Local Government information model.  We are also focusing on implementation services of the ArcGIS System, services to install, configure, and extend ArcGIS for Local Government (maps and applications, information model, etc.).

The GISi team is looking forward to being a big part of the Esri ArcGIS for Local Government Initiative.

Utilizing Python to Aggregate Enterprise Geodatabases

Background

The Navy’s Regional Shore Installation Management System (RSIMS) program manages approximately 35,000 feature classes spread across 12 regions and needed a way to serve up data easily with ArcGIS server. Each region manages multiple schemas within the regional SDE geodatabase representing different geographic areas within their regions. This allows for the customization of data structure and spatial reference to best fit the data for that area. The challenge was to aggregate each regional schema to a single schema for the region as well as to project the data into Web Mercator Auxiliary Sphere, which allows for integration with external web services such as ArcGIS Online. Read more of this post

GIS-based Sign Inventory Solution

We are underway building a repeatable solutions framework that complies with the Federal Highway Administration (FHWA) retroreflectivity mandated standards.  The solution establishes the means to improve the nighttime visibility of traffic signs to promote safety, enhance traffic operations and facility comfort and convenience for all drivers of all ages and abilities.  Benefits include:

  • Asset management
  • Safety
  • Life cycle analysis
  • Tort liability

The GIS-based Sign Inventory Solution is a mobile and web enabled framework built on ESRI ArcGIS Server-based that is a repeatable framework for other cities and counties looking for a system to support the FHWA retroreflectivity standards.  GISi is using the ArcGIS Mobile SDK to develop a mobile sign inventory application to run on mobile data collection devices.  Field users can make changes to the sign inventory at or near real time if cellular connections are available or when field users return from the field and place the unit into a networked docking station (or gain access to the network via a wireless hotspot).  The GIS-based sign inventory system is managed using a Flex API administrative dashboard.  The GIS-based sign inventory system uses the ESRI ArcGIS Server Enterprise Advanced framework. Read more of this post

Follow

Get every new post delivered to your Inbox.