I would like to convert several data sets with a service in the background through Nominatim server. Now I've invested a lot of time to get an answer from the nominatim with the Http client class. Unfortunately, I only ever get a 404 error
Here is my sample code:
namespace ConsoleApp7
{
internal class Program
{
static void Main(string[] args)
{
Task t = new Task(DownloadPageAsync);
t.Start();
Console.WriteLine("Downloading page...");
Console.ReadLine();
}
static async void DownloadPageAsync()
{
// ... Target page.
string page = "https://nominatim.openstreetmap.org/reverse?
format=geocodejson&lat=60.2299&lon=11.1663";
// ... Use HttpClient.
using (HttpClient client = new HttpClient())
using (HttpResponseMessage response = await
client.GetAsync(page))
using (HttpContent content = response.Content)
{
// ... Read the string.
string result = await content.ReadAsStringAsync();
// ... Display the result.
if (result != null)
{
Console.WriteLine(result);
}
}
}
}
}
I'm happy about any help!
Many thanks