Skip to content

Commit

Permalink
Merge pull request #14 from mapcomponents/fix/MlMarkerLayer-new-Data
Browse files Browse the repository at this point in the history
add getShipType function
  • Loading branch information
MartinAlzueta authored Jul 8, 2024
2 parents d22fbb4 + 7049c4d commit 2aa3c9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
8 changes: 3 additions & 5 deletions src/components/MlIconLayer/MlIconLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import React, { useRef, useMemo, useEffect, useState, useContext } from "react";
import * as d3 from "d3";

import { MapContext, SimpleDataContext } from "@mapcomponents/react-maplibre";
import DeckGlContext from "../../deckgl_components/DeckGlContext";

import { MapboxLayer } from "@deck.gl/mapbox";
import { IconLayer } from "@deck.gl/layers";

import DeckGlContext from "../../deckgl_components/DeckGlContext";
import getShipType from "./utils/getShipType";
import Ships from "./assets/Ships_v2.png";


Expand All @@ -20,11 +21,8 @@ const navStats = {
6: "aground",
7: "engaged in fishing",
8: "under way sailing",
9: "reserved for future amendment of navigational status for ships carrying DG, HS, or MP, or IMO hazard or pollutant category C, high speed craft (HSC)",
10: "reserved for future amendment of navigational status for ships carrying dangerous goods (DG), harmful substances (HS) or marine pollutants (MP), or IMO hazard or pollutant category A, wing in ground (WIG)",
11: "power-driven vessel towing astern (regional use)",
12: "power-driven vessel pushing ahead or towing alongside (regional use)",
13: "reserved for future use",
14: "AIS-SART (active), MOB-AIS, EPIRB-AIS",
15: "default",
};
Expand Down Expand Up @@ -293,7 +291,7 @@ const MlIconLayer = (props) => {
<br />
<b>Ship type:</b>
<br />
{vesselInfo.shipType}
{getShipType(vesselInfo.shipType)}
</>
)}
</div>
Expand Down
22 changes: 6 additions & 16 deletions src/components/MlIconLayer/utils/getShipType.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const vesselTypes = {
"0": "Not available (default)",
"20": "Wing in ground (WIG), all ships of this type",
"20": "Wing in ground (WIG)",
"21": "Wing in ground (WIG), Hazardous category A",
"22": "Wing in ground (WIG), Hazardous category B",
"23": "Wing in ground (WIG), Hazardous category C",
Expand All @@ -20,7 +20,7 @@ const vesselTypes = {
"37": "Pleasure Craft",
"38": "Reserved",
"39": "Reserved",
"40": "High speed craft (HSC), all ships of this type",
"40": "High speed craft (HSC)",
"41": "High speed craft (HSC), Hazardous category A",
"42": "High speed craft (HSC), Hazardous category B",
"43": "High speed craft (HSC), Hazardous category C",
Expand All @@ -40,7 +40,7 @@ const vesselTypes = {
"57": "Spare - Local Vessel",
"58": "Medical Transport",
"59": "Noncombatant ship according to RR Resolution No. 18",
"60": "Passenger, all ships of this type",
"60": "Passenger",
"61": "Passenger, Hazardous category A",
"62": "Passenger, Hazardous category B",
"63": "Passenger, Hazardous category C",
Expand All @@ -50,7 +50,7 @@ const vesselTypes = {
"67": "Passenger, Reserved for future use",
"68": "Passenger, Reserved for future use",
"69": "Passenger, No additional information",
"70": "Cargo, all ships of this type",
"70": "Cargo",
"71": "Cargo, Hazardous category A",
"72": "Cargo, Hazardous category B",
"73": "Cargo, Hazardous category C",
Expand All @@ -60,7 +60,7 @@ const vesselTypes = {
"77": "Cargo, Reserved for future use",
"78": "Cargo, Reserved for future use",
"79": "Cargo, No additional information",
"80": "Tanker, all ships of this type",
"80": "Tanker",
"81": "Tanker, Hazardous category A",
"82": "Tanker, Hazardous category B",
"83": "Tanker, Hazardous category C",
Expand All @@ -69,17 +69,7 @@ const vesselTypes = {
"86": "Tanker, Reserved for future use",
"87": "Tanker, Reserved for future use",
"88": "Tanker, Reserved for future use",
"89": "Tanker, No additional information",
"90": "Other Type, all ships of this type",
"91": "Other Type, Hazardous category A",
"92": "Other Type, Hazardous category B",
"93": "Other Type, Hazardous category C",
"94": "Other Type, Hazardous category D",
"95": "Other Type, Reserved for future use",
"96": "Other Type, Reserved for future use",
"97": "Other Type, Reserved for future use",
"98": "Other Type, Reserved for future use",
"99": "Other Type, no additional information"
"89": "Tanker, No additional information"
};

export default function getShipType(number) {
Expand Down

0 comments on commit 2aa3c9c

Please sign in to comment.