Thursday, October 17, 2013

Lab 4: ArcGIS Flex API

Introduction:
For this lab we focused on using the Adobe Flash Builder (4.6) to write scripts. The language used for all scripts was MXML.

Methods:

The most important step in the lab was done in the first steps of starting a new flex project. When a new Flex project is create a window is opened with three tabs: project location, server settings, and build paths.

The project location lets you name your project, designate a folder location, pick your application type, and your flex version. For this lab the 'web' application type and Flex version '4.6.0' were used. We left the server settings alone, but the 'build paths' tab was a crucial part of the lab. This was where we browsed our local network drive to retrieve the 'Flex API' library. Without this library the reference words in the code would have no meaning and the script would be useless. To add a library we clicked on the 'add SWC' button and browsed the local network for the folder. Once added the library appeared in the 'build path libaries' box, found in the 'library path' tab of the flex builder path window.

After the code was successfully written for each individual layer, the corresponding icon would appear in the outline menu in the lower left hand corner (default location) of the flex builder application.

The first script, shown in figure 1 below, was a map of population density for the world in a Web Mercator projection.


Figure 1, script for world map of population density.


The next script we created was a map of the united states with pop-up enabled features which were the result of the action script we wrote within the code block.

The last map created used a pre-existing script for South Carolina with mouse over pop-ups for various population statistics. To edit the script to our purposes a few things had to be changed. First off, every time 'south carolina' appeared in the code, it had to be changed to 'wisconsin.' Also, since it is a map divided by counties, that number had to be changed to accurately reflect the number of counties within Wisconsin, 72 of them. Finally the viewer extent had to be changed so the application would know to focus on Wisconsin and not South Carolina. To find the extent the following website was used (http://help.arcgis.com/en/webapps/flexviewer/extenthelper/flexviewer_extenthelper.html). This was done by zooming in the Wisconsin at the proper scale and recording the numbers which defined the extent of the current map's position and scale.


Problems:

I encountered a few problems while working on this lab. The smallest problem was a general coding error that evaded me for quite some time. The next two errors stemmed from the same problem.

While I was working on the lab I was too focused on the instructions and I didn't organize the folders how I normally would with separate file folders in a hierarchy pattern. I had finished most of the lab and came back to work on it the next morning. However, when I went to look for the script in my "lab 4" folder it was not there. It was only after I restarted the lab that I realized the file was in a "bin-debug" folder. I had looked here already, but when I went to run the script it ran in an "ant" form and did not produce a map online successfully. Another problem that came from this was when I tried to make a new flex project. I would add the Flex API library to the project, but it would not show up in the left hand menu of Adobe Flex Builder. I'm still not sure the reason for this and it was at this point that I decided to restart the lab. Although it was a drain on time I planned to use for other projects, I feel I learned the Flex project builder much better and I understood the process of adding a reference library to the point where I would remember to do that again without prior instruction to do so.

Thursday, October 10, 2013

Lab 3: ArcGIS Flex Viewer

Introduction:

This lab used ArcGIS Flex Application Builder to create a web application, complete with basemaps, operational layers, widgets. Another important component to the lab was the use of Flex XML (extensible markup language) to create a custom widget.

Methods:

The ArcGIS Flex Application Builder was the tool used in creating the application. With a relatively straight forward interface, building the application was more intimidating than it was difficult. Although, to make a more concise application, the pop-ups had to be reconfigured. For the lab's purposes only a couple fields were left on and renamed for end user client clarity (example, POP2007_SQMI was changed to Population density).

The last component to the lab was to create a Thematic widget. To do this a Thematic widget with population density, housing units, and total population of the United States was used. Then in the widget settings the configuration was changed from 'states' to 'counties' and the extent was set to central Wisconsin.

Problems:

As I had never worked with the XML I had a tough time with the initial sections of the lab. In the ArcGIS Flex Application builder I was able to get my custom widget to show up, but an error #1085 kept showing up. After I noticed the path my data was stored in and the directions in the lab had a discrepancy I thought I fixed the XML file and thought all was well, but there was still an error. Upon further studying the configuration file I found more errors; such as, not closing off the string of code (</examplelayer>). My file still wasn't working, but after longer inspection I realized I had a spelling error on two lines of code with the same mistake. After that was fixed the widget worked well and there were no other problems.

Although it was frustrating, this helped me learn the layout of how an XML file looks much better than if I had just typed out everything properly the first time.

Thursday, October 3, 2013

Lab 2: Geospatial Web Services

Goal:
Successfully create and publish a geospatial web service using ArcGIS Online for Organizations and the ArcGIS server hosted by the Geography and Anthropology department here at UW-Eau Claire.

Methods:

Part 1:
The first task was to create a map on ArcGIS Online. To do this we had to download a zip file containing various feature classes for Wisconsin; such as, lakes, streams, the counties, cities, interstates, highways, etc. within Eau Claire.

Since we were not going to use all the feature classes for this first map we needed to sort the data. We did this in ArcMap by bringing in the counties, cities, interstates, and highways. Once all feature classes were in the map we compressed the map (send to- compressed (zipped) folder).

Once our folder was zipped we headed of to ArcGIS Online and added the zipped folder by browsing the local files. The only things that remained was to add a title, summary of the map, and give it the appropriate tags. Tags are important because they enable a client to search for relavant data. Below in figure 1 you can see the image of map created.


Figure 1.


Part 2:
The next task was more complex. Again we were trying to make a map and upload it to ArcGIS Online; however, this time the map was created using an Excel spread sheet with latitude and longitude data for fire occurences in Wisconsin 2004.

To make this map we had to open up an Excel file with data containing X- and Y-coordinate data, as well as fire occurence data. Before the data could be uploaded to ArcGIS Online, it had to be converted to a CSV file (comma separated file). This was simply done by going to 'save as' then in the drop down menu for 'file type,' the .xlsx had to be changed to .csv.

The next step was important. When uploading the data to ArcGIS Online you had to click the reticule for loacating features using 'Latitude/Longitude.' In this same menu there was the field names, field types, and location fields for your .csv file. The 'POINT_X' row needed to be changed to longitude, and the 'POINT_Y' to latitude. After this was done, the map needed to be more user friendly. To change the map we had to go to the legend and click the "configure Pop-up." This brought up fields for OBJECT_ID, FIREDATE, FIRE_YR, POINT_Y, POINT_X, and FID. For this assignment we only wanted the firedate to show up, so we unchecked all the boxes leaving only the firedate. This made it so the feature service would only show the fire occurence date for each location when clicked on in the map. The results from the .csv file can be seen in figure 2.



Figure 2.