org-arl / leaflet-tracksymbol2 Goto Github PK
View Code? Open in Web Editor NEWLeaflet plugin for showing tracks with heading, course and speed.
Home Page: https://org-arl.github.io/leaflet-tracksymbol2/
License: MIT License
Leaflet plugin for showing tracks with heading, course and speed.
Home Page: https://org-arl.github.io/leaflet-tracksymbol2/
License: MIT License
aismaps.js:40 Error fetching AIS data: TypeError: Cannot read properties of null (reading 'toString')
at Ei (aisTrackSymbol.ts:373:25)
const aisItem = {
"id": 373001,
"sensor_data_id": 419208,
"vessel_id": 1222,
"latitude": "-9.6449217",
"longitude": "114.7692100",
"speed": "11.50",
"course": 54,
"heading": 53,
"navigation_status": "Under way using engine",
"turning_rate": 0,
"is_inside_geofence": null,
"turning_direction": 1,
"timestamp": "2023-12-13 04:20:48",
"distance": "513.63",
"created_at": "2023-12-13T04:20:48.000000Z",
"updated_at": "2023-12-13T04:20:48.000000Z",
"vessel": {
"id": 1222,
"vessel_name": null,
"vessel_type": null,
"mmsi": "636093023",
"imo": null,
"callsign": null,
"draught": null,
"dimension_to_bow": null,
"dimension_to_stern": null,
"dimension_to_port": null,
"dimension_to_starboard": null,
"reported_destination": null,
"out_of_range": "0",
"type_number": null,
"reported_eta": null,
"created_at": "2023-12-13T04:20:48.000000Z",
"updated_at": "2023-12-13T04:20:48.000000Z"
},
"sensor_data": {
"id": 419208,
"sensor_id": 1,
"payload": "!ABVDM,1,1,,B,19N`2Gh0Ak8=GjerNjej61cN00Ra,0*02",
"timestamp": "2023-12-13 04:20:48",
"created_at": "2023-12-13T04:20:48.000000Z",
"updated_at": "2023-12-13T04:20:48.000000Z",
"sensor": {
"id": 1,
"datalogger_id": 1,
"name": "AIS",
"status": "Active",
"interval": 5,
"jarak": 20,
"jumlah_data": 200,
"created_at": "2023-12-02T09:16:49.000000Z",
"updated_at": "2023-12-02T09:16:49.000000Z",
"datalogger": {
"id": 1,
"name": "Datalogger 1",
"serial_number": "DL001",
"latitude": "-6.2256992",
"longitude": "106.8503082",
"status": "Online",
"installation_date": "2022-01-01",
"last_online": "2023-05-24 12:34:56",
"coverage": null,
"created_at": "2023-12-02T09:16:49.000000Z",
"updated_at": "2023-12-02T09:16:49.000000Z"
}
}
}
};
const p1 = [+aisItem.latitude || 0, +aisItem.longitude || 0];
const trueHeading1 = aisItem.heading || 0;
const cog1 = aisItem.course || 0;
const sog1 = +aisItem.speed || 0;
// Creating the PositionReport
let positionReport1 = {
latitude: p1[0],
longitude: p1[1],
trueHeading: trueHeading1,
cog: cog1,
sog: sog1,
};
const aisTrackSymbol = new L.AISTrackSymbol(positionReport1, {
shipStaticData: {
userId: aisItem.vessel.id || 0,
imoNumber: aisItem.vessel.imo || 0,
callSign: aisItem.vessel.callsign || "",
name: aisItem.vessel.vessel_name || "",
type: aisItem.vessel.type_number || 0,
dimension: {
A: aisItem.vessel.dimension_to_bow || 0,
B: aisItem.vessel.dimension_to_stern || 0,
C: aisItem.vessel.dimension_to_port || 0,
D: aisItem.vessel.dimension_to_starboard || 0,
},
fixType: aisItem.vessel.out_of_range || 0,
eta: {
month: aisItem.vessel.reported_eta
? new Date(aisItem.vessel.reported_eta).getMonth() + 1
: null,
day: aisItem.vessel.reported_eta
? new Date(aisItem.vessel.reported_eta).getDate()
: null,
hour: aisItem.vessel.reported_eta
? new Date(aisItem.vessel.reported_eta).getHours()
: null,
minute: aisItem.vessel.reported_eta
? new Date(aisItem.vessel.reported_eta).getMinutes()
: null,
},
destination: aisItem.vessel.reported_destination || "",
dte: aisItem.vessel.dte === "1",
},
});
aisTrackSymbol.bindTooltip(aisItem.vessel.vessel_name || "");
aisTrackSymbol.addTo(map);
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.