Skip To Content

GeoRSS Layer

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:esri="http://www.esri.com/2008/ags"
               pageTitle="Using GeoRSSLayer">
    <!--
    Description:
    This sample demonstrates how to use the GeoRSSLayer as an operational
    layer in your ArcGIS API for Flex application.  The sample uses
    a georss feed from the NOAA National Weather Service Pacific
    Region Headquarters website that contains tsunami warnings for the
    Pacific Ocean.

    Feed provided by NOAA, NWS Pacific Region Headquarters
    http://www.nws.noaa.gov/rss/
    http://ptwc.weather.gov/feeds/ptwc_rss_pacific.xml

    Documentation:
    For more information, see the API documentation.
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/Map.html
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/Map.html#center
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/Map.html#level
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/components/ContentNavigator.html
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/components/ContentNavigator.html#style:headerColor
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/components/ContentNavigator.html#style:headerBackgroundColor
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/components/supportClasses/InfoWindow.html#style:backgroundColor
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/components/supportClasses/InfoWindow.html#style:shadowAlpha
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/components/supportClasses/InfoWindow.html#style:shadowDistance
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/events/LayerEvent.html
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/geometry/WebMercatorMapPoint.html
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/layers/ArcGISTiledMapServiceLayer.html
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/layers/FeatureLayer.html
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/layers/GeoRSSLayer.html
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/layers/Layer.html#attributionVisible
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/layers/Layer.html#copyright
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/layers/Layer.html#event:load
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/layers/Layer.html#event:loadError
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/renderers/SimpleRenderer.html
    https://developers.arcgis.com/en/flex/api-reference/com/esri/ags/symbols/PictureMarkerSymbol.html

    http://resources.arcgis.com/en/help/flex-api/concepts/index.html#/Types_of_layers/017p00000027000000/
    -->

    <fx:Style>
        @namespace esri "http://www.esri.com/2008/ags";

        esri|InfoWindow
        {
            backgroundColor: #2962A9;
            shadowAlpha: 0.5;
            shadowDistance: 10;
        }

        esri|ContentNavigator
        {
            chromeColor: #2962A9;
            color: #FFFFFF;
            headerColor: #FFFFFF;
            headerBackgroundColor: #2962A9;
        }
    </fx:Style>

    <fx:Script>
        <![CDATA[
            import com.esri.ags.events.LayerEvent;

            import mx.controls.Alert;

            protected function geoRSSLayer_loadErrorHandler(event:LayerEvent):void
            {
                Alert.show("Error: " + event.fault.faultString, "Error code: " + event.fault.faultCode);
            }
        ]]>
    </fx:Script>

    <fx:Declarations>
        <esri:PictureMarkerSymbol id="tsunamiPMS"
                                  width="32" height="32"
                                  source="@Embed(source='assets/i_tsunami.png')"
                                  xoffset="2"
                                  yoffset="16"/>
    </fx:Declarations>

    <s:controlBarContent>
        <s:RichText width="100%">
            This sample demonstrates how to use the GeoRSSLayer as an operational
            layer in your ArcGIS API for Flex application.  The sample uses
            a georss feed from the NOAA National Weather Service Pacific
            Region Headquarters website that contains tsunami warnings for the
            Pacific Ocean.
        </s:RichText>
    </s:controlBarContent>

    <esri:Map id="map"
              level="2"
              wrapAround180="true">
        <esri:center>
            <esri:WebMercatorMapPoint lon="-171.009636" lat="27.355359"/>
        </esri:center>
        <esri:ArcGISTiledMapServiceLayer url="http://services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer"/>
        <esri:ArcGISTiledMapServiceLayer url="http://services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer"/>
        <esri:GeoRSSLayer id="geoRSSLayer"
                          copyright="NOAA, NWS, Pacific Region Headquarters"
                          loadError="geoRSSLayer_loadErrorHandler(event)"
                          pointSymbol="{tsunamiPMS}"
                          url="https://developers.arcgis.com/flex/sample-code/assets/ptwc_rss_pacific.xml"/>
    </esri:Map>

    <s:BorderContainer width="150"
                       right="30" bottom="60"
                       backgroundColor="0x2962A9"
                       borderColor="0xFFFFFF"
                       borderWeight="2"
                       buttonMode="true"
                       click="navigateToURL(new URLRequest('http://www.prh.noaa.gov'), '_blank')"
                       cornerRadius="5">
        <s:layout>
            <s:VerticalLayout gap="10"
                              paddingBottom="7"
                              paddingLeft="10"
                              paddingRight="10"
                              paddingTop="7"/>
        </s:layout>
        <s:Label width="100%"
                 color="0xFFFFFF"
                 fontWeight="bold"
                 text="Tsunami warnings and information provided by NOAA, NWS"/>
    </s:BorderContainer>
</s:Application>