fetching address's coordinates in c#.

I need to get the latitude and longitude for a building by it's (string) address - "{cityName} {StreetName} {StreetNum}". I already have these values in a datatable and I have methods to access them. all of the addresses are in the same country if that matters.
13 Replies
Jimmacle
Jimmacle2mo ago
you'll need to use some 3rd party map API
Jimmacle
Jimmacle2mo ago
Google for Developers
Geocoding API overview  |  Google for Developers
Geocoding converts addresses into geographic coordinates to be placed on a map. Reverse Geocoding finds an address based on geographic coordinates or Place IDs.
מוחמד במבה
im using OpenStreetMap Nominatim API but getting an 403 error when trying to access data or something Im not really sure
Jimmacle
Jimmacle2mo ago
check their docs, that suggests you're using the wrong credentials or otherwise don't have access to that endpoint
מוחמד במבה
not free🫤
Jimmacle
Jimmacle2mo ago
i just googled an example
מוחמד במבה
ok, how can I know which APIs I have access to?
Jimmacle
Jimmacle2mo ago
by reading their documentation to see if you need to create an account, pay for access, etc
מוחמד במבה
damn now I have bureaucracies in coding
Jimmacle
Jimmacle2mo ago
i'm trying openstreetmap's right now and have no problem using it https://nominatim.openstreetmap.org/search?q=[address]&format=json
מוחמד במבה
sorry but do you mind helping me implement this in c#? my knowledge is kind of limited to chatgpt
Jimmacle
Jimmacle2mo ago
look up how to make requests to REST APIs in C#, there are a lot of resources
Jimmacle
Jimmacle2mo ago
Medium
An Essential Guide to Making your first GET API Call in C# .NET Core
Call your first GET request in .NET C# using parameters, header values, and map-to models in your application: