# Calculating Center (GPS Point) and Radius (km) of n GPS points

I'm new to GPS and position mapping but i have a background in programing and some of the math related to it.

I've been tasked with writing a small golang program that takes n GPS points (DMS) and returns a GPS point and Radius that makes a circle that contains all n GPS points.

if n <= 1, Not Valid.

if n = 2, The GPS point returned will be the midway point and the radius will the distance divided by 2.

if n >= 3, The GPS point and Radius that makes a circle that contains all n GPS points.

1. Calculate the Centroid of a polygon of n GPS points, returns center GPS point in (DMS) format.

2. Calculate the distance from the above centroid to each coordinate from the n set using Pythagoras. The biggest value will be the radius of the circle.

This is as far as my thought process goes. Is there any GPS specific math I need to find points in (DMS)? Are there golang packages that could help with this type of math? Can someone give me an example of this with n >= 3 How can I drop pins and a radius to check the results, google maps?