Thursday, October 17, 2013

ArcGIS Flex API With Adobe Flash Builder



Introduction:
ArcGIS Flex API is very useful in creating a web map application, and with such a useful program it is important to learn to use the best way to create applications. To utilize the ArcGIS Flex API most effectively this lab will teach how to make use of Adobe Flash Builder. With Adobe Flash one can import the tools and maps available for use in ArcGIS Flex API and create the entire application with a block of computer programming code. In this lab there will be multiple maps made using Adobe Flash, the programming code will be written and run to create the maps.

Methods:
Creating a new Flex project within Adobe Flash Builder was the first step of the lab. The Flex project was created to include the Flex API library, this is done to have the program and application recognize esri’s JavaScript codes that enable the Flex project to run their scripts and produce the specified outcome. The next step, after adding the Flex API library, was to write the computer programming code that was provided by the professor. When the programming code was completed it was run in order to check for errors.


For part two of the lab the goal was to add a previously created Web Map from ArcGIS Online. To begin a new Flex project was created with the Flex API library included, after creation the programming code writing began. For this Flex project there was script code included that can call upon a previously made public map from ArcGIS Online that was outlined by our professor.

The second section of the lab was there to teach how to add and display the Web Map that I created in a previous lab. To do so it was necessary to open the previously created map in ArcGIS Online and copy and paste the ID from the URL. This ID is used as a reference for the script to call upon that specific map for displaying. Here is the code updated from the previous part of the lab.

In the last part of the lab we were instructed to customize a mouse-over application that was developed for South Carolina and apply it to Wisconsin. The code was provided for use from the professor once again and placed into another new Adobe Flex project. The code was copied from its Notepad++ folder into the new Flex project and edited to display a map of Wisconsin with the mouse-over pop-ups. It was important to take note of the changes that needed to be made to the original code, first the zoom to code block was changed from the spatial boundaries of South Carolina to Wisconsin. Next the data called upon was focused to Wisconsin from the previous state, and after that the map was made to load immediately to the state of Wisconsin.




Results:
There were a handful of maps created and adjusted in this lab, the first being the basic population density map created from the first Flex project.

This map was made with a tiled, usually raster, service, as a result there are no pop-ups or clickable information. But still, it is very interesting to see the final result of the population density across the globe.
Secondly there was a map made using an old ArcGIS Online map ID as a reference. This was easy once the code was working for the first step, we then replaced the original reference map ID with the map we created in an earlier lab.

Lastly, I made the Wisconsin map with the mouse-over widget added on. To do so each reference within the script to South Carolina had to be changed to Wisconsin. After one try I was able to catch all the issues and have the entire Flex project focus on the state of Wisconsin for the map.

To say that writing computer programming code is easy is a blatant understatement. Working with programming code is a very meticulous task, every piece of code has to be specific and perfectly written, or else you will get errors. At times I would get constant errors that I wouldn’t be seeing, and as a result I would need to start my entire code over again. But this helps the programmer recognize the importance of clean code, and once the code is complete, how satisfying it is to see the final product of the work put in.

Thursday, October 10, 2013

ArcGIS Flex Viewer

Introduction: 
                With ArcGIS Online a familiar tool, complements to the previous lab, there was a new lab created and finished to further accommodate the user with the concept of Web GIS. The second lab consisted of an exercise to introduce an extensive platform for creating Web GIS applications, ArcGIS Flex Viewer. The main goal of the lab was to teach how to configure ArcGIS Flex Application Builder to create web applications, and to also help find a GIS service and use data for analytical services in creating that Web GIS application. The structure of Flex XML (extensible markup language) was also introduced for the creation and editing of configuration files within the ArcGIS Flex Application Builder. By the end of the lab the user should be familiar with, and able to customize ArcGIS for Flex Application Builder and also be able to configure custom widgets using programming code.

Methods:
                This lab began with creating a new application on ArcGIS Viewer for Flex to help the user understand how to add basemaps, operational layers, and how to configure pop-ups. When the application was created the first step was to add the basemap, the basemaps can be selected from ArcGIS Online, ArcGIS Server, or from the web. After selecting the streets basemap from ArcGIS online the operational layer was added to the application. It was obtained from one of the ArcGIS REST Servers which is an open web interface to host GIS services published on ArcGIS Server, they can be accessed by using the specific URL for each server type. We used services from Sample Server 1 (http://sampleserver1.arcgisonline.com/ArcGIS/rest/services) to access this server it was entered in the search bar under the ArcGIS Server tab in the Operational Layers window. The URL for Sample Server 1 was entered in the search bar and the Census Block Points feature layer was selected for addition to the application. When a feature layer is added to the application the user can edit its configuration, this was done to the Census Block Points layer so it would reveal a pop-up containing attribute data specific to the census block when clicked on. The attributes of POP2000 (population), HOUSEHOLDs, and HSE_UNITS (housing units) were chosen to be displayed within the pop-up on the map.
                After setting the pop-up configuration for the census block data, ArcGIS Flex Application Builder allows the user to set the map extent so when the map is opened in a browser it is set immediately to that resolution. When the map extent is set the user can then move to the design section of the application where a logo can be added and title, fonts, and colors can be changed. With the final design touches finished up the map application can be previewed and then saved for online use.
                The second section of the lab was directed at exploring the functionality of some of the widgets available for use on the application.  The exploration began with the Draw and Locator widgets from the predefined widgets menu bar within the ArcGIS Flex Application Builder window. The widget known as Draw gives the opportunity to draw various items on the map screen, such as lines, rectangles or various polygons. A handy aspect of the Draw widget is that once a figure is drawn, the widget can show the area or distance that figure covers, so a user could measure the length of a road segment. The Locator widget is rather similar to searching for addresses on Google Maps, as the user types in an address it responds with a number of addresses that match the search along with a matching score out of 100. This widget can give the user a very accurate estimate of where the address is that they searched for.
                The final part of the lab was to configure ArcGIS Flex Application Builder XML files for the creation of a new widget. Flex is built around MXML and ActionScript languages these languages give a computer programmer the ability to develop rich internet applications with select programs. They are mainly used in coalition to lay out the interface of applications and create application behaviors on the internet. This section of the lab demonstrated how to reference services through a Flex Application configuration file and how to add custom widgets to an application.
                The widget to be configured to work within ArcGIS Flex Application Builder was called ChartM, this widget would give the user the capability to draw a shape, using the basics of the draw tool, to select multiple items on the map application and return a chart of the selected items attributes. The widget need an XML file that would call upon its capabilities when activated within the map application, that XML file can be written using Notepad++. The XML code was provided by the Professor and re-typed into a new file created by the user, this file was then referenced to within the universal widget configuration file. Once written and implemented, the widget was available for use within ArcGIS Flex Application Builder.
                The final part of the lab was to add and configure a provided widget to a new map application. This widget was capable of showing thematic layers on a map. To add the widget into ArcGIS Flex Application Builder it needed to be imported through the settings tab. When the settings are shown the advanced settings were clicked and opened and then the ability to manage custom widgets is available. Within the Manage Custom Widgets window the user can add a new widget available for use within an application. Configuring the new Thematic widget is rather simple, the settings need to be available to edit, and once there the user can edit the classifications as they wish. This was done for the demographic dataset found through a provided ArcGIS Server.

Results: (Links to webmaps are unavailable for non-users until further notice)
                The first part of the lab resulted in a map of Eau Claire Block populations.
Figure 2-1. This screen shot shows the pop-up window with the dot map in Eau Claire, WI.
                This map application was a good way to introduce the functionalities of ArcGIS Flex Application Builder. The steps in creating a map application make the opportunities for the final product close to unlimited.
In part two of the lab it was required to build a custom web mapping application. I built a web application showing the Atlantic Hurricanes of 2000.

Figure 2-2. Screen shot of the hurricane tracks in the Atlantic Ocean in 2000.
                This data was obtained from http://sampleserver6.arcgisonline.com/ArcGIS/rest/services it was relatively easy to work with, the only necessary steps were to edit the pop-up windows and give it two widgets that were not previously used. I decide to use the legend widget so a viewer can see what the items are that they are looking at while viewing the map application.
For part three of the lab we added in the provided widget to the Eau Claire Block Populations map. 
Figure 2-3. Notice the bar chart on the left side showing data from the selection.
                The XML coding was difficult to grasp at first, but our professor provided us with a preview of what the code should look like, so was simpler to find the errors I made and correct them to have a working widget. The final product gave a good bar graph of the selected block groups, within the XML file the user can also configure the result of the selection to return a pie chart.
                The last part of the lab consisted of adding in the Thematic widget to ArcGIS Flex Application Builder and then creating a demographic map to display the population in western Wisconsin counties. 

Figure 2-4. Screenshot of the Thematic widget in action, see the different classification schemes available in the dialog box.
                The widget configuration was a bit painstaking, however the final product was very fascinating to interact with. Within the Thematic widget settings it was necessary to change the <classificationlayerName>, <classificationlayerID>, <classificationFieldTypeDesc>,<classificationFieldType> all to the proper values and descriptions for the widget to work properly. They started as details for the states when we were assigned to use it for counties. Our professor gave us the required changes to make and once done the widget worked properly to our requests.

Sources:
ArcGIS Server Online
Provided and Processed by Dr. C. Wilson. 2012.

Thursday, October 3, 2013

Geospatial Web Services



Introduction:
                Learning how to publish geospatial files and services is an integral part of the steps in being a potential GIS Analyst, with the ability to publish a GIS user can be independent in their web GIS projects. The purpose of this lab exercise was to introduce the processing of geospatial data in order to successfully create and import that data onto a geospatial web service. The geospatial web service that was available for use was ArcGIS Online for Organizations through ArcGIS server, which has a server hosted by the department of Geography and Anthropology at the University of Wisconsin – Eau Claire (UWEC). The completed lab introduced various techniques in which geospatial files such as a shapefile, Excel CSV file, ArcMap, and others, can be published through ArcGIS Desktop or downloaded into ArcGIS Online.

Methods:
                The first portion of the lab was learning how to publish feature hosted services through ArcGIS Online. To do so the data was obtained from the class folder and opened up in ArcMap. The features added to the map were cities, interstates, highways, and county boundaries all from the state of Wisconsin. The shapefiles can now be exported to the user account on ArcGIS online, to do so they need to be compressed into a zip file, ArcGIS Online can import shapefiles easily from zip files. Once logged into ArcGIS Online and on the My Content screen the zip file was imported and readily available for use, and the shapefiles can be downloaded onto other computers.
                The next process in familiarizing with publishing GIS features through ArcGIS Online is creating a web-based map with the Wisconsin data that was just imported. The shapefiles imported to the ArcGIS Online account were added to a basemap and then adjusted to the cartographers desires. Once the map was completed it was published to a group, in the publishing screen the publisher can determine whether or not the map is made to be private, or open to the public.
                Section 3 of the lab consisted of publishing a feature to ArcGIS Online using a CSV file. CVS files are a file saved from Microsoft Excel in a CSV format for use in a GIS program. The data within the file usually consists of some sort of geospatial locator, for example x-y coordinates. The file to be imported was that of Wisconsin wildfires in 2004. The file was re-saved as a CSV file in Excel and then brought into ArcGIS Online. Once loaded into My Content the file has some formatting that needed to be addressed, the location fields needed to be assigned. As a result the x coordinates were used as the longitude, and the y coordinates were used as the latitude. Once published the file was edited so there would be a pop-up each time a reference location was clicked on, the pop up was configured to display information regarding the date of the fire. With the file loaded in properly and the pop-ups configured the file was ready to use for anyone who desired the information.
                Publishing a ArcMap to ArcGIS Online was the next section of the lab. To learn how to publish a map, the first step was creating that map. ArcMap was opened and the files containing water bodies in the state of Wisconsin was added, then the user signed into ArcGIS Online for Organizations to be able to share the map as a service. Publishing the map as a service makes it available to the public, or whoever is designated to see it, for whatever use is desired. When publishing a map it is important to include the item’s description, summary, tags for search engines, access and use of potential users, and credits to acknowledge the help received in making the map. Once the publisher finds the maps metadata suitable ArcMap Publisher has a beneficial tool called analyze that will search for any potential issues that could come into play once loaded into ArcGIS Online. When all errors that may have arisen from the publishing of the map are fixed, the map can be finalized and published to the online ArcGIS server.
                The last part of the lab was to learn to publish a tiled map service using ArcGIS Server. ArcMap contains a process that enables the user to connect to ArcGIS Server through the program itself. When the user logs in to the specified database and enters their credentials, they can add data to their workspace within the server. To do so the desired data is shared through the connection to ArcGIS Server. Once the server connection process begins there are a few steps to be completed; the data needs to go to the correct folder, it needs to have its caching properties in working fashion, and it needs to be analyzed for errors. For the caching properties there are many options, but for this lab the recommendation was to tile the map from a cache within the internet browser, also the scale had to be adjusted so the potential user wouldn’t zoom in, or out too far. Also the tiling format for displaying the map was adjusted from using PNG type images to Mixed, which I assume consisted of PNG, GIF and JPG images. When these caching properties were addressed the final analyzation was done and the service was published.

Results:
                The results I obtained from this lab were mostly useful for my knowledge rather than for display. However there are some portions in which there are images to be shown. For the first two portions of the lab there was a map that was made and saved to My Content in ArcGIS Online.
Figure 1-1. ArcGIS Online web map of Wisconsin's counties, cities, interstates, and highways.
The map above (Figure 1-1) shows the ArcGIS Online user interface when a map is opened. Within the contents one can edit and remove the shapefiles that are added to the map.
                For the adding of the CSV file there were no problems and the fire locations were added to the map accurately and efficiently.
Figure 1-2. CSV file of 2004 WI Wildfieres converted to points in ArcGIS Online
Figure 1-2 shows the fire locations marked by the orange symbols overlaying a topographic basemap provided by esri.
                Adding the water bodies of Wisconsin to My Content was a smooth process once again. With the proper login credentials for ArcServer and the help of the Analyze feature on the Service Editor, publishing the files to an online database was relatively easy. Once loaded into ArcGIS Online it was interesting to see the differences between the shapefile that was uploaded and the topographic basemap that was provided.
Figure 1-3. See the differences between water bodies on the basemap compared to the imported shapefiles.
As you can see in Figure 1-3 the imported file, dark blue lines, do not match up with the streams and rivers that are in the topographic basemap. Also the lake shapefile, light blue, does not exactly fit into the lake within the basemap. There will always be differences in shapefiles obtained from different sources, yet it is always interesting to compare and contrast them as one finds more sources to choose from.
                The last portion of the lab where a tiled map service was brought into ArcGIS Server was rather similar to the process of importing the water bodies shapefiles. However, this time we went through a database connection. The desired raster was uploaded into the online database and was then selected to be published as a service to a specified online server within the Geography department at UWEC. The process once again went swiftly with the proper credentials for authentication. With the  raster uploaded, it was then available to access with the proper server URL. Once located wihtin the server it was available to open via ArcGIS Online, ArcGIS Explorer, ArcMap, and even Google Earth. Here it is in ArcGIS Online:00
Figure 1-4. The imported raster of Land Use Land Cover for the Chippewa Valley


Sources:
Wisconsin Department of Natural Resources.
Environmental Science Research Institute, ArcMap USA geodatabase.

Rivers and streams - United States Geological Surveys (USGS), 2008.
Earth Resources Observation and Science Center (EROS). 2011.
Provided and Processed by Dr. C. Wilson. 2012.