#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    1
    Rep Power
    0

    Current GeoLocation


    Hello,

    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.

    Example:

    Everytime my computer/device is near this given location do the following;

    Code:
    *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?
  2. #2
  3. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,109
    Rep Power
    1802
    Originally Posted by Belfongs
    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?
    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?

    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.

IMN logo majestic logo threadwatch logo seochat tools logo