How to get GPS coordinates.

Discussions about CSEntry
Forum rules
New release: CSPro 8.0
Post Reply
Sharof92
Posts: 2
Joined: June 16th, 2017, 1:54 am

How to get GPS coordinates.

Post 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!
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: How to get GPS coordinates.

Post 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.
Gregory Martin
Posts: 1777
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: How to get GPS coordinates.

Post 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.
Sharof92
Posts: 2
Joined: June 16th, 2017, 1:54 am

Re: How to get GPS coordinates.

Post by Sharof92 »

Thanks a lot, now it's working. :)
arkagwa
Posts: 119
Joined: November 18th, 2014, 5:25 am

Re: How to get GPS coordinates.

Post 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?
khurshid.arshad
Posts: 571
Joined: July 9th, 2012, 11:32 am
Location: Islamabad, Pakistan

Re: How to get GPS coordinates.

Post 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.
arkagwa
Posts: 119
Joined: November 18th, 2014, 5:25 am

Re: How to get GPS coordinates.

Post 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
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: How to get GPS coordinates.

Post 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.
Post Reply