Я пытаюсь интегрировать данные Polygons в OpenStreetMap в виджете карты ThingsBoard.
У меня есть данные, сохраненные в виде файла GeoJSON, и я также преобразовал их в список полигонов (другой список), состоящий из значений [LAT, long].
Не уверен, как добавить файл в карту, и у меня нет выбора использовать мою собственную карту / ссылку OpenStreetMap.
Я попытался вставить следующие строки в функцию "onInit" виджета, но не могу загрузить его успешно.
Вот код, который я добавил к атрибуту 'controllerScript' в JSON виджета.
self.onInit = function() {
\n\tself.ctx.map = new TbMapWidgetV2('openstreet-map', false, self.ctx);
\n\tself.ctx.map.location.polygon = self.ctx.map.createPolygon(
ListOfLatLnGPolygons, self.ctx.map.location.settings, self.ctx.map.location,
function (event)
\n{
\n\tself.ctx.map.callbacks.onLocationClick(self.ctx.map.location);
\n\tself.ctx.map.locationPolygonClick(event, self.ctx.map.location);
\n}, self.ctx.map.location.dsIndex);
\n\tself.ctx.map.polygons.push(self.ctx.map.location.polygon);
\n}
\nself.onDataUpdated = function() {
\n\tself.ctx.map.update();
\n}
\n
\nself.onResize = function() {
\n\tself.ctx.map.resize();
\n}
\n
\nself.getSettingsSchema = function() {
\n\treturn TbMapWidgetV2.settingsSchema('openstreet-map');
\n}
\n
\nself.getDataKeySettingsSchema = function() {
\n\treturn TbMapWidgetV2.dataKeySettingsSchema('openstreet-map');
\n}
\n
\nself.actionSources = function() {
\n\treturn TbMapWidgetV2.actionSources();
\n}
\n
\nself.onDestroy = function() {
\n}
\n