RSS weather layer


Purpose
This sample illustrates a real-life scenario for creating a new layer to consume a Web service and display the information in a map.
This sample shows implementation of the following:
  • Simple editing capabilities
  • Selection by attribute and location
  • Persistence
  • Identify

How to use

See How to use ArcGIS samples for help on compiling, setting up the debugger, and running the sample.

Data has been provided for your use with this sample. It can be found at <Your ArcGIS Developer Kit Install directory>/Samples/data/USZipCodeData/ZipCode_Boundaries_US_Major_Cities.shp.
If the sample has associated data, you will find that the sample's zip file includes a "data" folder alongside the language folders. However, you will need to update the sample to point to the location of the data once you have extracted all the files.

  1. Start Visual Studio, open the solution file, and build the project.
  2. Open a MapControl application or ArcMap.
  3. From the toolbars list, select the RSS Weather layer toolbar to add to the application.
  4. Click Load Layer to connect to the RSS weather service.

Additional information

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 the OnWeatherItemAdded and OnWeatherItemsUpdated events or by using a timer to refresh the layer.
The following items are covered in this sample:
  • Implementing a custom layer through inheritance of a BaseClass.
  • Consuming Web services (Yahoo really simple syndication [RSS] service).
  • Executing a lengthy ArcObjects task on a background thread.
  • Sharing resources between multiple threads.
  • Updating user interface (UI) components from a background thread to keep responsiveness.
  • Firing and wiring .NET events.
  • Implementing Identify objects and displaying the results in an Identify dialog box.
  • Adding and managing property pages for an Engine application.
  • Adding new items to the layer.


RSSWeatherLayerClass.cs Implementation file of the custom layer.
RSSWeatherIdentifyObject.cs Implementation file of IIdentifyObject required to support standard identification.
IdentifyDlg.cs Identify dialog box used by the Identify object.
AddRSSWeatherLayer.cs Command that connects and disconnects the layer from RSS Web service.
SelectByCityName.cs Allows selection of weather items from a list according to the city name.
WeatherItemSelectionDlg.cs Selection dialog box for the SelectByCityName command.
WeatherLayerToolbar.cs Toolbar that hosts the layer's commands and tools.
AddWeatherItemCmd.cs Command that allows adding weather items by a given ZIP Code.
AddWeatherItemTool.cs Tool that allows adding weather items by clicking the map.
ZipCodeDlg.cs Dialog box where 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 (a 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.
RefreshLayerCmd.cs Command that refreshes the 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 Identify dialog box used by the Identify object.
AddRSSWeatherLayer.vb Command that connects and disconnects the layer from RSS Web service.
SelectByCityName.vb Allows selection of weather items from a list according to the city name.
WeatherItemSelectionDlg.vb Selection dialog box for the SelectByCityName command.
WeatherLayerToolbar.vb Toolbar that hosts the layer's commands and tools.
AddWeatherItemCmd.vb Command that allows adding weather items by a given ZIP Code.
AddWeatherItemTool.vb Tool that allows adding weather items by clicking the map.
ZipCodeDlg.vb Dialog box where 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 (a 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.
RefreshLayerCmd.vb Command that refreshes the layer.
Download the VB.NET files

Download the files for all languages

See Also:

Writing multithreaded ArcObjects code
How to wire ArcObjects .NET events




Additional Requirements
  • 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.

Development licensing Deployment licensing
Engine Developer Kit Engine
ArcGIS for Desktop Basic ArcGIS for Desktop Basic
ArcGIS for Desktop Standard ArcGIS for Desktop Standard
ArcGIS for Desktop Advanced ArcGIS for Desktop Advanced