Rss 2.0 via FEED
Ken Hughes... - GPS
Productivity, Technology and Automating Everything...
    
 

InsertPanel I have just completed a new Windows Live Writer plugin. This extension allows ease insertion of geo microformat information.

It allows the user to easily choose the location they want to insert (in microformat) from a Virtual Earth map and also configure how it is displayed (if at all on the post.

Recently I (with considerable help from Alexander Groß) added GeoRss support for dasBlog. The co-ordinates can be specified when adding a post via the web interface. This plugin is stage two of this support, stage three will be parsing the geo microformat when a post is added and using that to populate the GeoRss info.

The end goal being to allow the geo info to be entered when creating a post in Writer and having that info available in GeoRss format in the feed.

I started this plugin with the view to using Google Maps, however they require that you get an API key and that key is only valid for a particular web site / URL path. This foiled my plans to embed the map in a Windows Forms WebBrowser control (I did look at producing an html page that was served from my web site, and using it embedded in the WebBrowser - not scaleable and too much configuration for a normal user to do.

InsertMicroformat 

I hadn't looked in depth at Virtual Earth, but recently went to MixUK:07 and saw a couple of demos / presentations on it - a quick look found that it didn't need a API and was not tied to a particular URL / path - the JavaScript for it is pretty similar to the one for Google Maps so learning curve was pretty short. The only issue I have with http://local.live.com is that there is no (currently) facility to enter a GeoRss feed in the search query and just display the data (the current method of displaying this kind of data is to embed a map in your own pages and use their API to display the items as a 'collection').

You can get the installer for it here InsertGeoFormatSetup.msi (325Kb).

GEO 51.4043243116043:-1.28760516643523
Posted: Saturday, September 15, 2007 11:12:11 PM (GMT Daylight Time, UTC+01:00)  #   Comments [5]
TAGS: .NET | ASP.NET | C Sharp | Dasblog | GPS | RSS | Web

I have completed stage one of GeoRss enabling dasBlog.

In the config page I added some options for enabling GeoRss, specifying a default lat/long and enabling ‘integration’ with Google maps. There is also an option to use the default lat/long for any non geocoded posts.

  clip_image0022_thumb1

If GeoRss is enabled then the edit entry screen provides textboxes to allow specifying lat/long (populated with defaults from config page).

clip_image00421_thumb2

If the google maps integration is enabled then you’ll get the ‘Show Map’ button and clicking it will display a map which you can move around until you find the location and then click on the location to get the lat/long texboxes populated.

clip_image00681_thumb1

If you have existing non geocoded posts then you can have the default lat/long added to those if you wish.

I puzzled around for ages when trying to display the georss in google (http://maps.google.com/maps?q=yourfeedaddress) – it kept telling me that the feed was invalid. I eventually found that feedburner was adding <atom10:link blah blah /> to the xml which for some reason google maps thinks is invalid. The only way I could find to prevent feedburner adding the atom link was to turn OFF the ‘Browser Friendly’ feature in feedburner.

So – stage 2...

The work I still want to do with this is basically to add macros to get lat/long  - fairly easy I guess, and then some way to specify lat/long from Windows Live Writer (and other offline blog clients) – a little more complex. Scott mentioned a geo microformat and from my initial looks seems to be a good route to take - watch this space...  

Now it is simply a case of retrofitting the geo info into all my old posts...

 

Posted: Saturday, September 08, 2007 10:33:40 PM (GMT Daylight Time, UTC+01:00)  #   Comments [0]
TAGS: .NET | ASP.NET | C Sharp | Dasblog | Development | GPS | RSS | Software

In the first version of my GPS Library software (written in VB6) I had a 'Protocol' property that indicated which protocol we were using (for example Garmin, Magellan, NMEA etc). Then, every time we needed to do something at the protocol layer (Sending or Receiving data) we had an if statement :

If gps.Protocol = GpsProtocol.Garmin Then
     ' Do it this way
EsleIf gps.Protocol = GpsProtocol.Magellan Then
     ' Do it that way
Else
     ' Do it the other way

Horrible and messy !! Adding a new protocol meant going back to every function and amending it.

In the new .NET version, it's much more object oriented and I've used a number of software design patterns.

To solve the above problem I used a Factory pattern. The Factory pattern allows you to create objects but let the client decide what type those objects should be. So, I can basically let the client set the Protocol property and then, depending on that setting create a different object for each protocol.

I start with a base class that all the 'codec' classes inherit from, then in the 'creation' (when the client creates the object) I look at the Protocol property and choose which concrete class to return:

GpsCodec is the base class and the concrete classes are GarminCodec, MagellanCodec etc. I have a static method in the base class called 'CreateCodec' that takes a 'Protocol' parameter. So it looks like this

public static GpsCodec CreateCodec(GpsProtocol protocol)
{
     switch (protocol)
     {
          case GpsProtocol.Garmin:
               return new GarminCodec();
               break;
          case GpsProtocol.Magellan:
               return new MagellanCodec();
               break;
          default:
               return null; // error
               break;
     }
}

So now I can simply create a codec class based on the Protocol property and use that for all the communication to / from the device. Adding a new protocol is simply a case of creating the new class and modifying the CreateCodec method - much simpler.

Watch this space for the free .NET GPS Library (including source).

Posted: Sunday, November 12, 2006 3:57:31 PM (GMT Standard Time, UTC+00:00)  #   Comments [0]
TAGS: .NET | C Sharp | Design Patterns | Development | GPS

In the first version of my GPS Library (written in VB6) I had a big horrible multiple nested if statement that handled the intelligence behind what to do when a new frame of data was received - if we were sending Waypoints to the GPS and the frame was an Acknowledgement (ACK) then we would send the next one, if it was a Not Acknowledgement (NACK) then we'd retransmit the last one - everything that happened depending on the current context (what we are currently doing). As there were about 20 different things we could be doing at the time and about 20 odd frame types, this was real messy and probably had a Cyclometric Complexity of 9292736592 (or more)...

My .NET version of the GPS Library makes extensive use of Software Design Patterns - to solve the problem above I used a 'State' pattern.

The State pattern is used where your software has multiple states and various actions or stimulations that make it change between states (but it is always going to be in one of the predefined states). I guess it a pretty common pattern for communication systems.

I have a base class called GpsState, that contains all an (overrideable) method for each action and stimulation and each method has a default implementation of something like

throw new Exception("Invalid action for state :" + this.StateName);

All the state classes inherit from this base state class.

Lets take (much simplified) sending Waypoints as the example:-

The GPS object has a reference to the current state class. This starts off in the stateIdle (doing nothing). We then call the stateIdle.WriteWaypoints() function. In this function we send the first Waypoint and change the state to stateWritingWaypoints.
The stateWritingWaypoints overrides the 'GotACK' method and provides it own implementation (which is simply to send the next Waypoint). If any of the other methods are called whilst in the stateWritingWaypoints then the implementation from the base class is called and the caller receives an exception.
When I've sent the last Waypoint then I change state back to stateIdle so that other actions can be called again

So my class for stateWritingWaypoints handles writing Waypoints and nothing else - this makes the code really clean and simple. The downside is that you end up with many more (small) classes in your code.

Watch this space for the source to the free .NET GPS Library.

Posted: Sunday, November 12, 2006 3:26:18 PM (GMT Standard Time, UTC+00:00)  #   Comments [0]
TAGS: .NET | Design Patterns | Development | GPS

About 4 or 5 years ago I wrote a GPS ActiveX control in VB6.0.
Although it work really well (and fast), it was difficult to maintain - to be honest it was pretty messy, a large monolith with some real horrible 283654276354 line functions.
I sold it as Kapie Systems for a while and had some good success with it, it was mentioned at a couple of GIS conferences etc...

Anyway, I had been meaning to update it (to .NET) for sometime, but I wanted to do it right, make it easy to extend (to plug-in other GPS protocols) and easy to maintain.

I just got a basic .NET implementation of it working last night (at last !!). It's Garmin propriety protocol only at the moment, but the whole framework is there for extending to other protocols (which I'll be adding shortly).
I also added import and export to GPX format, which is a great portable standard - the GIS / Mapping community has been crying out for this for ages.

I expect to have something releasable in a few weeks (it will be open source) but if anyone wants an early view or wants to discuss my plans ideas then let me know.

Posted: Friday, November 10, 2006 12:00:33 AM (GMT Standard Time, UTC+00:00)  #   Comments [3]
TAGS: .NET | C Sharp | Development | GPS

Blank entry, simply to list out the categories.

Posted: Saturday, January 01, 2005 5:32:53 PM (GMT Standard Time, UTC+00:00)  #   Comments [0]
TAGS: Archiving | C Sharp | Code Generation | Exchange | Family | Mountaineering | PHP | RSS | Scripting | Support | Technical | .NET | Design Patterns | Hardware | Dasblog | Running | Tools | Development | Software | TaHoGen | GPS
     
 
 
Copyright © 2008 Ken Hughes. All rights reserved.

Creative Commons License
This work is licensed under a Creative Commons Attribution 2.0 UK: England & Wales License.