mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-19 17:43:39 +00:00
Merge pull request #7995 from openstreetmap/coord-search
Fix GPS coordinate searches returning OSM elements
This commit is contained in:
@@ -122,19 +122,6 @@ export function uiFeatureList(context) {
|
||||
|
||||
if (!q) return result;
|
||||
|
||||
var idMatch = q.match(/(?:^|\W)(node|way|relation|[nwr])\W?0*([1-9]\d*)(?:\W|$)/i);
|
||||
|
||||
if (idMatch) {
|
||||
var elemType = idMatch[1].charAt(0);
|
||||
var elemId = idMatch[2];
|
||||
result.push({
|
||||
id: elemType + elemId,
|
||||
geometry: elemType === 'n' ? 'point' : elemType === 'w' ? 'line' : 'relation',
|
||||
type: elemType === 'n' ? t('inspector.node') : elemType === 'w' ? t('inspector.way') : t('inspector.relation'),
|
||||
name: elemId
|
||||
});
|
||||
}
|
||||
|
||||
var locationMatch = sexagesimal.pair(q.toUpperCase()) || q.match(/^(-?\d+\.?\d*)\s+(-?\d+\.?\d*)$/);
|
||||
|
||||
if (locationMatch) {
|
||||
@@ -148,6 +135,20 @@ export function uiFeatureList(context) {
|
||||
});
|
||||
}
|
||||
|
||||
// A location search takes priority over an ID search
|
||||
var idMatch = !locationMatch && q.match(/(?:^|\W)(node|way|relation|[nwr])\W?0*([1-9]\d*)(?:\W|$)/i);
|
||||
|
||||
if (idMatch) {
|
||||
var elemType = idMatch[1].charAt(0);
|
||||
var elemId = idMatch[2];
|
||||
result.push({
|
||||
id: elemType + elemId,
|
||||
geometry: elemType === 'n' ? 'point' : elemType === 'w' ? 'line' : 'relation',
|
||||
type: elemType === 'n' ? t('inspector.node') : elemType === 'w' ? t('inspector.way') : t('inspector.relation'),
|
||||
name: elemId
|
||||
});
|
||||
}
|
||||
|
||||
var allEntities = graph.entities;
|
||||
var localResults = [];
|
||||
for (var id in allEntities) {
|
||||
|
||||
Reference in New Issue
Block a user