better geojson sidc icon handling

This commit is contained in:
Dave Conway-Jones 2022-04-02 23:52:27 +01:00
parent 70bc32d049
commit c4bdb031e5
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
3 changed files with 15 additions and 2 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap ### Change Log for Node-RED Worldmap
- v2.27.4 - Better Handling of sidc icons in geojson
- v2.27.3 - Try to handle greatcircles crossing antimeridian - v2.27.3 - Try to handle greatcircles crossing antimeridian
- v2.27.1 - Reload existing markers for late joiners - v2.27.1 - Reload existing markers for late joiners
- v2.26.1 - Add QTH/Maidenhead option also - v2.26.1 - Add QTH/Maidenhead option also

View File

@ -11,6 +11,7 @@ map web page for plotting "things" on.
### Updates ### Updates
- v2.27.4 - Better Handling of sidc icons in geojson
- v2.27.3 - Try to handle greatcircles crossing antimeridian - v2.27.3 - Try to handle greatcircles crossing antimeridian
- v2.27.1 - Reload existing markers for late joiners - v2.27.1 - Reload existing markers for late joiners
- v2.26.1 - Add QTH/Maidenhead option also - v2.26.1 - Add QTH/Maidenhead option also

View File

@ -2661,14 +2661,25 @@ function doGeojson(n,g,l,o) {
}} }}
opt.pointToLayer = function (feature, latlng) { opt.pointToLayer = function (feature, latlng) {
var myMarker; var myMarker;
if (feature.properties.hasOwnProperty("icon")) {
var regi = /^[S,G,E,I,O][A-Z]{3}.*/i; // if it looks like a SIDC code
if (regi.test(feature.properties.icon)) {
feature.properties.SIDC = (feature.properties.icon.toUpperCase()+"------------").substr(0,12);
delete feature.properties.icon;
}
}
if (feature.properties.hasOwnProperty("SIDC")) { if (feature.properties.hasOwnProperty("SIDC")) {
myMarker = new ms.Symbol( feature.properties.SIDC.toUpperCase(), { myMarker = new ms.Symbol( feature.properties.SIDC.toUpperCase(), {
uniqueDesignation:unescape(encodeURIComponent(feature.properties.title)) , uniqueDesignation:unescape(encodeURIComponent(feature.properties.title||feature.properties.unit)),
country:feature.properties.country, country:feature.properties.country,
direction:feature.properties.bearing, direction:feature.properties.bearing,
additionalInformation:feature.properties.modifier, additionalInformation:feature.properties.modifier,
size:24 size:25
}); });
if (myMarker.hasOwnProperty("metadata") && myMarker.metadata.hasOwnProperty("echelon")) {
var sz = iconSz[myMarker.metadata.echelon];
myMarker.setOptions({size:sz});
}
myMarker = L.icon({ myMarker = L.icon({
iconUrl: myMarker.toDataURL(), iconUrl: myMarker.toDataURL(),
iconAnchor: [myMarker.getAnchor().x, myMarker.getAnchor().y], iconAnchor: [myMarker.getAnchor().x, myMarker.getAnchor().y],