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 02-02-2022, 16:31   #1
Registered User
 
svonadym's Avatar

Join Date: Jan 2019
Location: Pacific Northwest
Boat: Cape Dory 25D
Posts: 46
Navigational Warning Msgs from NGA.mil

Does anyone know if there is an easy (read: automated) way to add the coordinates from navigational warning messages sent from the National Geospatial Intelligence Agency (NGA) into ocpn for display? Most of their warnings include several (sometimes many) coordinates that can be a pain to enter for reference when in the applicable area. I was wondering if there is a plug-in or some such to help automate the view of the affected areas.
Thanks for any guidance.
svonadym is offline   Reply With Quote
Old 02-02-2022, 18:03   #2
Registered User
 
SeanPatrick's Avatar

Join Date: Dec 2012
Location: Norfolk, VA USA
Posts: 665
Re: Navigational Warning Msgs from NGA.mil

How are the coordinates formatted? If they can be saved as a csv (comma separated values), then a program like GPSBabel can convert them into a format such as gpx that can be read by almost any mapping program - like OCPN or Google Earth. I don't know of a way to automate the whole process, but the way I do it is fairly quick and painless.
__________________
If you have any questions about celestial navigation, ask me!
Celestial Navigation Spreadsheet
NavList Celestial Navigation Forum
SeanPatrick is offline   Reply With Quote
Old 03-02-2022, 03:40   #3
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,211
Re: Navigational Warning Msgs from NGA.mil

I have subscribed just last night to see what we talk about and since then I have already seen at least 4 different ways used to format lats and lons, not to say there seems to be no fixed system in the way the whole messages are formatted...
At least the coordinates seem to be reasonably extractable using a regular expression like https://regex101.com/r/cQAuOv/1 and then can be converted to GPX waypoints without much more effort.
The rest of the information is probably not worth the effort that would be needed to harvest it, at least for me - I would simply name the waypoints with the subject line of the mail I harvested them from and looked at it if they were in my area of interest.
nohal is offline   Reply With Quote
Old 03-02-2022, 10:51   #4
Registered User
 
svonadym's Avatar

Join Date: Jan 2019
Location: Pacific Northwest
Boat: Cape Dory 25D
Posts: 46
Re: Navigational Warning Msgs from NGA.mil

Thank you both for the suggestions. I'll investigate GPX files to learn more. Perhaps I can create a simple app into which I can paste the email text and create a GPX file.
svonadym is offline   Reply With Quote
Old 03-02-2022, 15:08   #5
Registered User

Join Date: Mar 2011
Posts: 651
Re: Navigational Warning Msgs from NGA.mil

You could also download the navigational messages in Google .kmz format.

The .kmz files are simply zip files which contain Google .kml files which in turn contain the navigational warnings. The .kml files are just xml files and will give you an opportunity to more easily parse the structured data into gpx. Here is a snippet
Code:
<Folder>
        <name>HYDROARC 207/21</name>
        <Snippet maxLines="2">022318Z SEP 21</Snippet>
        <description>QUEEN MAUD GULF.
CANADA.
DNC 28.
1. 23.8 METER SHOAL IN 68-58.95N 101-08.32W.
2. CANCEL HYDROARC 206/21.//</description>
            <Placemark>
                <name>HYDROARC 207/21 [1 of 1]</name>
                <description><![CDATA[<B>QUEEN MAUD GULF.<br>
CANADA.<br>
DNC 28.</B><B><br>
1. 23.8 METER SHOAL IN 68-58.95N 101-08.32W.</B><br>
2. CANCEL HYDROARC 206/21.//<br><br>Authority: NAVAREA XVIII 84/21 022309Z SEP 21.<br><br>Date: 022318Z SEP 21]]></description>
                <styleUrl>#NavWarnP</styleUrl>
                                <Point>
                <coordinates>-101.138667,68.982500,0</coordinates>
                </Point>
            </Placemark>
            <Placemark>
                <name>HYDROARC 207/21 [c1 of c1]</name>
                <description><![CDATA[<B>QUEEN MAUD GULF.<br>
CANADA.<br>
DNC 28.</B><br>
1. 23.8 METER SHOAL IN 68-58.95N 101-08.32W.<B><br>
2. CANCEL HYDROARC 206/21.//</B><br><br>Authority: NAVAREA XVIII 84/21 022309Z SEP 21.<br><br>Date: 022318Z SEP 21]]></description>
                <styleUrl>#NavWarnC</styleUrl>
            </Placemark>
        </Folder>
Shouldn't require rocket surgey.
stevead is offline   Reply With Quote
Old 03-02-2022, 17:21   #6
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,211
Re: Navigational Warning Msgs from NGA.mil

KML can be directly converted to GPX using GPSBabel, so the amout of work to be done is almost none.
The issue might be the update frequency - the e-mails kept coming at least once an hour during the day I tried it. But I was subscribed to all the 6 feeds, so limiting the area of interest might probably make it more manageable.
nohal is offline   Reply With Quote
Old 04-02-2022, 00:05   #7
Registered User
 
Antipole's Avatar

Join Date: Oct 2019
Location: Emsworth, UK
Boat: Alubat Ovni 395
Posts: 287
You could do this in JavaScript

I am not familiar with the forms of the notice but @stevead has shown an example in .kmz format. I ran this through a xml to json converter, selecting the Remove top-level root option and got:
Code:
{
   "name": "HYDROARC 207/21",
   "Snippet": {
      "_maxLines": "2",
      "__text": "022318Z SEP 21"
   },
   "description": "QUEEN MAUD GULF.\nCANADA.\nDNC 28.\n1. 23.8 METER SHOAL IN 68-58.95N 101-08.32W.\n2. CANCEL HYDROARC 206/21.//",
   "Placemark": [
      {
         "name": "HYDROARC 207/21 [1 of 1]",
         "description": {
            "__cdata": "<B>QUEEN MAUD GULF.<br>\nCANADA.<br>\nDNC 28.</B><B><br>\n1. 23.8 METER SHOAL IN 68-58.95N 101-08.32W.</B><br>\n2. CANCEL HYDROARC 206/21.//<br><br>Authority: NAVAREA XVIII 84/21 022309Z SEP 21.<br><br>Date: 022318Z SEP 21"
         },
         "styleUrl": "#NavWarnP",
         "Point": {
            "coordinates": "-101.138667,68.982500,0"
         }
      },
      {
         "name": "HYDROARC 207/21 [c1 of c1]",
         "description": {
            "__cdata": "<B>QUEEN MAUD GULF.<br>\nCANADA.<br>\nDNC 28.</B><br>\n1. 23.8 METER SHOAL IN 68-58.95N 101-08.32W.<B><br>\n2. CANCEL HYDROARC 206/21.//</B><br><br>Authority: NAVAREA XVIII 84/21 022309Z SEP 21.<br><br>Date: 022318Z SEP 21"
         },
         "styleUrl": "#NavWarnC"
      }
   ]
}
which I saved in a file.

I then used the following script in the OpenCPN JavaScript plugin to read the file, parse it into a JS object (trivial) and create the waypoint in OpenCPN. I have run this and it works. I have left (commented out) the print statements I used to develop the script.
Code:
notice = JSON.parse(readTextFile("~/Desktop/notice.json"));
//print(notice.name, "\n");
//print(notice.Placemark[0].Point.coordinates, "\n");
coordinateParts = notice.Placemark[0].Point.coordinates.split(",");
//print(coordinateParts, "\n");

// create JS waypoint object
waypoint = {position:{latitude:coordinateParts[1], longitude:coordinateParts[0]}};
waypoint.markName = notice.name;
waypoint.description = notice.description;
waypoint.iconName = "Sea-Height-Red"; // use whatever icon name you have/wish

OCPNaddSingleWaypoint(waypoint);  // add the waypoint into OCPN
Antipole is online now   Reply With Quote
Old 04-02-2022, 06:56   #8
Registered User

Join Date: Nov 2012
Location: Steinhatchee, FL
Posts: 395
Re: Navigational Warning Msgs from NGA.mil

Quote:
Originally Posted by svonadym View Post
Does anyone know if there is an easy (read: automated) way to add the coordinates from navigational warning messages sent from the National Geospatial Intelligence Agency (NGA) into ocpn for display? Most of their warnings include several (sometimes many) coordinates that can be a pain to enter for reference when in the applicable area. I was wondering if there is a plug-in or some such to help automate the view of the affected areas.
Thanks for any guidance.
Can you supply a link to the warning messages?
Be Free is offline   Reply With Quote
Old 04-02-2022, 06:57   #9
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,633
Images: 2
Re: Navigational Warning Msgs from NGA.mil

Tony That is pretty nice and might prove to be be very adequate.

I do know that Mauro added Noaa bouy information to Squiddio and might also be inclinded toadd an option for this.
rgleason is offline   Reply With Quote
Old 04-02-2022, 07:56   #10
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,211
Re: Navigational Warning Msgs from NGA.mil

Quote:
Originally Posted by Be Free View Post
Can you supply a link to the warning messages?
https://msi.nga.mil/NavWarnings

One note regarding the KMZ format they provide - at least at the moment I looked at it, it was not possible to open it in GoogleEarth (Which is the primary native viewer for it), and the KML it contained was not even valid XML...
nohal is offline   Reply With Quote
Old 04-02-2022, 15:42   #11
Registered User

Join Date: Mar 2011
Posts: 651
Re: Navigational Warning Msgs from NGA.mil

Quote:
One note regarding the KMZ format they provide - at least at the moment I looked at it, it was not possible to open it in GoogleEarth (Which is the primary native viewer for it), and the KML it contained was not even valid XML.
The kmz file is simply a compressed file. The cheats way to open it under Windows is to either rename it to something.zip, or associate a .kmz file with your favourite zip file viewer. The .kml files containing the navigational warnings will be found within the compressed file.
stevead is offline   Reply With Quote
Old 04-02-2022, 18:07   #12
Registered User

Join Date: Feb 2010
Location: Tierra del Fuego
Boat: Phantom 19
Posts: 6,211
Re: Navigational Warning Msgs from NGA.mil

I of course know what KMZ is and that there is KML inside it. What I was talking about is
Code:
 ~ xmllint ~/Downloads/NAVWARN/NAVWARN_220201.kml
/Users/nohal/Downloads/NAVWARN/NAVWARN_220201.kml:31053: parser error : XML declaration allowed only at the start of the document
<?xml version="1.0" encoding="UTF-8"?>
     ^
/Users/nohal/Downloads/NAVWARN/NAVWARN_220201.kml:54559: parser error : Opening and ending tag mismatch: Point line 54559 and coordinates
                        <coordinates>-57.054833,7.837167,0</coordinates>
                                                                        ^
/Users/nohal/Downloads/NAVWARN/NAVWARN_220201.kml:54559: parser error : Opening and ending tag mismatch: MultiGeometry line 54559 and Point
     <coordinates>-57.054833,7.837167,0</coordinates>                    </Point
                                                                               ^
/Users/nohal/Downloads/NAVWARN/NAVWARN_220201.kml:54559: parser error : Opening and ending tag mismatch: Placemark line 54551 and MultiGeometry
                </MultiGeometry>
                                ^
/Users/nohal/Downloads/NAVWARN/NAVWARN_220201.kml:54559: parser error : Opening and ending tag mismatch: Folder line 54543 and Placemark
            </Placemark>
                        ^
/Users/nohal/Downloads/NAVWARN/NAVWARN_220201.kml:136870: parser error : Opening and ending tag mismatch: Document line 31055 and Folder
    </Folder>
             ^
/Users/nohal/Downloads/NAVWARN/NAVWARN_220201.kml:136882: parser error : Opening and ending tag mismatch: kml line 31054 and Document
</Document>
           ^
/Users/nohal/Downloads/NAVWARN/NAVWARN_220201.kml:136883: parser error : Opening and ending tag mismatch: Folder line 175 and kml
</kml>
      ^
/Users/nohal/Downloads/NAVWARN/NAVWARN_220201.kml:136884: parser error : Premature end of data in tag Document line 3

^
/Users/nohal/Downloads/NAVWARN/NAVWARN_220201.kml:136884: parser error : Premature end of data in tag kml line 2
Which, among problems everywhere else, also means that the file can't be opened in the very reference software it is supposedly created for.
nohal is offline   Reply With Quote
Old 05-02-2022, 04:25   #13
Registered User
 
rgleason's Avatar

Join Date: Mar 2012
Location: Boston, MA
Boat: 1981 Bristol 32 Sloop
Posts: 17,633
Images: 2
Re: Navigational Warning Msgs from NGA.mil

So, as Tony showed, an XML to Json converter would have to be included along with decompression, to be able to use these warnings. Is the data worthwhile? How to use it most effectively?
rgleason is offline   Reply With Quote
Old 06-02-2022, 07:54   #14
Registered User

Join Date: Nov 2012
Location: Steinhatchee, FL
Posts: 395
Re: Navigational Warning Msgs from NGA.mil

Quote:
Originally Posted by nohal View Post
https://msi.nga.mil/NavWarnings

One note regarding the KMZ format they provide - at least at the moment I looked at it, it was not possible to open it in GoogleEarth (Which is the primary native viewer for it), and the KML it contained was not even valid XML...
Thank you.
Be Free is offline   Reply With Quote
Old 07-02-2022, 12:54   #15
Registered User
 
svonadym's Avatar

Join Date: Jan 2019
Location: Pacific Northwest
Boat: Cape Dory 25D
Posts: 46
Re: Navigational Warning Msgs from NGA.mil

Quote:
Originally Posted by rgleason View Post
Is the data worthwhile?
Here on the western US coast we get warnings regarding "hazardous operations", distress signals, missile tests, and falling space debris, among others. I suspect it's very similar for other navigable regions. When these warnings include several coordinates, entering each of those points manually is tedious. I'm not certain this helps to answer your question, but even if one of these events immediately concerns my piloting or navigation, it seems worthwhile to me.

Quote:
Originally Posted by rgleason View Post
How to use it most effectively?
I don't know how to answer this question. In some cases the warnings depict an area, so linking those points together (by name convention or shading or different waypoint icons?) is helpful.

Technically, I'm in over my head here. I thought I'd just paste the text from the email into an app that would parse the info and spit out a GPX file that I could then import to ocpn. For me, parsing the info programmatically when it varies somewhat from message to message is very difficult. The use of JSON and such sounds good, but I don't get the attachments mentioned. Everything I see in the messages receive is just text. For example:

"050613Z FEB 22
NAVAREA XII 68/22(18).
EASTERN NORTH PACIFIC.
CALIFORNIA.
1. HAZARDOUS OPERATIONS 101430Z TO 110130Z AND
111430Z TO 112100Z FEB IN AREA BOUND BY
32-36N 118-20W, 32-12N 119-18W,
32-22N 119-28W, 32-32N 119-18W,
33-02N 118-38W.
2. CANCEL THIS MSG 112200Z FEB 22.
-----------------------------------------------------------------------------------------
The availability of Navigational Warnings via this NGA subscription service does not relieve Masters / Captains of the requirement to receive Navigational Warnings through IMO approved broadcast services in accordance with the provisions of the International Convention for the Safety of Life at Sea. This information is provided as a supplement to those approved services.
"

Perhaps the amount of work exceeds the usability, but plotting these points with a mention of the warning number, type (e.g., "hazardous operations") and cancel date would be ideal.

Is it easier to access and open the compressed message, then translate the formatted text, or to parse the plain text after being pasted to a TXT file or UI? Is this endeavor too much hassle for the benefit?
svonadym is offline   Reply With Quote
Reply

Tags
navigation


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
Canada Navigational Warning App Kelkara Navigation 1 27-02-2021 16:25
Charts II: NGA - 2700 Charts cagney OpenCPN 1292 23-12-2013 08:46
new navigational warning light Naxos beneteau-500 Europe & Mediterranean 0 28-11-2013 01:15
Navigational warning Jim Thomsen Challenges 7 25-10-2008 04:34
NGA weekly piracy reports available Hud3 Health, Safety & Related Gear 2 15-07-2008 11:08

Advertise Here


All times are GMT -7. The time now is 00:24.


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.