07-07-2009 10:04 AM
Hi,
I have been trying to use google maps to track the position I get from a GPS device. So far my strategy has been embedding a web browser, and have it open an URL, where I put a path to a .html file which contains the javascript code required to the google maps API.
The thing is, how can I call javascript functions from Labview, in order to have the google maps api center the map on my received coordinates dinamically. The problem now is that I have to change the javascript code in the html file and reload the map every time I have new data, which causes flickering.
I read this post while searching for an answer, http://forums.ni.com/ni/board/message?board.id=170&thread.id=226956, but I didn't quite understand how I can call the javascript functions within the desired page (in this case a google map url).
Hope you can help me,
Diogo
07-08-2009 09:40 AM
Hi,
You can write a text file with your javascript code and call him with web browser activeX. Your html file is local but the google API allow to see map in any html file with javascript.
Regards,
Aurélien J.
National Instruments France
07-08-2009 09:51 AM
Hi,
Just to make sure I understand your tip, what you're suggesting is that I write the javascript code to a text file(.html) and then open an web browser with the file path as the URL right? Otherwise how do I call the file with webbrowser activeX?
The problem is that I need the javascript funtions to have variables which is data parsed from the GPS information I receive from the serial port. That way, I have to reload the browser as much times as I receive the information from the GPS, which causes the troubling flickering...
Sorry to bother you again with and thanks again!
Diogo
07-08-2009 11:03 AM
Hi,
you can use this example VI
Regards,
Aurélien J.
National Instruments France
07-08-2009 11:54 AM
Hi,
Thanks for the example you posted. That indeed solves the problem with calling a html file from the web browser.
However I still have one last problem with this. The thing is, with this strategy I am not able to interact between labview controls and variables(the data I parse from the GPS messages received in the serial port) and the javascript code, because the code is written in a file.
I believe my question is the following. How do I communicate between Labview environment and the javascript code? Basically I need to execute functions in the javascript code, such as centering the map in coordinates given by variables whose values are in labview.
Sorry for the trouble once again and manny thanks
Diogo