Thursday, October 17, 2013

GEOG.455 LAB 4 ArcGIS Flex API


Goal and Background

This lab is an introduction to using ArcGIS Flex application programming interface for developing Web GIS applications. With proper knowledge, the Flex API can be used to develop custom widgets for applications built with the Flex Application Builder.

Methods

The beginning of this lab deals with adding maps and layers through the Flex API. Once a new Flex project has been created in Adobe Flash Builder, we can then add the Flex API library. Currently, our Flex project is blank, but in order for map components to operate, we need to reference the ArcGIS Flex API that contains all the data required for the application.

In order to display geographic information in our new application we will use a web map. The Flex API provides us with a user interface map component that lets us display content by working with layers that reference web services, preconfigured web maps, or personal on-premise ArcGIS portals. In order to add a map user interface component to the project, we will work with a markup language called MXML.

The following set of code exists to reference the ArcGIS API for Flex library.


Once the reference is added to the markup we can begin to add map components to the application’s user interface. The first component we will construct will act as a placeholder for content later in the lab. The red text in the screenshot below represents this placeholder.




Finally, we will add two map components to the code. The two components include an ArcGIS Tiled Map Service Layer and an ArcGIS Dynamic Map Service Layer. The components are represented below in red text.





After all permutations and additions, the final code is displayed below.





Any errors will appear as red exclamation marks on the left side of the editor screen and will need to be adjusted in  order for the code to run properly. After running this code, the new application will open in a web browser.




The second part of this lab focuses on adding a web map to a Flex application. After referencing the Flex library and namespace, ActionScript can be added to the code in order to access and display a web map by its unique identification number. The code below contains the script which will display the web map. The long red code is the identification number. This code can be replaced by any other identification number from an ArcGIS Online web map url.





Next we will add a declaration. This code will declare the non-default and non-visual properties of the web map function that we entered in the script earlier.





The last component that we will add to this application is a title, which can be found in the code below.





The finished application will display an interactive map of the United States with pop-up information for each county.





In Part 3 of the lab, a pre-written code was opened that launched a web map application for the state of South Carolina. In order to customize the Event Handler graphic listener to display the state of Wisconsin, all that needs to be done is editing every instance of “South Carolina” to “Wisconsin”. After adjusting the zoom values, the web map application now displays data for Wisconsin instead of South Carolina.





Sources

No comments:

Post a Comment