Fix bug with 0.000 coords
This commit is contained in:
parent
7c643b209a
commit
93d6328dea
@ -28,6 +28,15 @@ function addFrequencies (type, value) {
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Hack to avoid https://github.com/ianengelbrecht/geo-coordinates-parser/issues/1
|
||||
* @param {*} coordinate
|
||||
*/
|
||||
|
||||
function cleanCoord(coordinate) {
|
||||
return coordinate.replace('0.000', '0.001')
|
||||
}
|
||||
|
||||
exports.addFeature = function (feature) {
|
||||
featureLookup[feature.id] = new Array();
|
||||
}
|
||||
@ -115,7 +124,12 @@ exports.readGroundnetXML = function (fDir, icao, force) {
|
||||
taxiNodes.map(n => {
|
||||
//attrs.lat
|
||||
//console.log(n.attr('lat') + " " + n.attr('lon'));
|
||||
var latlon = convert(n.attr('lat') + " " + n.attr('lon'));
|
||||
try {
|
||||
var latlon = convert(cleanCoord(n.attr('lat')) + " " + cleanCoord(n.attr('lon')));
|
||||
} catch (error) {
|
||||
console.warn(n.attr('lat') + " " + n.attr('lon'));
|
||||
convert(cleanCoord(n.attr('lat')) + " " + cleanCoord(n.attr('lon')));
|
||||
}
|
||||
//console.log(latlon.decimalLatitude);
|
||||
|
||||
layerGroup.maxId = Math.max(layerGroup.maxId, Number(n.attr('index')))
|
||||
@ -167,8 +181,8 @@ exports.readGroundnetXML = function (fDir, icao, force) {
|
||||
});
|
||||
}
|
||||
if (!bidirectional) {
|
||||
var beginlatlon = convert(beginNode.attr('lat') + " " + beginNode.attr('lon'));
|
||||
var endlatlon = convert(endNode.attr('lat') + " " + endNode.attr('lon'));
|
||||
var beginlatlon = convert(cleanCoord(beginNode.attr('lat')) + " " + cleanCoord(beginNode.attr('lon')));
|
||||
var endlatlon = convert(cleanCoord(endNode.attr('lat')) + " " + cleanCoord(endNode.attr('lon')));
|
||||
var polyline = new L.Polyline([[beginlatlon.decimalLatitude, beginlatlon.decimalLongitude], [endlatlon.decimalLatitude, endlatlon.decimalLongitude]], { attributes: {} }).addTo(layerGroup);
|
||||
extendTaxiSegment(polyline);
|
||||
polyline.addListeners();
|
||||
|
Loading…
Reference in New Issue
Block a user