-
-
Save myh-st/268c5000b54f4abec46e521efb1c156f to your computer and use it in GitHub Desktop.
Revisions
-
pjobson revised this gist
Jul 8, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -51,7 +51,7 @@ IN JS: Combined: patterns.lat.combined = new RegExp(`^(${patterns.lat.map(tt => `(${tt.toString().replace(/^\/\^(.+?)\$\//g,'$1')})`).join('|')})$`); patterns.lng.combined = new RegExp(`^(${patterns.lng.map(tt => `(${tt.toString().replace(/^\/\^(.+?)\$\//g,'$1')})`).join('|')})$`) -
pjobson revised this gist
Jul 8, 2021 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -51,7 +51,7 @@ IN JS: Combined: patterns.lat.combined = new RegExp(`^(${patterns.lat.map(tt => tt => `(${tt.toString().replace(/^\/\^(.+?)\$\//g,'$1')})`).join('|')})$`); patterns.lng.combined = new RegExp(`^(${patterns.lng.map(tt => tt => `(${tt.toString().replace(/^\/\^(.+?)\$\//g,'$1')})`).join('|')})$`) -
pjobson revised this gist
Feb 20, 2019 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,8 +9,8 @@ Degrees Minutes Seconds (DMS) Use N, S, E or W as either the last character, which represents a compass direction North, South, East or West. D & M must be intergers, S may be an interger or float. DMS.latitude - /^[\+-]?(([1-8]?\d)\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|90\D+0\D+0)\D+[NSns]?$/ DMS.longitude - /^[\+-]?([1-7]?\d{1,2}\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|180\D+0\D+0)\D+[EWew]?$/ Degrees Decimal Minutes (DDM) 40° 26.767′ N 79° 58.933′ W @@ -22,17 +22,17 @@ Degrees Decimal Minutes (DDM) which represents a compass direction North, South, East or West. The last degree, minute, or second of a latitude or longitude may contain a decimal portion. DDM.latitude - /^[\+-]?(([1-8]?\d)\D+[1-6]?\d(\.\d{1,})?|90(\D+0)?)\D+[NSns]?$/ DDM.longitude - /^[\+-]?((1[0-7]\d|[1-9]?\d)\D+[1-6]?\d(\.\d{1,})?|180(\D+0)?)\D+[EWew]?$/ Decimal Degrees (DD) 40.446° N 79.982° W Precede South latitudes and West longitudes with a minus sign. Latitudes range from -90 to 90 Longitudes range from -180 to 180 Up to 6 decimal places DD.latitude - /^[\+-]?(([1-8]?\d)(\.\d{1,})?|90)\D*[NSns]?$/ DD.longitude - /^[\+-]?((1[0-7]\d|[1-9]?\d)(\.\d{1,})?|180)\D*[EWew]?$/ IN JS: -
pjobson revised this gist
Feb 7, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,8 +31,8 @@ Decimal Degrees (DD) Latitudes range from -90 to 90 Longitudes range from -180 to 180 Up to 6 decimal places DD.latitude - /^[\+-]?(([1-8]?[0-9])(\.\d{1,6})?|90)\D*[NSns]?$/ DD.longitude - /^[\+-]?((1[0-7][0-9]|[1-9]?[0-9])(\.\d{1,6})?|180)\D*[EWew]?$/ IN JS: -
pjobson created this gist
Aug 27, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,57 @@ Degrees Minutes Seconds (DMS) 40° 26′ 46″ N 79° 58′ 56″ W 40° 26′ 46″ S 79° 58′ 56″ E 90° 0′ 0″ S 180° 0′ 0″ E 40° 26′ 45.9996″ N 79° 58′ 55.2″ E Latitudes range from 0 to 90. Longitudes range from 0 to 180. Minutes & Seconds range from 0-60 Use N, S, E or W as either the last character, which represents a compass direction North, South, East or West. D & M must be intergers, S may be an interger or float. DMS.latitude - /^(([1-8]?[0-9])\D+([1-5]?[0-9]|60)\D+([1-5]?[0-9]|60)(\.[0-9]+)?|90\D+0\D+0)\D+[NSns]$/ DMS.longitude - /^([1-7]?[0-9]\D+([1-5]?[0-9]|60)\D+([1-5]?[0-9]|60)(\.[0-9]+)?|180\D+0\D+0)\D+[EWew]$/ Degrees Decimal Minutes (DDM) 40° 26.767′ N 79° 58.933′ W 90° 0′ N 180° 0′ W 90° N 180° W Latitudes range from 0 to 90. Longitudes range from 0 to 180. Use N, S, E or W as either the last character, which represents a compass direction North, South, East or West. The last degree, minute, or second of a latitude or longitude may contain a decimal portion. DDM.latitude - /^(([1-8]?[0-9])\D+[1-6]?[0-9](\.\d{1,3})?|90(\D+0)?)\D+([NSns])$/ DDM.longitude - /^((1[0-7][0-9]|[1-9]?[0-9])\D+[1-6]?[0-9](\.\d{1,3})?|180(\D+0)?)\D+([EWew])$/ Decimal Degrees (DD) 40.446° N 79.982° W Precede South latitudes and West longitudes with a minus sign. Latitudes range from -90 to 90 Longitudes range from -180 to 180 Up to 6 decimal places DD.latitude - /^[\+-]?(([1-8]?[0-9])(\.\d{1,6})?|90)\D*[NS]?$/ DD.longitude - /^[\+-]?((1[0-7][0-9]|[1-9]?[0-9])(\.\d{1,6})?|180)\D*[EW]?$/ IN JS: const patterns = { lat: { isDMS: /^(([1-8]?[0-9])\D+([1-5]?[0-9]|60)\D+([1-5]?[0-9]|60)(\.[0-9]+)?|90\D+0\D+0)\D+[NSns]$/, isDDM: /^(([1-8]?[0-9])\D+[1-6]?[0-9](\.\d{1,3})?|90(\D+0)?)\D+([NSns])$/, isDD: /^[\+-]?(([1-8]?[0-9])(\.\d{1,6})?|90)\D*[NSns]?$/ }, lng: { isDMS: /^((1[0-7][0-9]|[1-9]?[0-9])\D+([1-5]?[0-9]|60)\D+([1-5]?[0-9]|60)(\.[0-9]+)?|180\D+0\D+0)\D+[EWew]$/, isDDM: /^((1[0-7][0-9]|[1-9]?[0-9])\D+[1-6]?[0-9](\.\d{1,3})?|180(\D+0)?)\D+([EWew])$/, isDD: /^[\+-]?((1[0-7][0-9]|[1-9]?[0-9])(\.\d{1,6})?|180)\D*[EWew]?$/ } }; Combined: patterns.lat.combined = new RegExp(`^(${_.map(patterns.lat, tt => `(${tt.toString().replace(/^\/\^(.+?)\$\//g,'$1')})`).join('|')})$`); patterns.lng.combined = new RegExp(`^(${_.map(patterns.lng, tt => `(${tt.toString().replace(/^\/\^(.+?)\$\//g,'$1')})`).join('|')})$`);