Google Maps Integration
In order to create an application like this, polygon KML data is required to define the overlay shapes. In this case, the KML was taken from publicly hosted code from Google. But if a custom map is needed, someone would have to build or buy the polygon mappings. This polygon information was then added in a table (in an arcplan internal database) along with the corresponding state name. A second table was created containing the state names and their corresponding data values. Since not every state has data values, the ones that do had to be matched up with the polygon data describing that state.
The top left object is a column containing all of the states with polygon information. The row object next to it contains measure names from the internal database and is used to find the data values for each state. The next column contains the KML for each state, followed by a column containing the selected measure. This measure is used to determine if a state is above or below a certain threshold and what color to fill the overlay with. The table on the top right shows the data values in a form that can be embedded into the KML. For each value, it must be wrapped in a Data element in the following format.
<Data name='MeasureName'> <value>SomeNumber</value> </Data>
Notice that this is only done for states that have data values. The column object on the bottom left uses the ColumnsToText() formula to concatenate all of the formatted data values into a single line. The KML Style Definition column determines the style of the state. It looks at the Selected Measure column and determines if it is higher, lower, or in between the user defined thresholds and displays "#HighData", "#LowData", or "#MiddleData". If there is no data for that state, it returns "#NoData" instead. This tag gets used by Google Maps to render the style of each state. The Placemark Element Column combines all of the state specific information into a single element, to be placed in the KML. The format for Placement elements is as follows.
For states that have no data values, just leave out the Extended Data element. The KML Header is a text object that contains the following header.
This header mostly contains the style information referenced in the Style Definition column. Here, those tags are defined to make the states a specific color and transparency. The color values are Hex codes in the order Alpha (7F), Blue (00), Green (AA), and Red (FF) to make 7F00AAFF. Last, the KML header is concatenated with a ColumnsToText() of the Placemark elements and the closing tags ("</Document></KML>").
Sending to Google Maps
Now that we have the complete KML, we need to make it available for Google Maps to download. There is an export button that exports the KML into a file in the web server directory located at C:\inetpub\wwwroot\GoogleMaps\. The filename is always "SessionID-Date-Time.kml" in order to make each request unique. This level of uniqueness is required because users can make multiple requests in the same session on the same day. If a user switches a menu, such as the products filter, a new KML file is generated and must be loaded by Google.