Cruisers Forum
 

Go Back   Cruisers & Sailing Forums > Seamanship, Navigation & Boat Handling > OpenCPN
Cruiser Wiki Click Here to Login
Register Vendors FAQ Community Calendar Today's Posts Log in

Reply
  This discussion is proudly sponsored by:
Please support our sponsors and let them know you heard about their products on Cruisers Forums. Advertise Here
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 15-12-2020, 03:06   #1
Registered User

Join Date: Oct 2020
Posts: 9
Adding waypoint from outside OpenCPN

Hello all,

I want to do something which seems quite simple, but I can't figure out.

I want to be able to receive coordinates on my windows pc, and then have OpenCPN automatically add a waypoint on those coordinates. Does anyone have a plugin, program, piece of code etc. That would be able to do this? It could use NMEA or anything else really, as long as the end goal is achieved.

Thank you
Caglar Markus is offline   Reply With Quote
Old 15-12-2020, 07:29   #2
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,308
Re: Adding waypoint from outside OpenCPN

Ceglar Marcus..
If you can send, serial or network, NMEA 0183: xxWPL with positions and a WP name it will be handled by O.
See more discussions here: https://opencpn.org/wiki/dokuwiki/do...pt-rte-over-ip
Hakan is offline   Reply With Quote
Old 15-12-2020, 07:45   #3
Registered User

Join Date: Oct 2020
Posts: 9
Re: Adding waypoint from outside OpenCPN

Quote:
Originally Posted by Hakan View Post
Ceglar Marcus..
If you can send, serial or network, NMEA 0183: xxWPL with positions and a WP name it will be handled by O.
See more discussions here: https://opencpn.org/wiki/dokuwiki/do...pt-rte-over-ip
So a simulated NMEA sentence will be accepted and shown by Opencpn without user interaction?

The link you posted seems awfully bloated for what I'm trying to achieve...

Thanks though
Caglar Markus is offline   Reply With Quote
Old 15-12-2020, 12:08   #4
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,308
Re: Adding waypoint from outside OpenCPN

Yes I know there's a lot but catch what's relevant for you.
The message would be: Try to send a WPL message like one of the examples on the wiki page and make a check. I think it will work.
As may be obvious you have to create the message according to the NMEA standard. E.g. the position format. 5820.1234 >> 58° 20.1234 minutes
Hakan is offline   Reply With Quote
Old 15-12-2020, 12:38   #5
Registered User

Join Date: Nov 2015
Location: Ireland
Posts: 476
Re: Adding waypoint from outside OpenCPN

Here is a valid WPL sentence if it helps. It should create a waypoint off the south west coast of Ireland called "014".



$ECWPL,5128.508,N,00923.569,W,014*7C


And another which creates a waypoint called "Rock 0"



$ECWPL,5129.361,N,00925.370,W,Rock 0*6C



I hope these help.


Aedan
AedanC is offline   Reply With Quote
Old 15-12-2020, 18:30   #6
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,805
Images: 2
Re: Adding waypoint from outside OpenCPN

Quote:
Originally Posted by Caglar Markus View Post
So a simulated NMEA sentence will be accepted and shown by Opencpn without user interaction?
The link you posted seems awfully bloated for what I'm trying to achieve...
Thanks though

Caglar, since you think the documentation can be improved, would you mind providing several paragraphs that can be used (and any screenshot you think might be appropriate? Post it here.... Thank you.

OR

This manual is maintained by User/Editor volunteers. You can be one by PM me. Then you can edit the page directly.
rgleason is online now   Reply With Quote
Old 16-12-2020, 13:12   #7
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,308
Re: Adding waypoint from outside OpenCPN

Caglar M...
To possible extend our knowledge I made some code investigation.
So, Yes the NMEA WPL can be handled by OCPN but not the way you may want.
It can't be used to create marks in OCPN like when sent to some plotters.
It can though be used to create ARPA alike targets. One condition is that one variable in OpenCPN config (.ini) file is set to thrue;
In [Settings/AIS] bWplIsAprsPositionReport=1

If I send the following messages the result is as of attached picture. The ten "targets" will be handled as AIS targets. That's marked as first undefined and finally deleted using the same time settings as for AIS.
If I don't update the WP number one target is drawn instead. See pict 2.
The Python script attached. (Discard the ".pdf" when saved.)

To let e.g. WPL messages create a mark is of course possible and not a very big task. But has still to be developed.
Håkan
Code:
$ECWPL,5741.223400,N,1011.023399,E,WP1*5F
$ECWPL,5741.423400,N,1010.823399,E,WP2*53
$ECWPL,5741.723400,N,1010.523399,E,WP3*5C
$ECWPL,5742.1234,N,1010.1234,E,WP4*5D
$ECWPL,5742.6234,N,1009.6234,E,WP5*54
$ECWPL,5743.223400,N,1009.023399,E,WP6*53
$ECWPL,5743.923400,N,1008.323399,E,WP7*5B
$ECWPL,5744.723400,N,1007.523399,E,WP8*54
$ECWPL,5745.6234,N,1006.6234,E,WP9*50
$ECWPL,5746.6234,N,1005.6234,E,WP10*68
 Ten WP printed. Exit
Attached Thumbnails
Click image for larger version

Name:	WPL1.jpg
Views:	70
Size:	33.8 KB
ID:	228756   Click image for larger version

Name:	wpl2.jpg
Views:	67
Size:	54.2 KB
ID:	228757  

Attached Files
File Type: pdf Send_WPL.py.pdf (2.3 KB, 41 views)
Hakan is offline   Reply With Quote
Old 16-12-2020, 14:19   #8
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,805
Images: 2
Re: Adding waypoint from outside OpenCPN

Added to FAQ, as I did not have a good place to put this.
https://opencpn.org/wiki/dokuwiki/do...ts_be_imported


I think these are related:
https://www.cruisersforum.com/forums...ml#post3296537

"Opencpn APIs to access tracks do not work adequately (Flyspray report here) "
rgleason is online now   Reply With Quote
Old 16-12-2020, 17:35   #9
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,235
Re: Adding waypoint from outside OpenCPN

There is a "Treat WPL sentences as APRS position reports" checkbox to enable this functionality in Toolbox -> Ships -> AIS Targets.
The animal has been probably beaten to death at least twice already in
https://opencpn.org/flyspray/index.p...ls&task_id=964
https://opencpn.org/flyspray/index.p...s&task_id=1595
https://opencpn.org/flyspray/index.p...s&task_id=2166
so the only thing missing is someone willing to extend the current implementation to also directly create the marks if configured so.
nohal is offline   Reply With Quote
Old 17-12-2020, 00:40   #10
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,308
Re: Adding waypoint from outside OpenCPN

Nohal..
Thanks for the reminder. So it is and my mind was obviously lost.
That check box could be changed to a selection between the APRS function or to create a mark or do nothing.
Hmm..

So far a manual step is required to create a mark in the APRS "Target query" dialog box.
Hakan is offline   Reply With Quote
Old 17-12-2020, 06:40   #11
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,805
Images: 2
Re: Adding waypoint from outside OpenCPN

I had totally forgotten these discussions too. The HAM users never tested it either. Can we close some of these now since Hakan has done some tests?


It is in the wiki

https://opencpn.org/wiki/dokuwiki/do...sition_reports


Hakan those would be good improvements and find their way into the manual.
rgleason is online now   Reply With Quote
Old 18-12-2020, 03:40   #12
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,308
Re: Adding waypoint from outside OpenCPN

Caglar M.. and @All..
My "Hmm.." in the above post has resulted in this patch:
I've extend the WPL message handling to include optional marks creation. The selection option as of attached pict1. When "Create mark" is selected my WPLs as of above example result in marks as of pict2.

Any comments and/or suggestions before I make a PR to Github master?
Please also correct possible misuse of the English language which is not my best subject.
Thanks
Håkan
Attached Thumbnails
Click image for larger version

Name:	WPL_options.jpg
Views:	100
Size:	86.7 KB
ID:	228851   Click image for larger version

Name:	WPL_marks.jpg
Views:	88
Size:	86.6 KB
ID:	228852  

Hakan is offline   Reply With Quote
Old 18-12-2020, 05:44   #13
Registered User

Join Date: Oct 2020
Posts: 9
Re: Adding waypoint from outside OpenCPN

Quote:
Originally Posted by Hakan View Post
Caglar M.. and @All..
My "Hmm.." in the above post has resulted in this patch:
I've extend the WPL message handling to include optional marks creation. The selection option as of attached pict1. When "Create mark" is selected my WPLs as of above example result in marks as of pict2.

Any comments and/or suggestions before I make a PR to Github master?
Please also correct possible misuse of the English language which is not my best subject.
Thanks
Håkan
No this looks great, would love it if this would be pushed, thanks!
Caglar Markus is offline   Reply With Quote
Old 19-12-2020, 05:56   #14
Registered User

Join Date: Nov 2012
Location: Orust Sweden
Boat: Najad 34
Posts: 4,308
Re: Adding waypoint from outside OpenCPN

Caglar..
Very good. Thanks for your support.
If you're on Win and want to test I'd PM a link with "my" updated O-version?
Håkan
Hakan is offline   Reply With Quote
Old 21-12-2020, 02:47   #15
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 319
Re: Adding waypoint from outside OpenCPN

You can create waypoints from WPL sentences using the existing OCPN v5 onwards using the JavaScript plugin and the following script, which I have commented with explanations of what it is doing:

Code:
// create waypoints from NMEA sentences
Waypoint = require("Waypoint"); // load waypoint constructor
workingWaypoint = new Waypoint; // a working JavaScript waypoint object
OCPNonNMEAsentence(handleNMEA); // listen for NMEA sentence

function handleNMEA(input){  // handle receipt of NMEA sentence
	if (input.OK){	// only process if checksum OK
		sentence = input.value;
		if (sentence.slice(1, 6) == "ECWPL"){
			workingWaypoint.position.NMEAdecode(sentence,1);
			diced = sentence.split(",");
			workingWaypoint.markName = diced[5];
			workingWaypoint.add();	// create waypoint in OpenCPN
			}
		}
	OCPNonNMEAsentence(handleNMEA);	// listen for next sentence
	}
Because waypoints in OpenCPN are unique by GUID rather than waypoint name, this will create multiple waypoints with the same name, if the sentence is repeated. It is possible to replace a waypoint with an existing one of the same name. Let me know if you want the script for that.
Antipole is offline   Reply With Quote
Reply

Tags
enc, opencpn


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New Standard Waypoint Icons For OpenCPN - Input Requested reflectionsv37 OpenCPN 160 25-01-2019 01:38
Plugin: Adding waypoint with a hyperlink Rasbats OpenCPN 3 19-08-2017 06:18
OpenCPN 4.2 "Use nearby waypoint?" makes program unresponsive in Windows 10 jfwg OpenCPN 3 24-04-2016 02:46
Waypoint in OpenCPN SV Demeter OpenCPN 4 23-12-2012 09:19
Problem Marks or Waypoint behavior - Symbols - OpenCPN 3.0.2 , 3.1.814 beta exe, 3.1. rgleason OpenCPN 20 19-09-2012 10:14

Advertise Here
  Vendor Spotlight
No Threads to Display.


All times are GMT -7. The time now is 04:08.


Google+
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Social Knowledge Networks
Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2024, vBulletin Solutions, Inc.

ShowCase vBulletin Plugins by Drive Thru Online, Inc.