Page 1 of 1

How to get GPS coordinates.

Posted: June 16th, 2017, 2:05 am
by Sharof92
Hi There!

I would like to develop the CSEntry app for tablet which can capture the GPS navigation. Last time I used this code it's worked but I couldn't find the captured data in DATAFILE:

function GetGPS()
if gps(open) and gps(read,120) then
LATITUDE = gps(latitude); // assign to variables in the dictionary
LONGITUDE = gps(longitude);
else
errmsg("There was an error reading the GPS coordinates.");
endif;
gps(close);
end;


And also do we need internet access for GPS&
Thanks!

Re: How to get GPS coordinates.

Posted: June 16th, 2017, 8:16 am
by josh
This code assumes that LATITUDE and LONGITUDE are variables in your dictionary. If the GPS read is successful those variables will be filled in the data file. If you are using system controlled mode make sure that you are not inadvertently skipping those fields. If that isn't the problem then please post your application so we can take a look.

Re: How to get GPS coordinates.

Posted: June 16th, 2017, 10:43 am
by Gregory Martin
GPS works independently of Internet access. Sometimes the GPS reading may be faster if you are connected to a Wi-Fi network, but otherwise there is no relationship between GPS and Internet access.

Re: How to get GPS coordinates.

Posted: June 19th, 2017, 12:21 am
by Sharof92
Thanks a lot, now it's working. :)

Re: How to get GPS coordinates.

Posted: June 25th, 2017, 8:11 am
by arkagwa
Dear Josh

Can i capture GPS with cspro in my laptop?? what function program could i use in laptop? does it need internet for PCs?

Re: How to get GPS coordinates.

Posted: June 25th, 2017, 8:21 am
by khurshid.arshad
Dear arkagwa;

Please see this syntax from the help.
Basic Example

Code: Select all

gps(open); // on Android
gps(open,3,4800); // on a laptop or Windows tablet; COM3, 4800 baud

if gps(read,5) then // a successful attempt at a read, for up to five seconds
    errmsg("Latitude is %f, longitude is %f",gps(latitude),gps(longitude));

else
    errmsg("GPS signal could not be acquired");

endif;

gps(close);

a.

Re: How to get GPS coordinates.

Posted: June 25th, 2017, 9:53 am
by arkagwa
PROC C8
gps(open); // on Android
gps(open,3,4800); // on a laptop or Windows tablet; COM3, 4800 baud
if gps(read,20,5)=1 then // a successful attempt at a read GPS, for up to 20 seconds in accuracy of 5 metres
errmsg("Latitude is %f, longitude is %f",gps(latitude),gps(longitude));
LATITUDE=gps(latitude);
LONGITUDE=gps(longitude);
else
errmsg("GPS signal could not be acquired");
endif;


I am using my app in both laptop PC and android devices to get GPS. But the above GPS code does not read GPS values in windows PC

Re: How to get GPS coordinates.

Posted: June 26th, 2017, 6:52 am
by josh
The Windows PC GPS support works with external GPS devices you plug in via USB. It does not support internal GPS. You have to make sure that the second parameter exactly matches the COM port that the GPS device is running on. You can see this port in Windows device manager. You also need to make sure that the third parameter is a supported baud rate for you GPS.