The Flex API for ArcGIS remains one of the best for developing Web based GIS applications. Read on in this interesting "how to" article to help get you up and running and developing custom web solutions with Esri’s Flex API
The API provides the base for building highly customised applications. ESRI have also made available the Flex 2.2 viewer which provides a quick and easy way to stand up a fully functioning Flex ArcGIS application. It comes with a number of pre-built widgets or tools. Many are provided by the user community.
But sometimes an ArcGIS custom Flex solution is what clients require. A solution which is lightweight and flexible. The ESRI 2.2 Flex viewer in these cases may not be the best solution. Here we provide discussion and code download for a custom Flex ArcGIS viewer.
A demo is available here. The code is available for download here
Flex ArcGIS Solution
The ESRI Flex 2.2 viewer is an excellent solution for clients who require a low cost out of the box Web GIS solution fast. But there are drawback. Developers find the organisation of the viewer somewhat challenging. Adding and extending components can be sometimes quite an effort. Styling the viewer is not easy. It is also usually quite obvious that an application is built on the viewer.
Figure 1 – Flex ArcGIS Map Demo
We decided to investigate building a new lightweight custom Flex ArcGIS viewer. Our goals were:
1. To use an Model View Controller (MVC) as the base pattern for the template. This helps organise and gives structure to the application. So programmers find it easier to work with and extend.
2. Decouple the components and thus allow for a modular design. Whereby new components or tools can be added and/or combined with those already existing.
3. Give clients maximum editing and styling flexibility. Thus controlling users access to tools (print, search, layers etc), which layers or endpoints to load, titles, logos and the styling of all components. We planned to allow all these to be changed by clients without the need to recompile the application.
Map Interaction
In a previous blog post, I discuss the principals behind the map interaction of the demo. The goal is to make only one tool available at any one time, and to not litter the screen with pop ups. Thus open pop ups are minimised when another is opened, functionality is temporarily suspended. The minimised pop ups are grouped together to the bottom right of the screen.
Figure 2 – Flex ArcGIS Map Demo – Minimised Pop Ups
Basemaps and Layers
Basemaps and layers are listed, and can be altered, in the layers pop up. As Figure 3 below shows, satellite and map (streets) basemaps are available. The map layers are listed lower down.
Figure 3 – Flex ArcGIS Map Demo – Layers Pop Up
Tools
The header bar is easy to customise by clients. So the text in the header and subheader, logo and colour can be changed via a configuration file. It is also easy to change the header bar to fit specific client requirements.
Figure 4 – Flex ArcGIS Map Demo – Header
The available tools are listed in the centre of the header bar. Currently available are full extent, layers, print, help and parcel search. We have included the ESRI license file in the application. Both the print and parcel search tools are modified versions from those in the existing ESRI template.
Not only does this tool print in portrait and landscape orientation, it generates a PDF and allows users to preview before printing.
Figure 5 – Flex ArcGIS Map Demo – Print Tool
Parcel Search
This tool allows users to search for parcels by owner name, address and pin. It also provides a graphical search option; allowing the selection of single or multiple parcels. Selecting a listed search result highlights this parcel. Mouse over the highlighted area and a pop up provides more parcel information.
Figure 5 – Flex ArcGIS Map Demo – Parcel Search Tool
Client Editing and Styling
We are using two files to style and configure the application. The first, shown in Figure 11 below, is a style sheet.
Figure 10 – Flex ArcGIS Map Demo Style
The second, shown in Figure 12 below, is config.xml.
Figure 11 – Flex ArcGIS Map Demo Config
Both are easily edited by clients, and allow the application to be customised to clients satisfaction.
Summary
ESRI have provided an excellent Flex API for ArcGIS. Clients often require their ArcGIS Flex applications to be built quickly, and cheaply. They also want to be able to easily customise and extend the application. The ESRI Flex template, though providing some excellent tools, is sometimes hard to work with for developers, and not easy to customise. The template described above overcomes some of current weaknesses of the ESRI Flex template. It will appeal to clients who:
- Would like to quickly and cheaply stand up a Flex ArcGIS Web application
- Want to easily configure and style the application
- Intend to add custom tools to a solid Flex ArcGIS Web application base
- Are looking to upgrade from an existing ArcIMS base application
- Find their current Web GIS application performing slowly
We think this application provides a robust, extremely flexible base for Flex ArcGIS development. Contact us at webmapsolutions@gmail.com for more more information.
Related Resources
See more at http://www.webmapsolutions.com
Rory Biggadike is a Geospatial Developer with WebMapSolutions.com