You can examine the source code project of the , which will give you an idea how to implement it.
How to get the coordinates.