Google Analytics can give you this data in the reports but won't allow you to get access to it in real time in your application.
Imagine you want to redirect users to the correct country page in your site. In this case you need to get access to the ip geolocation in real time. GA won't help you there.