profile filtering and submissions fixes

This commit is contained in:
stopflock
2025-08-05 17:30:55 -05:00
parent e5ae245013
commit dcdff6abbd
4 changed files with 20 additions and 18 deletions
+8 -11
View File
@@ -15,21 +15,18 @@ class OverpassService {
) async {
if (profiles.isEmpty) return [];
// Build regex of surveillance:type values from enabled profiles
final types = profiles
.map((p) => p.tags['surveillance:type'])
.whereType<String>()
.toSet();
final regex = types.join('|');
// Build one node query per enabled profile (each with all its tags required)
final nodeClauses = profiles.map((profile) {
final tagFilters = profile.tags.entries
.map((e) => '["${e.key}"="${e.value}"]')
.join('\n ');
return '''node\n $tagFilters\n (${bbox.southWest.latitude},${bbox.southWest.longitude},\n ${bbox.northEast.latitude},${bbox.northEast.longitude});''';
}).join('\n ');
final query = '''
[out:json][timeout:25];
(
node
["man_made"="surveillance"]
["surveillance:type"~"^(${regex})\$"]
(${bbox.southWest.latitude},${bbox.southWest.longitude},
${bbox.northEast.latitude},${bbox.northEast.longitude});
$nodeClauses
);
out body 250;
''';