Skip to content

Instantly share code, notes, and snippets.

@antipole2
Last active December 7, 2021 14:09
Show Gist options
  • Save antipole2/2c52e9bc0e63e2aed9acb87efd0b4ba4 to your computer and use it in GitHub Desktop.
Save antipole2/2c52e9bc0e63e2aed9acb87efd0b4ba4 to your computer and use it in GitHub Desktop.
// Add hyperlinks to an existing waypoint with markName of 'lunch stop'
wpName = "lunch stop";
guids = OCPNgetWaypointGUIDs();
foundIt = false;
for (i = 0; i < guids.length; i++){
// look for our waypoint
lunchWaypoint = OCPNgetSingleWaypoint(guids[i]);
if (lunchWaypoint.markName == wpName){
foundIt = true;
break;
}
}
if (!foundIt) throw("Waypoint not found");
// we have our waypoint - now update it
lunchWaypoint.iconName = "Anchor";
// nudge the position north towards shore
lunchWaypoint.position.latitude += 0.001;
lunchWaypoint.description = "Great anchorage with pub close ashore";
lunchWaypoint.hyperlinkList.push({description:"Pub website",
link:"https://goldenanchor.co.uk"});
lunchWaypoint.hyperlinkList.push({description:"Menu",
link:"https://goldenanchor.co.uk/menu"});
OCPNupdateSingleWaypoint(lunchWaypoint); // update OpenCPN waypoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment