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
Jimmacle10mo ago
you'll need to use some 3rd party map API
Jimmacle
Jimmacle10mo 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.
מוחמד במבה
מוחמד במבהOP10mo ago
im using OpenStreetMap Nominatim API but getting an 403 error when trying to access data or something Im not really sure
Jimmacle
Jimmacle10mo ago
check their docs, that suggests you're using the wrong credentials or otherwise don't have access to that endpoint
מוחמד במבה
מוחמד במבהOP10mo ago
not free🫤
Jimmacle
Jimmacle10mo ago
i just googled an example
מוחמד במבה
מוחמד במבהOP10mo ago
ok, how can I know which APIs I have access to?
Jimmacle
Jimmacle10mo ago
by reading their documentation to see if you need to create an account, pay for access, etc
מוחמד במבה
מוחמד במבהOP10mo ago
damn now I have bureaucracies in coding
Jimmacle
Jimmacle10mo ago
i'm trying openstreetmap's right now and have no problem using it https://nominatim.openstreetmap.org/search?q=[address]&format=json
מוחמד במבה
מוחמד במבהOP10mo ago
sorry but do you mind helping me implement this in c#? my knowledge is kind of limited to chatgpt
Jimmacle
Jimmacle10mo ago
look up how to make requests to REST APIs in C#, there are a lot of resources
Jimmacle
Jimmacle10mo 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:

Did you find this page helpful?