Global Mapper v25.0

AIS in global mapper

SpyXIV
SpyXIV Global Mapper User
edited January 2014 in Technical Support
Hi,

I don't exactly know if this is the right section but here is what is troubling me :
I just started and internship and my job is to find a way to integrate AIS to global mapper (in real time of course).

Basically, the AIS system will provide the computer with a number of position (long and lat), speed, heading and some other info about the ship (this every second or so). My job is to create a program that plots these positions (with an arrow for example) in real time.

I'm not asking you to do my job here, but since I've never use global mapper (I'm working on GM 11) before, if you could give me some tips on where to start that would be great :)

I think this could be an intersting feature for global mapper and this program may be of some use for other users...
«1

Comments

  • global_mapper
    global_mapper Administrator
    edited November 2011
    I think the External Control Interface is what you are going to need to use to read your AIS data and provide it to a running instance of GM for display. See http://globalmapper.com/developer/developer.htm#external_ctrl for details.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Support
    gmsupport@bluemarblegeo.com
  • SpyXIV
    SpyXIV Global Mapper User
    edited November 2011
    Thanks a lot for your quick response, this seems to be what I was looking for. But considering I'm still a noob in programation and in the use of GM I will first start to familiarize with those two.

    I'll stay in touch to let you know how my project evolves ;)
  • SpyXIV
    SpyXIV Global Mapper User
    edited December 2011
    I'm back on this project again, I have some troubble using this API : I'm new to C++ programming (or programming in general) so I'm sorry if what I'm about to say is confusing...

    So I created a new project (I am using Code::Blocks), include all of the .h and .cpp files and tried using one of the functions defined in the API. My main looks like that :
    // C ++ Code

    int main()
    {

    GM_Ctrl_SendCenterOnPointMessage(FindWindow(NULL,TEXT("Code::Blocks")), -3.2, 47.1, NULL);

    return 0;


    }

    // end of code

    I run the program it can't compile and the debugger gives me a lot of errors comming from the files included in the API... Any ideas ?
  • global_mapper
    global_mapper Administrator
    edited December 2011
    Um I guess what are the errors that you are seeing? A lot of this could just be basic project setup stuff. What development environment are you using?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • SpyXIV
    SpyXIV Global Mapper User
    edited December 2011
    Probably, I get in GlobalMapperTypes.h : '__int64' does not name a type in line 107 and 108

    in GlobalMapperControlIntf.h : '::_tcsstr' has not been declared line 815
    and '_T' was not declared in this scope 870.

    I use Code Blocks with GNU GCC Compiler, Console application.
    If I try to use it in a Win 32 GUI project I get even more errors ( +50 manly : expected primary-expression before 'const' or 'aPosCount' or 'double' for example in GlobalMapperControlIntf.h)

    What project setup should i use ?

    Thanks for your help.
  • global_mapper
    global_mapper Administrator
    edited December 2011
    It will be difficult to help with more basic programming questions outside of Visual Studio where we develop, I've never used Code Blocks, but some of those sound just like you need to include some basic things, like <string.h> and <windows.h> before including the Global Mapper stuff. I think there is a free version of Visual Studio that allows some simple application development that might work I'm not sure why __int64 isn't being seen, but it could be that is named differently in GNU GCC than Visual Studio. You could actually comment out those lines as 64-bit variables likely won't be used in your small sample application.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • SpyXIV
    SpyXIV Global Mapper User
    edited December 2011
    I also included the basics <windows.h> and such. The functions and variables types that generate these errors are probably specific to Visual C++. I'll download the package redistribuable Microsoft Visual C++ 2010 or directly download the Free version of Visual C++, I'll tell you if it works.
  • SpyXIV
    SpyXIV Global Mapper User
    edited December 2011
    Ok, the errors were definitely due to the use of the wrong compiler. I'm now using the free version of Visual C++ and no more errors the source files of the API.

    But now i get an error LNK2019 unresolved external symbol from the GM_Ctrl_SendCenterOnPointMessage function in the main, it seems that I need to link more than the basic libraries.

    Can you give me the list of the linked libraries needed to make the API work ?

    Sorry it takes me so long to get this to work...
  • SpyXIV
    SpyXIV Global Mapper User
    edited December 2011
    Ok, the errors were definitely due to the use of the wrong compiler. I'm now using the free version of Visual C++ and no more errors the source files of the API.

    But now i get an error LNK2019 unresolved external symbol from the GM_Ctrl_SendCenterOnPointMessage function in the main, it seems that I need to link more than the basic libraries.

    Can you give me the list of the linked libraries needed to make the API work ?

    Sorry it takes me so long to get this to work...
  • SpyXIV
    SpyXIV Global Mapper User
    edited December 2011
    Never mind, after playing around a bit I managed to make it work...

    Compiler had some issues with _T and _tcsstr function, after replacing them with TEXT and wcsstr it worked :)

    (You can delete my last double-message)
  • SpyXIV
    SpyXIV Global Mapper User
    edited January 2012
    I have an other problem, I need to be able to delete points from my external program and it doesn't work :
    When I use the GM_Ctrl_SendDrawSymbolMessage() function there is no problem I can draw my symbol and delete it by putting a blank aSymName.
    When I try to do the same with the GM_Ctrl_SendAddPointMessage() function to delete the point it just adds an other point on top with the default symbol of the point type. If I leave everything blank (aSymName and aTypeName) it still adds a point on top.

    Is there a way to delete points using the API or is it just impossible ?
  • global_mapper
    global_mapper Administrator
    edited January 2012
    There isn't any way to delete an actual point feature that has been added using the external control API. Each call actually adds a new point and it is perfectly valid to have no name or symbol, so making those blank doesn't matter. You have to use draw symbols if you want to be able to delete them.

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • SpyXIV
    SpyXIV Global Mapper User
    edited January 2012
    And there is no other way of deleting a point feature from outside of global mapper ?
  • SpyXIV
    SpyXIV Global Mapper User
    edited January 2012
    My goal is to display points that move (so the program I created refreshes their position every 10 second or so by deleting them and drawing them again in a different position) and at the same time being able to have more info about the point than just the label (like speed, SOG, COG, turn rate and more info about the ship emmiting the ais message) so having points attributes is perfect only I have to be able to delete them or change their coordinates some how...

    Thanks for your help.
  • SpyXIV
    SpyXIV Global Mapper User
    edited January 2012
    After looking around a bit, I noticed that you can setup the GPS from a NMEA File with the option playback in real time.

    I could simply generate GPS NMEA sentences in a text file from my incoming AIS sentences for each of my points using $PRAVE message format to display several points at the same time. Do you think that will work ?
  • global_mapper
    global_mapper Administrator
    edited January 2012
    You could use $PRAVE sentences to track several vessels at once, but you wouldn't get the attribution there either, just the information that you could encode in a NMEA string (so things like speed and bearing would come along for free, but nothing specific to the ship other than the label from the $PRAVE sentences).

    I could update the external control interface to add a way to update and delete actual point features, or you could perhaps embed the extra information in the label with maybe newline characters (\n) to separate the fields so they could be labeled on extra lines if you want all of that information shown at once?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • SpyXIV
    SpyXIV Global Mapper User
    edited January 2012
    I have about 8 attributes per point (okay some of them are less important than others, it's not essential to have all of them) so I can't put everything in the label since I will become too big (best would be to have no label and only display info by clicking on the point).
    If it's not too much work, updating the external control API would be the best thing for me, if not I could work my way around with the $PRAVE senteces I guess...

    Thanks for your help.
  • SpyXIV
    SpyXIV Global Mapper User
    edited January 2012
    I tried some sample $PRAVE sentences that I found on the forum with the GPS > Setup > from file option but this doesn't seem to be suited for my use, it only displays the path of the gps device and no symbol of the "current" (last sentence of the file) position. I recon I won't be able to use this to "simulate" a multiple GPS tracking device...
  • global_mapper
    global_mapper Administrator
    edited January 2012
    Ok I will update the External Control Interface to allow deleting of features. I will point you at a new build when this is read.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • global_mapper
    global_mapper Administrator
    edited January 2012
    Also if you want to provide me with your NMEA file with $PRAVE sentences I can take a look and see what that isn't working for you.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • global_mapper
    global_mapper Administrator
    edited January 2012
    I have completed adding a new command, GM_Ctrl_DeletePoint, that allows you to delete a previously added point based on location, name, symbol, and type. I have attached the new external control API files. I have placed a new build at http://www.globalmapper.com/global_mapper13.zip with the change for you to try. Simply download that file and extract the contents into your existing v13.xx installation folder to give it a try. If you are using the 64-bit v13 version there is a new build at http://www.globalmapper.com/global_mapper13_64bit.zip .

    Let me know if I can be of further assistance.

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.comExternalControlAPI.zip
  • SpyXIV
    SpyXIV Global Mapper User
    edited January 2012
    Wow thanks for the quick work. I'll try it out as soon as I'm back at work. For the $PRAVE sentences no worries, I won't be needing them with your new build.
  • SpyXIV
    SpyXIV Global Mapper User
    edited January 2012
    Just wanted to say that the new API works perfectly. My software to include AIS in GM is almost done, I'll post it on the forum when it's complete if anyone is interested.
  • Herry Sitepu
    Herry Sitepu Global Mapper User
    edited February 2012
    I have try the new external control API along with the updated global_mapper13.exe. But I notice that if I used the GM_Ctrl_SendAddPointMessage the points are not drawn until I move the mouse. I create a background process to send the messages and make GM as the active window. I use for example 200 ms rate when sending the messages. Do you have this same problem? Do I need to send WM_PAINT message to GM so it can redraw the points?
  • global_mapper
    global_mapper Administrator
    edited February 2012
    Can you try posting a WM_INVALIDATE message to the window and see if that takes care of it?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • Herry Sitepu
    Herry Sitepu Global Mapper User
    edited February 2012
    Can you try posting a WM_INVALIDATE message to the window and see if that takes care of it?

    But there is no WM_INVALIDATE message, do you mean InvalidateRect()? Does GM support receiving and processing other messages beside WM_COPYDATA. So you mean that sending message means from other process to GM through SendMessage() WinAPI?

    Regards,
    Herry Sitepu
  • global_mapper
    global_mapper Administrator
    edited February 2012
    Herry,

    Oh sorry you are right, I was thinking of calling Invalidate but of course you can't do that. Can you try doing a PostMessage of WM_PAINT to post the message to the main Global Mapper window and see if that does the trick?

    Thanks,

    Mike
    Global Mapper Guru
    gmsupport@bluemarblegeo.com
    http://www.globalmapper.com
  • SpyXIV
    SpyXIV Global Mapper User
    edited February 2012
    Same problem here, I'll see if I can find a solution...
  • SpyXIV
    SpyXIV Global Mapper User
    edited February 2012
    I tried sending a WM_PAINT with SendMessage() and PostMessage(), but it doesn't work...

    Since the point is displayed by moving the mouse, I tried putting SetCursorPos(0,0); just after GM_Ctrl_SendAddPointMessage and it works. Wieredly it doesn't move the mouse to (0,0) coordinates but maybe that's because I'm using Windows as a VM. If your mouse moves you can allways get the mouse coords first and then move the mouse to last coords.

    This doesn't seem to disturb in anyway if the mouse is actually mouving when the point appears but then again it may be linked to the VM.

    This isn't very clean, but if does the trick with native windows why not ?

    Tell me how it goes for you.
  • Herry Sitepu
    Herry Sitepu Global Mapper User
    edited February 2012
    I tried using SetCursorPos(0,0) but no success. The mouse cursor was moved, but the points still now shown. Is it possible if GM's windproc that processed the WM_COPYDATA calls InvalidateRect()? I bet it is peace a cake for 'gis genius' such as Mike. :)