October 23rd, 2013, 04:42 AM
I want to create a simple program (preferably in C++) that gives the current geo-location coordinates, to be able to use the value as a variable.
Everytime my computer/device is near this given location do the following;
*If (coordinates == xxxxx.xxxxx)
cout <<"You are now at this location";
How can i get the current location coordinates?
I've searched for libraries and found APIs, but I have no clue of how to implement this.
Is there a simple way to get current location as coordinates into a program?
October 23rd, 2013, 08:02 AM
It is not (only) a software problem, its is a hardware problem. Do you have EPFS (electronic position finding system) hardware such as GPS on your system?
Originally Posted by Belfongs
You could talk directly to the EPFS hardware, but you need to know what it is and how it is interfaced and its protocol.
What is your target platform? Systems that typically have GPS or which can determine position by cellular mast triangulation such as smart-phones will have location APIs in the OS (for example Android Location APIs).
Windows has a Location API. And for Linux I found at least one, GeoClue. You really need to hone your Google Foo - they were really not hard to find.
Note that testing for a specific coordinate for equality is unlikely to work satisfactorily. EPFS position precision is within a few centimetres but will be noisy within a few meters. You will need to specify a range of lon/lat or a radial distance from a specified position, or create a geofence around a position depending whether the target area is rectangular, circular or some arbitrary polygon.