Skip to content

Commit

Permalink
Fix lat/long parsing issue
Browse files Browse the repository at this point in the history
  • Loading branch information
fdesjardins committed Aug 28, 2019
1 parent 469f575 commit d9c8933
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,21 @@ const extractBoundary = TFRAreaGroup => {
remark: TFRAreaGroup.abdMergedArea.txtRmk._text,
datum: TFRAreaGroup.abdMergedArea.Avx[0].codeDatum._text,
type: TFRAreaGroup.abdMergedArea.Avx[0].codeType._text,
vertices: TFRAreaGroup.abdMergedArea.Avx.map(avx => [
parseFloat(avx.geoLat._text.replace('N', '')),
parseFloat(avx.geoLong._text.replace('W', ''))
])
vertices: TFRAreaGroup.abdMergedArea.Avx.map(avx => {
let lat = avx.geoLat._text
if (lat.includes('S')) {
lat = -1 * parseFloat(lat.replace('S', ''))
} else {
lat = parseFloat(lat.replace('N', ''))
}
let long = avx.geoLong._text
if (long.includes('W')) {
long = -1 * parseFloat(long.replace('W', ''))
} else {
long = parseFloat(long.replace('E', ''))
}
return [ lat, long ]
})
}
}

Expand Down

0 comments on commit d9c8933

Please sign in to comment.