Expand DMS format and fix sec rounding logic (#10066)

Most DMS format parsed by @mapbox/sexagesimal, 
add a expandable matcher and two new formats for coordinates in DMS format in search bar

example: `35 11 10.1 , 136 49 53.8` (D M SS format), or `35 11.168 , 136 49.896` (D MM format)
This commit is contained in:
NaVis0mple
2024-02-02 22:26:47 +08:00
committed by GitHub
parent 8d1c1cfbce
commit 01d650d450
6 changed files with 146 additions and 28 deletions
+2 -2
View File
@@ -5,7 +5,7 @@ import * as sexagesimal from '@mapbox/sexagesimal';
import { presetManager } from '../presets';
import { t } from '../core/localizer';
import { dmsCoordinatePair } from '../util/units';
import { dmsCoordinatePair, dmsMatcher } from '../util/units';
import { coreGraph } from '../core/graph';
import { geoSphericalDistance } from '../geo/geo';
import { geoExtent } from '../geo';
@@ -125,7 +125,7 @@ export function uiFeatureList(context) {
if (!q) return result;
var locationMatch = sexagesimal.pair(q.toUpperCase()) || q.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/);
var locationMatch = sexagesimal.pair(q.toUpperCase()) || dmsMatcher(q);
if (locationMatch) {
var loc = [Number(locationMatch[0]), Number(locationMatch[1])];