feat: build MapSift Overpass data explorer
This commit is contained in:
65
src/features/search/presets.ts
Normal file
65
src/features/search/presets.ts
Normal file
@@ -0,0 +1,65 @@
|
||||
import type { OsmTagFilter, SearchPresetId } from './types';
|
||||
|
||||
export type SearchPreset = {
|
||||
id: SearchPresetId;
|
||||
label: string;
|
||||
tag: OsmTagFilter;
|
||||
};
|
||||
|
||||
export const searchPresets: SearchPreset[] = [
|
||||
{
|
||||
id: 'drinking_water',
|
||||
label: 'Drinking water',
|
||||
tag: { key: 'amenity', value: 'drinking_water' },
|
||||
},
|
||||
{
|
||||
id: 'toilets',
|
||||
label: 'Public toilets',
|
||||
tag: { key: 'amenity', value: 'toilets' },
|
||||
},
|
||||
{
|
||||
id: 'bicycle_parking',
|
||||
label: 'Bicycle parking',
|
||||
tag: { key: 'amenity', value: 'bicycle_parking' },
|
||||
},
|
||||
{
|
||||
id: 'hotels',
|
||||
label: 'Hotels',
|
||||
tag: { key: 'tourism', value: 'hotel' },
|
||||
},
|
||||
{
|
||||
id: 'restaurants',
|
||||
label: 'Restaurants',
|
||||
tag: { key: 'amenity', value: 'restaurant' },
|
||||
},
|
||||
{
|
||||
id: 'cafes',
|
||||
label: 'Cafes',
|
||||
tag: { key: 'amenity', value: 'cafe' },
|
||||
},
|
||||
{
|
||||
id: 'shops',
|
||||
label: 'Shops',
|
||||
tag: { key: 'shop' },
|
||||
},
|
||||
{
|
||||
id: 'benches',
|
||||
label: 'Benches',
|
||||
tag: { key: 'amenity', value: 'bench' },
|
||||
},
|
||||
{
|
||||
id: 'atms',
|
||||
label: 'ATMs',
|
||||
tag: { key: 'amenity', value: 'atm' },
|
||||
},
|
||||
];
|
||||
|
||||
export function getPresetById(id: SearchPresetId): SearchPreset {
|
||||
const preset = searchPresets.find((item) => item.id === id);
|
||||
|
||||
if (!preset) {
|
||||
throw new Error(`Unknown preset: ${id}`);
|
||||
}
|
||||
|
||||
return preset;
|
||||
}
|
||||
Reference in New Issue
Block a user