Create a GeoRSS Feed in .NET

Last week, I was working on a small team project that leveraged ESRI’s ArcGIS Viewer for Silverlight. We wanted to plot points on the map using latitude and longitude coordinates, something that the viewer supports natively through its GeoRSS widget; all we needed to do is provide a GeoRSS feed!

The RSS feed’s just an XML document, and GeoRSS is just a specific format for an RSS feed. So, it should be no problem to do. I hadn’t created an RSS feed before, so I started by Googling. I figured I’d end up building an XML document using Linq to XML and writing the contents to a page. It was even easier than that, though. The .NET Framework has RSS classes built right in!

Here’s a very simple example of how to create a GeoRSS feed in .NET by using the Rss20FeedFormatter class:

public Rss20FeedFormatter GetItems()
{
    var feed = new SyndicationFeed(
        “My GeoRSS Feed”,
        “A silly little feed”,
        new Uri(“https://adamprescott.net/georss”));

    var items = GetItemsFromDataSource();
    feed.Items = items.Select(
        x =>
        {
            var f = new SyndicationItem(x.Title, x.Description, x.Link, x.Id, DateTime.Now);
            f.PublishDate = x.PubDate;
            f.Summary = new TextSyndicationContent(x.Description);

            XNamespace geons = “http://www.w3.org/2003/01/geo/wgs84_pos#”;
            var lat = new XElement(geons + “lat”, x.Latitude);
            f.ElementExtensions.Add(new SyndicationElementExtension(lat));
            var lon = new XElement(geons + “long”, x.Longitude);
            f.ElementExtensions.Add(new SyndicationElementExtension(lon));
            return f;
        });

    return new Rss20FeedFormatter(feed);
}

Taking it one step further, we needed to host our feed and make it accessible via a web service call.

So, we created an interface…

[ServiceContract]
public interface IRssFeed
{
    [OperationContract]
    [WebGet]
    Rss20FeedFormatter GetItems();
}

And created a new WCF endpoint in our web.config (did I mention this was an ASP.NET application?)…

<system.serviceModel>
  <behaviors>
    <endpointBehaviors>
      <behavior name=“webHttpBehavior”>
        <webHttp />
      </behavior>
    </endpointBehaviors>
  </behaviors>
  <services>
    <service name=“adamprescott.net.GeoRSS.MyItemsFeed”>
      <endpoint binding=“webHttpBinding”
				behaviorConfiguration=“webHttpBehavior”
				contract=“adamprescott.net.GeoRSS.IRssFeed” />
    </service>
  </services>
</system.serviceModel>

And voila–we were done! Browsing to “http://ourserver/ourapplication/MyItemsFeed/GetItems&#8221; gave us our valid GeoRSS feed, and we fed that to our ArcGIS Viewer to plot the points. It all worked swimmingly!

Co-Branded Employees

Last week, the Wall Street Journal posted an article titled “Your Employee Is an Online Celebrity. Now What Do You Do?” The article is about the pros and cons of “co-branded employees:” employees that actively build and maintain their own personal brand outside of work. The goal of the article is to shed light on this type of employee and present some of the potential advantages and disadvantages.

The article begins with the following statement: “meet your newest management headache: the co-branded employee.”

That’s a pretty harsh introduction, but the rest of the article isn’t quite so negative. It’s actually part cautionary and part risk assessment. Several valid concerns are brought forth, such as How much time during the workday should be allocated or permitted? andWho owns the content? There’s also a “balance sheet” that compares several advantages and disadvantages.

Advantages:

  • Prestige – The company can claim the top-ranked employee as their own
  • Leads – By engaging publicly, the employee is potentially attracting new customers
  • Free media – A large following can equate to free or inexpensive publicity for the company
  • Recruitment – The employee will attract other, aspiring minds

Disadvantages:

  • Prima donnas – Popularity can lead to inflated egos and expectations
  • Distraction – The employee may dedicate a wrongly proportional amount of time to their extra-curricular activity
  • Leaks – Internal details may be deliberately or accidentally become “less internal”
  • Resentment – The employee’s popularity or reputation could negatively affect the team

These potential risks and rewards are part of a short list that could clearly be much longer. I started blogging to track things that I’ve learned and figured out, and it’s evolved into a hobby that doubles as a profession-growth mechanism.

Does it take time out of my day? Sure. A lot of things that I learn and write about are directly related to what I’m doing at work. There’s probably an argument to be made that tasks take me longer to complete because of my blogging. After all, I’d be done sooner if I didn’t have to scrub out customer-related info and write several paragraphs about why I was doing something and how I ultimately accomplished it.

The flip-side to that is that the quality of my solutions is improved by the additional diligence that comes along with my desire to write. I don’t stop when it works. I go deeper; I want to understand why it works, what’s necessary, and what’s not. Then, I take all of that information, condense and simplify it into a blog post. That post becomes my own, searchable repository of lessons learned. If somebody on my team is faced with a similar task, I can send ’em a link. They get an abbreviated version of the journey with a (hopefully) clean, concise  solution.

I can only speak in terms of my own experience, but I’d certainly argue that activities like this are a win-win. My online presence, and the desire to grow it, result in an expansion of my horizons. I get personal satisfaction from learning and exploring new topics. The knowledge gained through these exercises allows me to think outside the box when solutions are needed. I’m more well-rounded because of it, and I’m more capable of supporting and providing guidance to my team on solutions old and new, alike.

Office 2013 RTM

I’d been using Office 2013 Preview since August, and, while there have been hiccups here and there, I’ve been very happy with it. Last week, the RTM version was released to MSDN subscribers. (I think it will not reach general availability until Q1 2013.) I was excited to get my hands on it, so I downloaded and upgraded right away.

My only disappointment in the upgrade experience is that I couldn’t go directly from Preview to RTM, but that wasn’t completely unexpected. I uninstalled and installed the new version. Everything went smoothly.

I’ve been using it for a week now. I haven’t noticed any new features in the RTM version that weren’t in Preview, but there are a few “quirks” that have been fixed. The biggest bug that I’d been dealing with in Preview was in Excel: when you clicked a drop-down in a cell, the options would display in the upper-left corner instead of at the cell. This has been fixed in RTM. Another gripe I had in Preview was about the read-only, “Preview Mode” version of Word that opens when you open a Word document attachment from an email. This is still there, but pushing the ESC key takes it out of Preview Mode and back into the standard, edit view. So that’s good!

Everything else has felt really polished and very slick, and I haven’t seen anything that I’ve perceived as a bug, flaw, or unintentional.

I’m definitely loving the new version!