diff --git a/server/lib/python/cartodb_services/cartodb_services/here/service_factory.py b/server/lib/python/cartodb_services/cartodb_services/here/service_factory.py new file mode 100644 index 0000000..e006ff7 --- /dev/null +++ b/server/lib/python/cartodb_services/cartodb_services/here/service_factory.py @@ -0,0 +1,35 @@ +from cartodb_services.here.geocoder import HereMapsGeocoder, HereMapsGeocoderV7 +from cartodb_services.here.bulk_geocoder import HereMapsBulkGeocoder, HereMapsBulkGeocoderV7 +from cartodb_services.here.routing import HereMapsRoutingIsoline, HereMapsRoutingIsolineV8 + +GEOCODING_DEFAULT_MAXRESULTS = 1 + +def get_geocoder(logger, app_id=None, app_code=None, service_params=None, maxresults=GEOCODING_DEFAULT_MAXRESULTS, use_apikey=False, apikey=None): + if use_apikey is True: + return HereMapsGeocoderV7(apikey=apikey, logger=logger, + service_params=service_params, + limit=maxresults) + else: + return HereMapsGeocoder(app_id=app_id, app_code=app_code, + logger=logger, + service_params=service_params, + maxresults=maxresults) + + +def get_bulk_geocoder(logger, app_id=None, app_code=None, service_params=None, use_apikey=False, apikey=None): + if use_apikey is True: + return HereMapsBulkGeocoderV7(apikey=apikey, logger=logger, + service_params=service_params) + else: + return HereMapsBulkGeocoder(app_id=app_id, app_code=app_code, + logger=logger, + service_params=service_params) + +def get_routing_isoline(logger, app_id=None, app_code=None, service_params=None, use_apikey=False, apikey=None): + if use_apikey is True: + return HereMapsRoutingIsolineV8(apikey=apikey, logger=logger, + service_params=service_params) + else: + return HereMapsRoutingIsoline(app_id=app_id, app_code=app_code, + logger=logger, + service_params=service_params) \ No newline at end of file