Embedding Maps Within LabVIEW

Many years ago when I was young, naive, and just starting off my career as a software engineer I was under the impression that whilst as a graduate I could expect to be on a steep learning curve, I would reach a point where although I would have to continually refresh my skills to keep pace with the latest technologies, my knowledge would be such that the learning curves wouldn’t be so steep. Fast forward 13 years and I can confirm that I was utterly wrong in this and I’ve hardly been off a learning curve for any of that time (and when I have I’ve been bored stiff!), and the learning curves don’t diminish either – which is not a problem as I still love acquiring new skills and improving the ones I have and hope I always will.

One of my latest learning curves has been to get mapping technology embedded in LabVIEW for a GPS application I am developing, and have found that there are a number ways of doing this.

The simplest way appears to be use an embedded web page and then build up a static url to generate a map and markers etc. If all you want on your GUI is a static map image then this is probably the best way to go, but it does have the drawback that if you want to alter any of the data then you will have to alter the url and reload the webpage which even for a mega fast connection is going to seem too slow so for any kind of dynamic applications this will not be appropritate but if you’re interested in doing this then the link below will take you to the Google Static Maps API, and I have also provided a link to a LabVIEW implementation using the API.

Google Maps API Developers Guide

Google Maps API – LabVIEW example

A second possibility was the dynamic generation of JavaScript. I had a play around with this, but very quickly felt that my lack of experience or knowledge of JavaScript was playing against me, and I still didn’t feel that it was the most elegant way to go in terms of getting maps into LabVIEW, but please find link below to get started with this method if you think it’s for you.

Google Maps JavaScript API

Another possibility I looked at was to use Google Earth instead as there is a very comprehensive API and by doing a search it appears a number of people have done this in LabVIEW and an API has been created, but it was a bit more in depth than I was looking for but is probably the way to go if you really want to unleash the power of Google Earth and use all of it’s many fantastic features. Please see link below as a starting point but also do a search as there are a number of articles and discussion forum posts on this.

Google Earth API

Google Earth and LabVIEW

The option I eventually went with was to use an absolutely fantastic free 3rd party .NET assembly called GMap.NET which I have found to be incredibly robust, very easy to interface to, and also very easy to learn how to use with a major caveat: I have been bitten a few times now using 3rd party .NET assemblies directly from LabVIEW – I’m not sure if it is because I am making a mistake in the way I am using a particular assembly, or whether there are some incompatibilities between LabVIEW and the specific assembly but I’ve generally learnt to be wary.

Another issue that I’ve found is that code where I’ve interfaced directly to a 3rd party .NET assembly not designed in a LabVIEW friendly manner it can get incredibly messy and almost unmanageable very quickly where you are always having to construct .NET specific objects such as Lists etc – although I wouldn’t call this a deal breaker.

Luckily I have about 3 years of .NET C# development experience under my belt (although this assembly should only require basic knowledge to understand), so my approach almost always to using .NET assemblies these days is to embed the 3rd party assembly within my own assembly that I have tailored for my application context and to play nicely with LabVIEW  i.e.native strings, arrays etc.

This has been my approach here which has meant that with very little pain I have successfully embedded Google Maps within my application with most of the functionality I require within a couple of days of work and has so far had total robustness and is very fast and responsive too.

Google Maps Embedded Within LabVIEW

Google Maps Embedded Within LabVIEW using GMap.NET

As you may be able to deduce from the screen dump, I have been using Actor Framework for this application and the map itself is an Actor which should make it good for reuse too.

Please find links to the GMap.NET software itself as well as the tutorials that I have used to develop my application below, and thank you for reading.

GMap.NET Software Download

GMAP.NET Tutorial (C# but easy to transpose into LabVIEW)

 

 

Advertisements

8 thoughts on “Embedding Maps Within LabVIEW

  1. Hi Dave,

    Very interesting post. This is something I have thought of doing for a while but never really got round to doing it. Will definitely give it a go once the CLD Summit is over.

    Cheers,
    Greg

    • Hi Dave,
      What version of the dll did you use? I’ve tried the latest build and the latest release and they seem to be slightly different.
      Thanks,
      Greg

  2. The version I have is tagged as 1.7.0.0. I think I found that the tutorial wasn’t quite up to date and had to do a bit of guess work with some of the methods.

  3. Hi Dave,

    I have tried to use Gmap.net 1.7 for so long but can’t get them to work in Labview. Can you please share how you initialize maps or provide at lease to guide how did you get map to show in Labview front panel.

    Thanks,

    Norman

    • Hi Norman, so sorry for taking so long to respond – sadly one of the occupational hazards with blogs is that you seem to get insane amounts of spam messages which I try and sort out every so often.

      I’m busy tonight, but will try and get something to you over the weekend.

      Dave

      • Hello Dave,

        Your implementation of GMap.NET in LabVIEW looks very nice. I’m currently trying the same. But with no success (map will not load, different function names and missing properties related to the tutorials).
        It would be a very big help for me (and other) if you could post a simple example VI. A bitmap file or a screenshot would be enough.

        Thanks in advance

        Regards

        Dirk

      • Hi Dirk – I’ve had another request for this but have struggled to find time to do it, but have just knocked up a very quick and dirty example which I shall publish in a minute.

        Dave

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s