Compare commits
3 Commits
c33fe3b268
...
f01730fef5
| Author | SHA1 | Date | |
|---|---|---|---|
|
f01730fef5
|
|||
|
448c51bab6
|
|||
|
0bcbae374b
|
@@ -60,7 +60,9 @@ import camera from '@waysidemapping/pinhead/dist/icons/camera.svg?raw';
|
|||||||
import boxingGloveUp from '@waysidemapping/pinhead/dist/icons/boxing_glove_up.svg?raw';
|
import boxingGloveUp from '@waysidemapping/pinhead/dist/icons/boxing_glove_up.svg?raw';
|
||||||
import car from '@waysidemapping/pinhead/dist/icons/car.svg?raw';
|
import car from '@waysidemapping/pinhead/dist/icons/car.svg?raw';
|
||||||
import carAndWrench from '@waysidemapping/pinhead/dist/icons/car_and_wrench.svg?raw';
|
import carAndWrench from '@waysidemapping/pinhead/dist/icons/car_and_wrench.svg?raw';
|
||||||
|
import castleKeep from '@waysidemapping/pinhead/dist/icons/castle_keep.svg?raw';
|
||||||
import cigaretteWithSmokeCurl from '@waysidemapping/pinhead/dist/icons/cigarette_with_smoke_curl.svg?raw';
|
import cigaretteWithSmokeCurl from '@waysidemapping/pinhead/dist/icons/cigarette_with_smoke_curl.svg?raw';
|
||||||
|
import cityGate from '@waysidemapping/pinhead/dist/icons/city_gate.svg?raw';
|
||||||
import classicalBuilding from '@waysidemapping/pinhead/dist/icons/classical_building.svg?raw';
|
import classicalBuilding from '@waysidemapping/pinhead/dist/icons/classical_building.svg?raw';
|
||||||
import classicalBuildingWithClock from '@waysidemapping/pinhead/dist/icons/classical_building_with_clock.svg?raw';
|
import classicalBuildingWithClock from '@waysidemapping/pinhead/dist/icons/classical_building_with_clock.svg?raw';
|
||||||
import classicalBuildingWithDomeAndFlag from '@waysidemapping/pinhead/dist/icons/classical_building_with_dome_and_flag.svg?raw';
|
import classicalBuildingWithDomeAndFlag from '@waysidemapping/pinhead/dist/icons/classical_building_with_dome_and_flag.svg?raw';
|
||||||
@@ -90,6 +92,7 @@ import grecianVase from '@waysidemapping/pinhead/dist/icons/grecian_vase.svg?raw
|
|||||||
import greekCross from '@waysidemapping/pinhead/dist/icons/greek_cross.svg?raw';
|
import greekCross from '@waysidemapping/pinhead/dist/icons/greek_cross.svg?raw';
|
||||||
import iceCreamOnCone from '@waysidemapping/pinhead/dist/icons/ice_cream_on_cone.svg?raw';
|
import iceCreamOnCone from '@waysidemapping/pinhead/dist/icons/ice_cream_on_cone.svg?raw';
|
||||||
import industrialBuilding from '@waysidemapping/pinhead/dist/icons/industrial_building.svg?raw';
|
import industrialBuilding from '@waysidemapping/pinhead/dist/icons/industrial_building.svg?raw';
|
||||||
|
import infoI from '@waysidemapping/pinhead/dist/icons/info_i.svg?raw';
|
||||||
import jewel from '@waysidemapping/pinhead/dist/icons/jewel.svg?raw';
|
import jewel from '@waysidemapping/pinhead/dist/icons/jewel.svg?raw';
|
||||||
import lowriseBuilding from '@waysidemapping/pinhead/dist/icons/lowrise_building.svg?raw';
|
import lowriseBuilding from '@waysidemapping/pinhead/dist/icons/lowrise_building.svg?raw';
|
||||||
import marketStall from '@waysidemapping/pinhead/dist/icons/market_stall.svg?raw';
|
import marketStall from '@waysidemapping/pinhead/dist/icons/market_stall.svg?raw';
|
||||||
@@ -159,6 +162,7 @@ const ICONS = {
|
|||||||
'chevron-left': chevronLeft,
|
'chevron-left': chevronLeft,
|
||||||
'chevron-right': chevronRight,
|
'chevron-right': chevronRight,
|
||||||
'cigarette-with-smoke-curl': cigaretteWithSmokeCurl,
|
'cigarette-with-smoke-curl': cigaretteWithSmokeCurl,
|
||||||
|
'city-gate': cityGate,
|
||||||
climbing_wall: climbingWall,
|
climbing_wall: climbingWall,
|
||||||
check,
|
check,
|
||||||
'alert-circle': alertCircle,
|
'alert-circle': alertCircle,
|
||||||
@@ -201,6 +205,7 @@ const ICONS = {
|
|||||||
'ice-cream-on-cone': iceCreamOnCone,
|
'ice-cream-on-cone': iceCreamOnCone,
|
||||||
'industrial-building': industrialBuilding,
|
'industrial-building': industrialBuilding,
|
||||||
info,
|
info,
|
||||||
|
'info-i': infoI,
|
||||||
instagram,
|
instagram,
|
||||||
jewel,
|
jewel,
|
||||||
'log-in': logIn,
|
'log-in': logIn,
|
||||||
@@ -266,6 +271,7 @@ const ICONS = {
|
|||||||
parking_p: parkingP,
|
parking_p: parkingP,
|
||||||
car,
|
car,
|
||||||
'car-and-wrench': carAndWrench,
|
'car-and-wrench': carAndWrench,
|
||||||
|
'castle-keep': castleKeep,
|
||||||
x,
|
x,
|
||||||
zap,
|
zap,
|
||||||
'loading-ring': loadingRing,
|
'loading-ring': loadingRing,
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ export const POI_ICON_RULES = [
|
|||||||
{ tags: { tourism: 'viewpoint' }, icon: 'camera' },
|
{ tags: { tourism: 'viewpoint' }, icon: 'camera' },
|
||||||
{ tags: { tourism: 'zoo' }, icon: 'camera' },
|
{ tags: { tourism: 'zoo' }, icon: 'camera' },
|
||||||
{ tags: { tourism: 'artwork' }, icon: 'camera' },
|
{ tags: { tourism: 'artwork' }, icon: 'camera' },
|
||||||
|
{ tags: { tourism: 'information' }, icon: 'info-i' },
|
||||||
{ tags: { amenity: 'cinema' }, icon: 'film' },
|
{ tags: { amenity: 'cinema' }, icon: 'film' },
|
||||||
{ tags: { amenity: 'theatre' }, icon: 'camera' },
|
{ tags: { amenity: 'theatre' }, icon: 'camera' },
|
||||||
{ tags: { amenity: 'arts_centre' }, icon: 'comedy-mask-and-tragedy-mask' },
|
{ tags: { amenity: 'arts_centre' }, icon: 'comedy-mask-and-tragedy-mask' },
|
||||||
@@ -116,7 +117,9 @@ export const POI_ICON_RULES = [
|
|||||||
{ tags: { historic: 'bridge' }, icon: 'bridge' },
|
{ tags: { historic: 'bridge' }, icon: 'bridge' },
|
||||||
{ tags: { historic: 'bridge_site' }, icon: 'bridge' },
|
{ tags: { historic: 'bridge_site' }, icon: 'bridge' },
|
||||||
{ tags: { historic: 'fort' }, icon: 'fort' },
|
{ tags: { historic: 'fort' }, icon: 'fort' },
|
||||||
|
{ tags: { historic: 'city_gate' }, icon: 'city-gate' },
|
||||||
{ tags: { historic: 'castle' }, icon: 'palace' },
|
{ tags: { historic: 'castle' }, icon: 'palace' },
|
||||||
|
{ tags: { building: 'tower', historic: 'yes' }, icon: 'castle-keep' },
|
||||||
{ tags: { historic: 'building' }, icon: 'classical-building-with-flag' },
|
{ tags: { historic: 'building' }, icon: 'classical-building-with-flag' },
|
||||||
{ tags: { historic: 'archaeological_site' }, icon: 'grecian-vase' },
|
{ tags: { historic: 'archaeological_site' }, icon: 'grecian-vase' },
|
||||||
{ tags: { historic: 'memorial' }, icon: 'memorial-stone-with-inscription' },
|
{ tags: { historic: 'memorial' }, icon: 'memorial-stone-with-inscription' },
|
||||||
|
|||||||
+10
-1
@@ -56,15 +56,24 @@ const PLACE_TYPE_KEYS = [
|
|||||||
export function getPlaceType(tags) {
|
export function getPlaceType(tags) {
|
||||||
if (!tags) return null;
|
if (!tags) return null;
|
||||||
|
|
||||||
|
let fallbackKey = null;
|
||||||
|
|
||||||
for (const key of PLACE_TYPE_KEYS) {
|
for (const key of PLACE_TYPE_KEYS) {
|
||||||
const value = tags[key];
|
const value = tags[key];
|
||||||
if (value) {
|
if (value) {
|
||||||
if (value === 'yes') {
|
if (value === 'yes') {
|
||||||
return humanizeOsmTag(key);
|
if (!fallbackKey) {
|
||||||
|
fallbackKey = key;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
return humanizeOsmTag(value);
|
return humanizeOsmTag(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (fallbackKey) {
|
||||||
|
return humanizeOsmTag(fallbackKey);
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export const POI_CATEGORIES = [
|
|||||||
label: 'Things to do',
|
label: 'Things to do',
|
||||||
icon: 'feather-camera',
|
icon: 'feather-camera',
|
||||||
filter: [
|
filter: [
|
||||||
'["tourism"~"^(museum|gallery|attraction|viewpoint|zoo|theme_park|aquarium|artwork)$"]',
|
'["tourism"~"^(museum|gallery|attraction|viewpoint|zoo|theme_park|aquarium|artwork|information)$"]',
|
||||||
'["amenity"~"^(cinema|theatre|arts_centre|planetarium)$"]',
|
'["amenity"~"^(cinema|theatre|arts_centre|planetarium)$"]',
|
||||||
'["leisure"~"^(sports_centre|stadium|water_park)$"]',
|
'["leisure"~"^(sports_centre|stadium|water_park)$"]',
|
||||||
'["historic"]',
|
'["historic"]',
|
||||||
|
|||||||
@@ -89,6 +89,12 @@ module('Unit | Utility | osm', function (hooks) {
|
|||||||
assert.strictEqual(result, 'Building');
|
assert.strictEqual(result, 'Building');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('getPlaceType ignores generic "yes" values if a more specific tag is present', function (assert) {
|
||||||
|
const tags = { historic: 'yes', building: 'tower' };
|
||||||
|
const result = getPlaceType(tags);
|
||||||
|
assert.strictEqual(result, 'Tower');
|
||||||
|
});
|
||||||
|
|
||||||
test('getPlaceType prioritizes order (amenity > shop > building)', function (assert) {
|
test('getPlaceType prioritizes order (amenity > shop > building)', function (assert) {
|
||||||
// If something is both a shop and a building, it should be a shop
|
// If something is both a shop and a building, it should be a shop
|
||||||
const tags = { building: 'yes', shop: 'supermarket' };
|
const tags = { building: 'yes', shop: 'supermarket' };
|
||||||
|
|||||||
Reference in New Issue
Block a user