How to get coordinates from city and country with HTTP request

Hello

I’m trying to find documentation to have the syntax to get from HTTP request with the country and city the geolocation coordinates.

Someone know where I can find the documentation or have the syntax ?

Thanks a lot for you help

1 Like

Do you only need the center point of these geometries or the boundaries coordinates?
For both - Search API is the solution.
For example Fuzzy search endpoint can return location and the id for other endpoint to retrieve geometry vertices coordinates.
Docs: https://developer.tomtom.com/search-api/search-api-documentation-search/fuzzy-search
with Additional data you can get those boundaries.
Docs: https://developer.tomtom.com/search-api/search-api-documentation/additional-data

1 Like

That’s a good question, And I don’t know how to answer.
I’m new in this, so I don’t know the difference between center point and boundaries coordinates. :frowning:

Can you explain to me what the first one, and what is the other one ?

Let give an example:
What I want is the latitude and longitude of Paris in France.

Thanks so much

First what comes to my mind:

https://api.tomtom.com/search/2/search/Paris.json?countrySet=FR&key=*****

and it returns:

{
	...,
	"results": [
		{
			"type": "Geography",
			...
			"entityType": "Municipality",
			"address": {
				"municipality": "Paris",
				...
			},
			"position": {
				"lat": 48.85689,
				"lon": 2.35085
			},
			...
		}
	]
}

I recommend to play with API Explorer: https://developer.tomtom.com/content/search-api-explorer#/Search/get_search__versionNumber__search__query___ext_

2 Likes