/// <summary> /// The constructor of the controller. /// </summary> /// <param name="context">The database to use</param> /// <param name="loggerArg">The logger to use</param> public EventController(TogepiContext context, ILogger <EventController> loggerArg) { // Saving the args dbContext = context; logger = loggerArg; // Creating the SQL tables dbContext.Database.EnsureCreated(); // Setting the API key apiKey = new HEREApp { AppId = "nwVKikGG0miA826GlXkr", AppCode = "U_lOt-47GHaEnnNs34gJ6w" }; }
/// <summary> /// Perform reverse geocode function (coordinates to location string). /// </summary> /// <param name="apiKey">HERE Maps API key</param> /// <param name="loc">The location's geocoordinates</param> /// <param name="radius">(Optional) result accuracy radius</param> /// <returns>The string description of the location</returns> public static async Task <string> ReverseGeocode(HEREApp apiKey, GeoCoordinate loc, double radius = 100) { var geocoding = new Geocoding(apiKey); return(await geocoding.ReverseGeocode(loc, radius)); }
/// <summary> /// Constructor. /// </summary> /// <param name="api">HERE Maps API key</param> /// <param name="loggerArg">(Optional) logger to use</param> public Geocoding(HEREApp api, ILogger <Geocoding> loggerArg = null) { logger = loggerArg; apiKey = api; }
/// <summary> /// Perform geocode function (location string to coordinates). /// </summary> /// <param name="apiKey">HERE Maps API key</param> /// <param name="query">The location string</param> /// <returns>The geocoordinates of the location</returns> public static async Task <GeoCoordinate> Geocode(HEREApp apiKey, string query) { var geocoding = new Geocoding(apiKey); return(await geocoding.Geocode(query)); }