diff --git a/IsraelHiking.Web/src/application/services/poi.service.ts b/IsraelHiking.Web/src/application/services/poi.service.ts index ae426709e..f706c0d17 100644 --- a/IsraelHiking.Web/src/application/services/poi.service.ts +++ b/IsraelHiking.Web/src/application/services/poi.service.ts @@ -263,12 +263,147 @@ export class PoiService { if (poi.properties.poiIconColor && poi.properties.poiIcon && poi.properties.poiCategory) { return; } - if (feature.properties.class === "place") { + if (feature.properties.boundary === "protected_area" || + feature.properties.boundary === "national_park" || + feature.properties.leisure === "nature_reserve") { + poi.properties.poiIconColor = "#008000"; + poi.properties.poiIcon = "icon-nature-reserve"; + poi.properties.poiCategory = "Other"; + return; + } + if (feature.properties.historic) { + poi.properties.poiIconColor = "#666666"; + poi.properties.poiCategory = "Historic"; + switch (feature.properties.historic) { + case "ruins": + poi.properties.poiIcon = "icon-ruins"; + return; + case "archaeological_site": + poi.properties.poiIcon = "icon-archaeological"; + return; + case "memorial": + case "monument": + poi.properties.poiIcon = "icon-memorial"; + return; + } + } + if (feature.properties.leisure === "picnic_table" || + feature.properties.tourism === "picnic_site" || + feature.properties.amenity === "picnic") { + poi.properties.poiIconColor = "#734a08"; + poi.properties.poiIcon = "icon-picnic"; + poi.properties.poiCategory = "Camping"; + } + + if (feature.properties.natural) { + switch (feature.properties.natural) { + case "cave_entrance": + poi.properties.poiIconColor = "black"; + poi.properties.poiIcon = "icon-cave"; + poi.properties.poiCategory = "Natural"; + return; + case "spring": + poi.properties.poiIconColor = "blue"; + poi.properties.poiIcon = "icon-tint"; + poi.properties.poiCategory = "Water"; + return; + case "tree": + poi.properties.poiIconColor = "#008000"; + poi.properties.poiIcon = "icon-tree"; + poi.properties.poiCategory = "Natural"; + return; + case "flowers": + poi.properties.poiIconColor = "#008000"; + poi.properties.poiIcon = "icon-flowers"; + poi.properties.poiCategory = "Natural"; + return; + case "waterhole": + poi.properties.poiIconColor = "blue"; + poi.properties.poiIcon = "icon-waterhole"; + poi.properties.poiCategory = "Water"; + return; + } + } + + if (feature.properties.water === "reservoir" || + feature.properties.water === "pond") { + poi.properties.poiIconColor = "blue"; + poi.properties.poiIcon = "icon-tint"; + poi.properties.poiCategory = "Water"; + return; + } + + if (feature.properties.man_made) { + poi.properties.poiIconColor = "blue"; + poi.properties.poiCategory = "Water"; + switch (feature.properties.man_made) { + case "water_well": + poi.properties.poiIcon = "icon-water-well"; + return; + case "cistern": + poi.properties.poiIcon = "icon-cistern"; + return; + } + } + + if (feature.properties.waterway === "waterfall") { + poi.properties.poiIconColor = "blue"; + poi.properties.poiIcon = "icon-waterfall"; + poi.properties.poiCategory = "Water"; + return; + } + + if (feature.properties.place) { poi.properties.poiIconColor = "black"; poi.properties.poiIcon = "icon-home"; poi.properties.poiCategory = "Wikipedia"; return; } + + if (feature.properties.tourism) { + switch (feature.properties.tourism) { + case "viewpoint": + poi.properties.poiIconColor = "#008000"; + poi.properties.poiIcon = "icon-viewpoint"; + poi.properties.poiCategory = "Viewpoint"; + return; + case "picnic_site": + poi.properties.poiIconColor = "#734a08"; + poi.properties.poiIcon = "icon-picnic"; + poi.properties.poiCategory = "Camping"; + return; + case "camp_site": + poi.properties.poiIconColor = "#734a08"; + poi.properties.poiIcon = "icon-campsite"; + poi.properties.poiCategory = "Camping"; + return; + case "attraction": + poi.properties.poiIconColor = "#ffb800"; + poi.properties.poiIcon = "icon-star"; + poi.properties.poiCategory = "Other"; + return; + } + return; + } + + if (feature.properties.wikidata || feature.properties.wikipedia) { + poi.properties.poiIconColor = "black"; + poi.properties.poiIcon = "icon-wikipedia-w"; + poi.properties.poiCategory = "Wikipedia"; + return; + } + + if (feature.properties.natural === "peak") { + poi.properties.poiIconColor = "black"; + poi.properties.poiIcon = "icon-peak"; + poi.properties.poiCategory = "Other"; + return; + } + + poi.properties.poiIconColor = "black"; + poi.properties.poiIcon = "icon-search"; + poi.properties.poiCategory = "Other"; + switch (feature.properties.subclass) { case "spring": case "pond": @@ -396,6 +531,19 @@ export class PoiService { lon: (bounds.northEast.lng + bounds.southWest.lng) / 2, }; } + case "MultiPolygon": { + // HM TODO: this is a very rough approximation + const bounds = SpatialService.getBoundsForFeature(feature); + return { + lat: (bounds.northEast.lat + bounds.southWest.lat) / 2, + lon: (bounds.northEast.lng + bounds.southWest.lng) / 2, + }; + } + case "MultiLineString": + return { + lat: feature.geometry.coordinates[0][0][1], + lon: feature.geometry.coordinates[0][0][0], + }; default: throw new Error("Unsupported geometry type: " + feature.geometry.type); }