RSS Weather layer


PurposeThis sample illustrates a real-life scenario for creating a new layer to consume a Web service and display the information in a map.

In this sample, you can find implementation of simple editing capabilities, selection by attribute and by location, persistence and identify.

If you intend to use the layer without using the existing AddRSSWeatherLayer command, you will have to manage the refreshes of the layer. You can do that by listening to OnWeatherItemAdded and OnWeatherItemsUpdated events or by using a timer to refresh the layer.

The issues covered by this sample are:
1. Implementation of a custom layer through inheritance of a BaseClass
2. Consuming Web services (Yahoo really simple syndication ( RSS) service)
3. Executing a lengthy ArcObjects task on a background thread
4. Sharing resources between multiple threads
5. Updating user interface (UI) components from a background thread to keep responsiveness.
6. Firing and wiring .NET events
7. Implementing Identify objects and displaying results in an Identify dialog box
8. Adding and managing property pages for an engine application
9. Adding new items to the layer

Development licensing Deployment licensing
Engine Developer Kit Engine Runtime
ArcView ArcView
ArcEditor ArcEditor
ArcInfo ArcInfo

Additional Requirements
  • This sample uses a dataset found under the data directory: USZipCodeData/ZipCode_Boundaries_US_Major_Cities.shp
  • This sample makes use of an assembly PropertyPages.dll (Extensible OLE Property Pages in .NET), which was written by Robert Simpson. For more information, see http://www.codeguru.com/cpp/controls/propertysheet/propertysheetbuttons/article.php/c8545.

How to use

See Using the samples for help on compiling, setting up the debugger, and running the sample (either an exe or dll).

  1. Open the solution using Visual Studio
  2. Build the solution
  3. Open a MapControl application or ArcMap
  4. From the toolbars list, select the RSS Weather layer toolbar to add it to the application.
  5. Click Load Layer to connect to the RSS weather service.

RSSWeatherLayerClass.cs Implementation file of the custom layer
RSSWeatherIdentifyObject.cs Implementation file of IIdentifyObject required to support standard identification
IdentifyDlg.cs The Identify dialog box used by the Identify object
AddRSSWeatherLayer.cs The command that connects and disconnects the layer from RSS Web service
SelectByCityName.cs Allows selection of weather items by selection from a list according to the city name
WeatherItemSelectionDlg.cs Selection dialog box for SelectByCityName command
WeatherLayerToolbar.cs The toolbar that hosts the layer's commands and tools
AddWeatherItemCmd.cs A command that allows adding weather item by a given ZIP Code
AddWeatherItemTool.cs A tool that allows adding weather items by clicking the map
ZipCodeDlg.cs The dialog box that users type a ZIP Code to add new weather items
PropertySheet.cs User control serving as a property sheet for the layer's properties
RSSLayerProps.cs Property page showing information retrieved from the layer (list of city names for all weather items)
RSSLayerProps2.cs Property page for controlling the layer's symbol size
RSSLayerProperties.cs Command that opens the layer's property page
CustomLayerBase.cs Abstract base class implementing essential interfaces required to implement an ArcGIS layer
Download the C# files
RSSWeatherLayerClass.vb Implementation file of the custom layer
RSSWeatherIdentifyObject.vb Implementation file of IIdentifyObject required to support standard identification
IdentifyDlg.vb The Identify dialog box used by the Identify object
AddRSSWeatherLayer.vb The command that connects and disconnects the layer from RSS Web service
SelectByCityName.vb Allows selection of weather items by selection from a list according to the city name
WeatherItemSelectionDlg.vb Selection dialog box for SelectByCityName command
WeatherLayerToolbar.vb The toolbar that hosts the layer's commands and tools
AddWeatherItemCmd.vb A command that allows adding weather item by a given ZIP Code
AddWeatherItemTool.vb A tool that allows adding weather items by clicking the map
ZipCodeDlg.vb The dialog box that users type a ZIP Code to add new weather items
PropertySheet.vb User control serving as a property sheet for the layer's properties
RSSLayerProps.vb Property page showing information retrieved from the layer (list of city names for all weather items)
RSSLayerProps2.vb Property page for controlling the layer's symbol size
RSSLayerProperties.vb Command that opens the layer's property page
CustomLayerBase.vb Abstract base class implementing essential interfaces required to implement an ArcGIS layer
Download the VB.NET files

Download the files for all languages

See Also:

Writing multithreaded ArcObjects code
How to wire ArcObjects .NET events