diff --git a/HqgisAlgorithm_POIs.py b/HqgisAlgorithm_POIs.py
index d65747d..441f72a 100644
--- a/HqgisAlgorithm_POIs.py
+++ b/HqgisAlgorithm_POIs.py
@@ -38,6 +38,7 @@
QgsPointXY,
QgsSettings)
from functools import partial
+from .mapCat import mapCategories
import processing
import Hqgis
import os
@@ -162,110 +163,70 @@ def initAlgorithm(self, config=None):
[QgsProcessing.TypeVectorPoint]
)
)
- self.keys = ['accommodation',
- 'administrative-areas-buildings',
- 'administrative-region',
- 'airport',
- 'ambulance-services',
- 'amusement-holiday-park',
- 'atm-bank-exchange',
- 'bar-pub',
- 'body-of-water',
- 'bookshop',
- 'building',
- 'business-industry',
- 'business-services',
- 'camping',
- 'car-dealer-repair',
- 'car-rental',
- 'casino',
- 'cinema',
- 'city-town-village',
- 'clothing-accessories-shop',
- 'coffee',
- 'coffee-tea',
- 'communication-media',
- 'dance-night-club',
- 'department-store',
- 'eat-drink',
- 'education-facility',
- 'electronics-shop',
- 'ev-charging-station',
- 'facilities',
- 'facility',
- 'fair-convention-facility',
- 'ferry-terminal',
- 'fire-department',
- 'food-drink',
- 'forest-heath-vegetation',
- 'going-out',
- 'government-community-facility',
- 'hardware-house-garden-shop',
- 'hospital-health-care-facility',
- 'hospital-health-care-facility',
- 'hostel',
- 'hotel',
- 'intersection',
- 'kiosk-convenience-store',
- 'landmark-attraction',
- 'leisure-outdoor',
- 'library',
- 'mall',
- 'motel',
- 'mountain-hill',
- 'museum',
- 'natural-geographical',
- 'outdoor-area-complex',
- 'parking-facility',
- 'petrol-station',
- 'pharmacy',
- 'police-emergency',
- 'police-station',
- 'post-office',
- 'postal-area',
- 'public-transport',
- 'railway-station',
- 'recreation',
- 'religious-place',
- 'restaurant',
- 'service',
- 'shop',
- 'shopping',
- 'sights-museums',
- 'snacks-fast-food',
- 'sport-outdoor-shop',
- 'sports-facility-venue',
- 'street-square',
- 'taxi-stand',
- 'tea',
- 'theatre-music-culture',
- 'toilet-rest-area',
- 'tourist-information',
- 'transport',
- 'travel-agency',
- 'undersea-feature',
- 'wine-and-liquor',
- 'zoo']
- #TODO: Add more categories beneath
- self.keys = [{"name": "Restaurant",
- "categories": "100-1000-0000,100-1000-0001,100-1000-0002,100-1000-0003,100-1000-0004,100-1000-0005,100-1000-0006,100-1000-0007,100-1000-0008,100-1000-0009",
- },
- {"name": "Coffee-Tea",
- "categories": "100-1100-0000,100-1100-0010,100-1100-0331",
- },
- {"name": "Nightlife-Entertainment",
- "categories": "200-2000-0000,200-2000-0011,200-2000-0012,200-2000-0013,200-2000-0014,200-2000-0015,200-2000-0016,200-2000-0017,200-2000-0018,200-2000-0019,200-2000-0306,200-2000-0368",
- },
- {"name": "Cinema",
- "categories": "200-2100-0019",
- },
- {"name": "Theatre, Music and Culture",
- "categories": "200-2200-0000,200-2200-0020",
- },
- ]
+ self.keys = [
+ "Administrative Region-Streets",
+ "Airport",
+ "ATM",
+ "Banking",
+ "Body of Water",
+ "Bookstore",
+ "Building",
+ "Business-Industry",
+ "Car Dealer-Sales",
+ "Car Rental",
+ "Car Repair-Service",
+ "Cargo Transportation",
+ "Cinema",
+ "City, Town or Village",
+ "Clothing and Accessories",
+ "Coffee-Tea",
+ "Commercial Services",
+ "Communication-Media",
+ "Consumer Goods",
+ "Consumer Services",
+ "Convenience Store",
+ "Department Store",
+ "Drugstore or Pharmacy",
+ "Education Facility",
+ "Electronics",
+ "Event Spaces",
+ "Facilities",
+ "Food and Drink",
+ "Forest,Heath or Other Vegetation",
+ "Fueling Station",
+ "Government or Community Facility",
+ "Hair and Beauty",
+ "Hardware, House and Garden",
+ "Hospital or Health Care Facility",
+ "Hotel-Motel",
+ "Landmark-Attraction",
+ "Leisure",
+ "Library",
+ "Lodging",
+ "Mall-Shopping Complex",
+ "Money-Cash Services",
+ "Mountain or Hill",
+ "Museum",
+ "Natural and Geographical",
+ "Nightlife-Entertainment",
+ "Outdoor Area-Complex",
+ "Outdoor-Recreation",
+ "Parking",
+ "Police-Fire-Emergency",
+ "Post Office",
+ "Public Transport",
+ "Religious Place",
+ "Rest Area",
+ "Restaurant",
+ "Sports Facility-Venue",
+ "Theatre, Music and Culture",
+ "Tourist Information",
+ "Truck-Semi Dealer-Services",
+ "Undersea Feature"
+ ]
self.keys2 = []
for entry in self.keys:
- self.keys2.append(entry["name"])
+ self.keys2.append(entry)
self.addParameter(
QgsProcessingParameterEnum(
self.KEYS,
@@ -464,8 +425,13 @@ def processAlgorithm(self, parameters, context, feedback):
categoriesList = []
# self.keys[keyField].split(" | ")[1]
for category in categories:
- categoriesList.append(self.keys[category]["categories"])
+ feedback.pushInfo(self.keys[category])
+ categoriesList.append(mapCategories(self.keys[category]))
categories = ",".join(categoriesList)
+ #for category in categories:
+ # categoryID = mapCategories(category)
+ # categoriesList.append(categoryID)
+ #categories = ",".join(categoriesList)
layerCRS = source.sourceCrs()
if layerCRS != QgsCoordinateReferenceSystem(4326):
sourceCrs = source.sourceCrs()
@@ -499,9 +465,9 @@ def processAlgorithm(self, parameters, context, feedback):
lat = place["position"]["lat"]
lng = place["position"]["lng"]
# iterate over categories:
+
categoriesResp = []
- for cat in place["categories"]:
- categoriesResp.append(cat["id"])
+
fet = QgsFeature()
fet.setGeometry(QgsGeometry.fromPointXY(QgsPointXY(lng, lat)))
fet.setAttributes([
diff --git a/hqgis.py b/hqgis.py
index 6cb9afb..ee6a0f9 100644
--- a/hqgis.py
+++ b/hqgis.py
@@ -32,6 +32,7 @@
# Import the code for the dialog
from .hqgis_dialog import HqgisDialog
from .decodeGeom import decode
+from .mapCat import mapCategories
import os.path
import requests
import json
@@ -990,38 +991,13 @@ def calculateRouteSingle(self):
pr.addFeatures(features)
QgsProject.instance().addMapLayer(layer)
- def mapCategories(self, categoryName):
- #TODO: add more categories!
- keys = [{"name": "restaurant",
- "categories": "100-1000-0000,100-1000-0001,100-1000-0002,100-1000-0003,100-1000-0004,100-1000-0005,100-1000-0006,100-1000-0007,100-1000-0008,100-1000-0009",
- },
- {"name": "Coffee-Tea",
- "categories": "100-1100-0000,100-1100-0010,100-1100-0331",
- },
- {"name": "Nightlife-Entertainment",
- "categories": "200-2000-0000,200-2000-0011,200-2000-0012,200-2000-0013,200-2000-0014,200-2000-0015,200-2000-0016,200-2000-0017,200-2000-0018,200-2000-0019,200-2000-0306,200-2000-0368",
- },
- {"name": "Cinema",
- "categories": "200-2100-0019",
- },
- {"name": "Theatre, Music and Culture",
- "categories": "200-2200-0000,200-2200-0020",
- },
- ]
- for item in keys:
- if item["name"]==categoryName:
- return item["categories"]
- else:
- return ""
-
def getPlacesSingle(self):
self.getCredentials()
#radius = self.dlg.RadiusBox.value()
categories = self.dlg.listWidget.selectedItems()
categoriesList = []
-
for category in categories:
- categoryID = self.mapCategories(category.text())
+ categoryID = mapCategories(category.text())
categoriesList.append(categoryID)
categories = ",".join(categoriesList)
coordinates = self.dlg.placeLabel.text()
@@ -1077,7 +1053,7 @@ def getPlacesBatch(self):
categories = self.dlg.listWidgetBatch.selectedItems()
categoriesList = []
for category in categories:
- categoryID = self.mapCategories(category.text())
+ categoryID = mapCategories(category.text())
categoriesList.append(categoryID)
categories = ",".join(categoriesList)
layer = self.createPlaceLayerBatch()
diff --git a/hqgis_dialog_base.ui b/hqgis_dialog_base.ui
index 377b787..cabfd39 100644
--- a/hqgis_dialog_base.ui
+++ b/hqgis_dialog_base.ui
@@ -23,7 +23,7 @@
true
- 0
+ 2
@@ -545,422 +545,297 @@
-
- accommodation
+ Administrative Region-Streets
-
- administrative-areas-buildings
+ Airport
-
- administrative-region
+ ATM
-
- airport
+ Banking
-
- ambulance-services
+ Body of Water
-
- amusement-holiday-park
+ Bookstore
-
- atm-bank-exchange
+ Building
-
- bar-pub
+ Business-Industry
-
- body-of-water
+ Car Dealer-Sales
-
- bookshop
+ Car Rental
-
- building
+ Car Repair-Service
-
- business-industry
+ Cargo Transportation
-
- business-services
+ Cinema
-
- camping
+ City, Town or Village
-
- car-dealer-repair
+ Clothing and Accessories
-
- car-rental
+ Coffee-Tea
-
- casino
+ Commercial Services
-
- cinema
+ Communication-Media
-
- city-town-village
+ Consumer Goods
-
- clothing-accessories-shop
+ Consumer Services
-
- coffee
+ Convenience Store
-
- coffee-tea
+ Department Store
-
- communication-media
+ Drugstore or Pharmacy
-
- dance-night-club
+ Education Facility
-
- department-store
+ Electronics
-
- eat-drink
+ Event Spaces
-
- education-facility
+ Facilities
-
- electronics-shop
+ Food and Drink
-
- ev-charging-station
+ Forest, Heath or Other Vegetation
-
- facilities
+ Fueling Station
-
- facility
+ Government or Community Facility
-
- fair-convention-facility
+ Hair and Beauty
-
- ferry-terminal
+ Hardware, House and Garden
-
- fire-department
+ Hospital or Health Care Facility
-
- food-drink
+ Hotel-Motel
-
- forest-heath-vegetation
+ Landmark-Attraction
-
- going-out
+ Leisure
-
- government-community-facility
+ Library
-
- hardware-house-garden-shop
+ Lodging
-
- hospital-health-care-facility
+ Mall-Shopping Complex
-
- hospital-health-care-facility
+ Money-Cash Services
-
- hostel
+ Mountain or Hill
-
- hotel
+ Museum
-
- intersection
+ Natural and Geographical
-
- kiosk-convenience-store
+ Nightlife-Entertainment
-
- landmark-attraction
+ Outdoor Area-Complex
-
- leisure-outdoor
+ Outdoor-Recreation
-
- library
+ Parking
-
- mall
+ Police-Fire-Emergency
-
- motel
+ Post Office
-
- mountain-hill
+ Public Transport
-
- museum
+ Religious Place
-
- natural-geographical
+ Rest Area
-
- outdoor-area-complex
+ Restaurant
-
- parking-facility
+ Sports Facility-Venue
-
- petrol-station
+ Theatre, Music and Culture
-
- pharmacy
+ Tourist Information
-
- police-emergency
+ Truck-Semi Dealer-Services
-
- police-station
-
-
- -
-
- post-office
-
-
- -
-
- postal-area
-
-
- -
-
- public-transport
-
-
- -
-
- railway-station
-
-
- -
-
- recreation
-
-
- -
-
- religious-place
-
-
- -
-
- restaurant
-
-
- -
-
- service
-
-
- -
-
- shop
-
-
- -
-
- shopping
-
-
- -
-
- sights-museums
-
-
- -
-
- snacks-fast-food
-
-
- -
-
- sport-outdoor-shop
-
-
- -
-
- sports-facility-venue
-
-
- -
-
- street-square
-
-
- -
-
- taxi-stand
-
-
- -
-
- tea
-
-
- -
-
- theatre-music-culture
-
-
- -
-
- toilet-rest-area
-
-
- -
-
- tourist-information
-
-
- -
-
- transport
-
-
- -
-
- travel-agency
-
-
- -
-
- undersea-feature
-
-
- -
-
- wine-and-liquor
-
-
- -
-
- zoo
+ Undersea Feature
@@ -1000,20 +875,23 @@
-
-
-
-
+
-
+
- Categories
+ From Layer
- -
-
+
-
+
- From Layer
+ Categories
+ -
+
+
-
@@ -1024,429 +902,301 @@
-
- accommodation
-
-
- -
-
- administrative-areas-buildings
-
-
- -
-
- administrative-region
+ Administrative Region-Streets
-
- airport
+ Airport
-
- ambulance-services
+ ATM
-
- amusement-holiday-park
+ Banking
-
- atm-bank-exchange
+ Body of Water
-
- bar-pub
+ Bookstore
-
- body-of-water
+ Building
-
- bookshop
+ Business-Industry
-
- building
+ Car Dealer-Sales
-
- business-industry
+ Car Rental
-
- business-services
+ Car Repair-Service
-
- camping
+ Cargo Transportation
-
- car-dealer-repair
+ Cinema
-
- car-rental
+ City, Town or Village
-
- casino
+ Clothing and Accessories
-
- cinema
+ Coffee-Tea
-
- city-town-village
+ Commercial Services
-
- clothing-accessories-shop
+ Communication-Media
-
- coffee
+ Consumer Goods
-
- coffee-tea
+ Consumer Services
-
- communication-media
+ Convenience Store
-
- dance-night-club
+ Department Store
-
- department-store
+ Drugstore or Pharmacy
-
- eat-drink
+ Education Facility
-
- education-facility
+ Electronics
-
- electronics-shop
+ Event Spaces
-
- ev-charging-station
+ Facilities
-
- facilities
+ Food and Drink
-
- facility
+ Forest, Heath or Other Vegetation
-
- fair-convention-facility
+ Fueling Station
-
- ferry-terminal
+ Government or Community Facility
-
- fire-department
+ Hair and Beauty
-
- food-drink
+ Hardware, House and Garden
-
- forest-heath-vegetation
+ Hospital or Health Care Facility
-
- going-out
+ Hotel-Motel
-
- government-community-facility
+ Landmark-Attraction
-
- hardware-house-garden-shop
+ Leisure
-
- hospital-health-care-facility
+ Library
-
- hospital-health-care-facility
+ Lodging
-
- hostel
+ Mall-Shopping Complex
-
- hotel
+ Money-Cash Services
-
- intersection
+ Mountain or Hill
-
- kiosk-convenience-store
+ Museum
-
- landmark-attraction
+ Natural and Geographical
-
- leisure-outdoor
+ Nightlife-Entertainment
-
- library
+ Outdoor Area-Complex
-
- mall
+ Outdoor-Recreation
-
- motel
+ Parking
-
- mountain-hill
+ Police-Fire-Emergency
-
- museum
+ Post Office
-
- natural-geographical
+ Public Transport
-
- outdoor-area-complex
+ Religious Place
-
- parking-facility
+ Rest Area
-
- petrol-station
+ Restaurant
-
- pharmacy
+ Sports Facility-Venue
-
- police-emergency
+ Theatre, Music and Culture
-
- police-station
+ Tourist Information
-
- post-office
+ Truck-Semi Dealer-Services
-
- postal-area
-
-
- -
-
- public-transport
-
-
- -
-
- railway-station
-
-
- -
-
- recreation
-
-
- -
-
- religious-place
-
-
- -
-
- restaurant
-
-
- -
-
- service
-
-
- -
-
- shop
-
-
- -
-
- shopping
-
-
- -
-
- sights-museums
-
-
- -
-
- snacks-fast-food
-
-
- -
-
- sport-outdoor-shop
-
-
- -
-
- sports-facility-venue
-
-
- -
-
- street-square
-
-
- -
-
- taxi-stand
-
-
- -
-
- tea
-
-
- -
-
- theatre-music-culture
-
-
- -
-
- toilet-rest-area
-
-
- -
-
- tourist-information
-
-
- -
-
- transport
-
-
- -
-
- travel-agency
-
-
- -
-
- undersea-feature
-
-
- -
-
- wine-and-liquor
-
-
- -
-
- zoo
+ Undersea Feature
- -
-
-
-
diff --git a/mapCat.py b/mapCat.py
new file mode 100644
index 0000000..4228af1
--- /dev/null
+++ b/mapCat.py
@@ -0,0 +1,201 @@
+def mapCategories(categoryName):
+ keys = [{"name": "Restaurant",
+ "categories": "100-1000",
+ },
+ {"name": "Coffee-Tea",
+ "categories": "100-1100",
+ },
+ {"name": "Nightlife-Entertainment",
+ "categories": "200-2000",
+ },
+ {"name": "Cinema",
+ "categories": "200-2100",
+ },
+ {"name": "Theatre, Music and Culture",
+ "categories": "200-2200",
+ },
+ {"name": "Landmark-Attraction",
+ "categories": "300-3000",
+ },
+ {"name": "Museum",
+ "categories": "300-3100",
+ },
+ {"name": "Religious Place",
+ "categories": "300-3200",
+ },
+ {"name": "Body of Water",
+ "categories": "350-3500",
+ },
+ {"name": "Mountain or Hill",
+ "categories": "350-3510",
+ },
+ {"name": "Undersea Feature",
+ "categories": "350-3520",
+ },
+ {"name": "Forest, Heath or Other Vegetation",
+ "categories": "350-3522",
+ },
+ {"name": "Natural and Geographical",
+ "categories": "350-3550",
+ },
+
+ {"name": "Airport",
+ "categories": "400-4000",
+ },
+ {"name": "Public Transport",
+ "categories": "400-4100",
+ },
+ {"name": "Cargo Transportation",
+ "categories": "400-4200",
+ },
+ {"name": "Rest Area",
+ "categories": "400-4300",
+ },
+
+ {"name": "Hotel-Motel",
+ "categories": "500-5000",
+ },
+ {"name": "Lodging",
+ "categories": "500-5100",
+ },
+
+
+ {"name": "Outdoor-Recreation",
+ "categories": "550-5510",
+ },
+ {"name": "Leisure",
+ "categories": "550-5520",
+ },
+
+
+ {"name": "Convenience Store",
+ "categories": "600-6000",
+ },
+ {"name": "Mall-Shopping Complex",
+ "categories": "600-6100",
+ },
+ {"name": "Department Store",
+ "categories": "600-6200",
+ },
+ {"name": "Food and Drink",
+ "categories": "600-6300",
+ },
+ {"name": "Drugstore or Pharmacy",
+ "categories": "600-6400",
+ },
+ {"name": "Electronics",
+ "categories": "600-6500",
+ },
+ {"name": "Hardware, House and Garden",
+ "categories": "600-6600",
+ },
+ {"name": "Bookstore",
+ "categories": "600-6700",
+ },
+ {"name": "Clothing and Accessories",
+ "categories": "600-6800",
+ },
+ {"name": "Consumer Goods",
+ "categories": "600-6900",
+ },
+ {"name": "Hair and Beauty",
+ "categories": "600-6950",
+ },
+
+ {"name": "Banking",
+ "categories": "700-7000",
+ },
+ {"name": "ATM",
+ "categories": "700-7010",
+ },
+ {"name": "Money-Cash Services",
+ "categories": "700-7050",
+ },
+ {"name": "Communication-Media",
+ "categories": "700-7100",
+ },
+ {"name": "Commercial Services",
+ "categories": "700-7200",
+ },
+ {"name": "Business-Industry",
+ "categories": "700-7250",
+ },
+ {"name": "Police-Fire-Emergency",
+ "categories": "700-7300",
+ },
+ {"name": "Consumer Services",
+ "categories": "700-7400",
+ },
+ {"name": "Post Office",
+ "categories": "700-7450",
+ },
+ {"name": "Tourist Information",
+ "categories": "700-7460",
+ },
+ {"name": "Fueling Station",
+ "categories": "700-7600",
+ },
+ {"name": "Car Dealer-Sales",
+ "categories": "700-7800",
+ },
+ {"name": "Car Repair-Service",
+ "categories": "700-7850",
+ },
+ {"name": "Car Rental",
+ "categories": "700-7851",
+ },
+ {"name": "Truck-Semi Dealer-Services",
+ "categories": "700-7900",
+ },
+
+
+ {"name": "Hospital or Health Care Facility",
+ "categories": "800-8000",
+ },
+ {"name": "Government or Community Facility",
+ "categories": "800-8100",
+ },
+ {"name": "Education Facility",
+ "categories": "800-8200",
+ },
+ {"name": "Library",
+ "categories": "800-8300",
+ },
+ {"name": "Event Spaces",
+ "categories": "800-8400",
+ },
+ {"name": "Parking",
+ "categories": "800-8500",
+ },
+ {"name": "Sports Facility-Venue",
+ "categories": "800-8600",
+ },
+ {"name": "Facilities",
+ "categories": "800-8700",
+ },
+
+ {"name": "City, Town or Village",
+ "categories": "900-9100",
+ },
+ {"name": "Outdoor Area-Complex",
+ "categories": "900-9200",
+ },
+ {"name": "Building",
+ "categories": "900-9300",
+ },
+ {"name": "Administrative Region-Streets",
+ "categories": "900-9400",
+ },
+
+
+ ]
+ for itemID in keys:
+ if itemID["name"] == categoryName:
+
+ categoryID = itemID["categories"]
+ break
+
+
+ else:
+ categoryID=""
+ return categoryID
\ No newline at end of file
diff --git a/metadata.txt b/metadata.txt
index b5bfffb..5c8818e 100644
--- a/metadata.txt
+++ b/metadata.txt
@@ -24,7 +24,8 @@ repository=https://github.com/riccardoklinger/Hqgis
# Recommended items:
# Uncomment the following line and add your changelog:
-changelog= 1.2.0 update for newest HERE API V8
+changelog= 1.2.1 fixes for category mapping in POI Search
+ 1.2.0 update for newest HERE API V8
1.1.1 issues with Multipoint layers ( https://github.com/riccardoklinger/Hqgis/issues/58 ) solved
1.1.0 application keys are stored in global settings, fix for reverse geocoding
1.0.1 address issue with POI in GUI box
diff --git a/plugin_upload.py b/plugin_upload.py
old mode 100755
new mode 100644
diff --git a/readme.md b/readme.md
index 51a710e..d3f8893 100644
--- a/readme.md
+++ b/readme.md
@@ -25,8 +25,8 @@ The Hqgis plugin comes with different analytical tools as the HERE API povides d
## Installation
-Currently the plugin is hosted here on github as well as in the plugin manager.
-If you want to use it in QGIS from github, please download the repository and place the content of the zip in your python plugins folder (linux: */home/USER/.local/share/QGIS/QGIS3/profiles/default/python/plugins* / win: *C:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins*). You can also install it directly in QGIS using the [plugin from ZIP option](https://gis.stackexchange.com/questions/302196/downloading-and-saving-plugins-for-qgis-3-4)
+Currently the plugin is only hosted here on github as the version is premature.
+If you want to use it in QGIS, please download the repository and place the content of the zip in your python plugins folder (linux: */home/USER/.local/share/QGIS/QGIS3/profiles/default/python/plugins* / win: *C:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins*). You can also install it directly in QGIS using the [plugin from ZIP option](https://gis.stackexchange.com/questions/302196/downloading-and-saving-plugins-for-qgis-3-4)
## Credentials
The plugin needs to have credentials from HERE. Therefore you need to register at least a freemium account (free of charge at [HERE.com](https://developer.here.com/) by creating a project and generate a REST API Key if not already generated.