Technology for extracting instant coordinates of sea vessels in a selected part of the World Ocean from online maps

The article describes a technology that provides the extraction of instant coordinates of sea vessels in a selected part of the World Ocean from free online maps and its software implementation, consisting of two MATLAB functions: RecognizeText.m and ComporationImage.m. The first function returns the recognized ship names on the electronic chart and the coordinates of the rectangles described around the given names. The second function is the values of the coordinates of the ships, calculated from the analysis of online map. Current results confirm the performance of the developed software.


Introduction
Sea freight is one of the most important components of foreign economic activity of states, where ports are global transport and logistics providers providing freight traffic [1]. Considering the number of ships carrying out simultaneous movement in the world water space between ports of different countries, monitoring the movement of ships is an important task.
This task is of relevance in the sea straits, where congestion of many ships is possible. This is confirmed by a typical snapshot of an online map of the Kerch Strait connecting the Black and Azov seas. Here the markers correspond to the positions of the GPS signal sources. The type of marker depends on whether the ship is moving (flag) or waiting to pass (circle). The color of the marker is determined by the type of the given vessel, for example, green -cargo ships, blue -tug, red -tanker. Figure 1 shows that at the selected time there are congestions of number of ships awaiting passage through the Kerch Strait in both directions. It is possible to solve the problem of optimizing the movement of ships in sea straits with the help of automated control systems for the movement of ships (STCS), designed, inter alia, to ensure traffic safety [2]. Therefore, the development of mathematical and software STCS is the object of research by various authors [3][4][5]. It is obvious that the development of adequate mathematical models describing the movement of ships and their software implementations requires the use of the results of the analysis of statistical information on the movement of ships in the selected area of the World Ocean. The necessary information can be obtained from known sites (see, for example, [6][7][8][9]). On these sites, the current information about the movement of sea vessels, obtained from various identification systems, is visualized. A comparative analysis of the functionality of these sites and the structure of the information displayed on them made it possible to conclude that their interfaces provide users with approximately the same opportunities to access information. As a rule, on these sites in the public domain on the electronic map of the selected area of the World Ocean, the location of the ships is displayed, and when you move the mouse pointer over the corresponding ship marker, the screen displays partial information about this vessel (ship name, port of destination, dimensions). At the same time, saving this and more detailed information about the movement of ships in a file is possible only with a paid subscription. After authorization and connection of the subscription on the site, it becomes possible to turn on the layer with the display of the destination port or coordinate grid.
Therefore, the development of alternative methods that ensure the extraction of information from electronic maps that are in the public domain, in order to form a database on the movement of ships in the selected area of the World Ocean and its further use for scientific research is relevant.
The article substantiates the principles of extracting information about ships from a real-time map and describes a software tool based on these principles.

Analysis of sources of primary information
The MarineTraffic [7] website was chosen as a source of information, which without additional authorization or subscription provides the user with more information than sites [6,8,9]. An example of displaying information about a ship selected on the map is shown in figure 2.  Figure 2 shows that when choosing the appropriate scale of the map, not only ship markers are displayed on it, but also their names. In addition, the text box displays ship name, ship type (tanker, tug, passenger ship, etc.), ship status and course. Also information about the coordinates of the GPS transmitter located on the ship is displayed on the map in a test form and they are measured in angular degrees, minutes, seconds and fractions of a second, as well as the results of their conversion into the corresponding decimal values.
This information is available about each of the ships located in a selected part of the World Ocean, which could be useful for the purposes of further scientific research. Therefore, it was decided to develop a tool that provides automatic extraction of this information from online real-time maps that are freely available.

Algorithm for analysis of primary information
Consider a frame of an online real-time map of a selected area of the World Ocean, shown in figure 2. Figure 2 shows that when visualization of ships and their names, the following rules are used: • the name of the ship is placed to the right of its marker; • the name of the ship is located along a straight line parallel to the abscissa; • the ordinates of the center of gravity of the marker and each of the letters of the ship's name are the same; • the name of the ship is placed near the vessel marker.
Therefore, this algorithm can be used to determine the values of the ship coordinates on a real-time map: Recognize each of the ship names on the available fragment of the online map.
• Calculate the coordinates of rectangles circumscribed around the appropriate ship names.
• Calculate the coordinates of the midpoint of the vertical side of the rectangle closest to the ship marker. • Calculate the distance from the point in step 3 to the ship marker point.
• Take the coordinates of the point selected in item 4 as the ship's coordinates.

Software tool for map analysis
At the first stage of the automatic algorithm for extracting the coordinates of ships, described in the previous section, it is necessary to solve the problem of automatic text recognition on an electronic image of a map of a selected fragment of the World Ocean. Nowadays there are special software tools from various manufacturers for recognizing text on images. Therefore, a comparative analysis of the quality of recognition of ship names on real-time electronic maps was carried out. In this thesis were considered free computer program Tesseract, which supports, starting from version 3.0 [3] [4], text recognition in Russian, as well as a software library for optical character recognition (Optical Character Recognition − OCR), which has implementations in the programming languages Python and C ++, and also in the MATLAB package in the form of the OCR Trainer software library.
It turned out that the quality of recognition of ship names on electronic maps using the Tesseract computer program is lower than the OCR software library. At the same time, the OCR Trainer provides the user with a fairly wide functionality for working with images, building various graphs, and also provides the ability to compile a custom dictionary that can be used to exclude some characters that are recognized as text but are not text. Considering that we used the OCR Trainer while developing automatic recognition of the coordinates of ships on electronic maps. The example illustrating the results of analyzing an electronic map using the OCR Trainer is shown in figure 3.    1 show that horizontally located text and text written along a straight line passing at an angle to the boundaries of the original fragment of the electronic map are recognized. t is not difficult to exclude italic text from consideration, knowing the coordinates of the vertices of the rectangles described around the names of the ships. We also note that on fragments No. 1, 3 and 5 the ship's symbols was recognized as a text, which should be further excluded from consideration.
To calculate the coordinates of ships on an electronic map, based on the results of recognizing the names of ships using the OCR Trainer in the MATLAB package, the m-function RecognizeText.m was implemented, the input of which is sequential images of the electronic map. The RecognizeText.m function returns the text recognized on the map and the coordinates of the rectangles described around the recognized text. Then, this information is passed to the ComporationImage.m function, which returns a table containing the name of the ship, the position of the ship and the time at which these coordinates were determined. A fragment of the table is shown in figure 4. The results of comparing the values of the coordinates of ships, calculated using the developed tool, and data with the corresponding GPS-coordinates are discussed in the next section.

Confirmation of the functionality of the developed software tool
To confirm the performance of the developed algorithm, we will consider the results of automatic determination of the coordinates of ships moving in the water area of the Kerch Strait. Figure 5 shows a map with a scale of 1 km, on which the names of ships and their coordinates, presented in table 2, were automatically found.   Table 2 shows that the error in calculating the coordinates is 0.01% and is associated with rounding off the values of the variables in the calculations. Figure 6 shows a fragment of the map, with superimposed on it the trajectory of the ship "Scola", built using GPS-coordinates and coordinates calculated from the analysis of 5 consecutive real-time maps recorded with a step of 20 minutes.    Figure 7 shows that 55% (186) of ships were waiting for passage through the Kerch Strait less than one hour, while 19.1% (64) of ships were waiting for passage more than 24 hours, and 3.8% (13) of ships were more than 10 hours.
Knowing the coordinates of the ships, it is possible to track the direction of their movement through the strait and count the number of ships that passed from the Black Sea to the Sea of Azov and back (figure 8).  Also, based on information extracted from electronic maps, it is possible to analyze the dynamics of the number of ships in the selected port. This is confirmed by figure 9, which shows the dependence of the number of ships in the port of Kerch in the period from 3 to 9 August 2020. Figure 9 shows that the largest number of ships in the port of Kerch for the selected period appeared at 11:30 (7 ships) and at 17:30 (8 ships).
A more detailed analysis of data on the movement of ships in the Kerch Strait is the subject of subsequent publications.  Figure 9. Dependence of the number of ships on the time of day.

Conclusion
The paper proposes a technology for extracting information from electronic maps of a selected part of the World Ocean, and its software implementation. This technology is based on the recognition of ship names displayed on online maps of the movement of ships, and on the calculation of the coordinates of ships based on the values of the coordinates of the vertices of the rectangles described around the received names. Estimates of the accuracy of calculating coordinates on online maps have been obtained, indicating that the difference between the calculated values of coordinates and similar values of GPScoordinates does not exceed 0.01%.
The availability of the developed technology makes it possible to form a database containing information on the names of ships in the selected area of the World Ocean and their coordinates at known times. Further analysis of the information contained in this database will make it possible to study the features of the movement of ships, including in sea straits. Knowledge of these features will make it possible to build adequate mathematical models describing the movement of sea vessels, which are necessary for the development of an automated control system for the movement of sea vessels.