Skip to content

Commit 67bcf96

Browse files
committed
Small bug-fixes and additions to visualization.
1 parent 71a9a91 commit 67bcf96

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

viz/app.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,12 @@ casedata = mod_casedata.get_casedata();
5959
// Source data GeoJSON
6060
const geodata = casedata['geojsondata']
6161

62-
62+
const style='pos';
6363
const MAP_STYLE = {
6464
pos_no_label: 'https://basemaps.cartocdn.com/gl/positron-nolabels-gl-style/style.json',
6565
pos: 'https://basemaps.cartocdn.com/gl/positron-gl-style/style.json',
66-
dark: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json'
66+
dark: 'https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json',
67+
none:''
6768
};
6869

6970

@@ -402,9 +403,10 @@ export default function App({ refdata = data, refflowdata = flowdata, ggdata = g
402403
popup.name = info.object.properties.NAME
403404
popup.info = "Substation Info"
404405
} else {
405-
var popup = {};
406-
popup.name = info.object.properties.NAME
407-
popup.info = "Line Info"
406+
var popup = {};
407+
var loading = Math.abs(info.object.properties.PF / info.object.properties.RATE_A)*100.0;
408+
popup.name = info.object.properties.NAME
409+
popup.info = "KV: "+info.object.properties.KV.toFixed(2)+"KV \nLoading: "+loading.toFixed(2)+ "%";
408410
}
409411
setShowPopup(showPopup => ({ ...showPopup, ...popup }));
410412
} else if (info.layer.id == "gen-column") {
@@ -1479,7 +1481,7 @@ export default function App({ refdata = data, refflowdata = flowdata, ggdata = g
14791481

14801482

14811483
<StaticMap reuseMaps
1482-
mapStyle={mapStyle['pos']}
1484+
mapStyle={mapStyle[style]}
14831485
preventStyleDiffing={true}
14841486
initialViewState={INITIAL_VIEW_STATE}
14851487
>

viz/src/dataprocess.js

+14-4
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,9 @@ function getArea(data,area_num) {
283283
};
284284

285285
var areahull = convex(filteredGeoJSON);
286-
areahull.properties ={name: area_num};
286+
if(areahull) {
287+
areahull.properties ={name: area_num};
288+
}
287289

288290
return areahull;
289291
}
@@ -293,7 +295,10 @@ function getAreas(sysdata) {
293295
var areas = [];
294296

295297
for(var i = 0; i < sysdata.nareas; i++) {
296-
areas.push(getArea(sysdata.geojsondata,sysdata.areas[i]));
298+
var area = getArea(sysdata.geojsondata,sysdata.areas[i]);
299+
if(area) {
300+
areas.push(area);
301+
}
297302
}
298303

299304
return {type:"FeatureCollection", features:areas};
@@ -312,7 +317,9 @@ function getZone(data,zone_num) {
312317
};
313318

314319
var zonehull = convex(filteredGeoJSON);
315-
zonehull.properties ={name: zone_num};
320+
if(zonehull) {
321+
zonehull.properties ={name: zone_num};
322+
}
316323

317324
return zonehull;
318325
}
@@ -322,7 +329,10 @@ function getZones(sysdata) {
322329
var zones = [];
323330

324331
for(var i = 0; i < sysdata.nzones; i++) {
325-
zones.push(getZone(sysdata.geojsondata,sysdata.zones[i]));
332+
var zone = getZone(sysdata.geojsondata,sysdata.zones[i]);
333+
if(zone) {
334+
zones.push(zone);
335+
}
326336
}
327337

328338
return {type:"FeatureCollection", features:zones};

0 commit comments

Comments
 (0)