The Hong Kong Observatory and the Indian Meteorological Department say the quake measured 5.8 on the Richter scale and was centered west of the islands .