locking GPS coordinates
locking GPS coordinates
Hi Josh, and others.
I was wondering if there is a way to automatically lock GPS coordinates.
we are currently pre-testing an instrument, and the enumerator has to visit both farm and residence of the respondent. They take the GPS coordinates at the farm.
After field level data had been entered, and the enumerator was at the placse of residence finishing the survey, that they had to go back to change something earlier on, and when they did that the tablet automatically tried to get a new GPS reading, however, since they were no longer at the farm this resulted in a new set of (wrong) farm coordinates.
I would like to know if there is a way to get the GPS values automatically locked in place (I could create new variables and have the enumerator transcribe the values, but would like to automate the process if possible)
Thank you!
Aniseh
I was wondering if there is a way to automatically lock GPS coordinates.
we are currently pre-testing an instrument, and the enumerator has to visit both farm and residence of the respondent. They take the GPS coordinates at the farm.
After field level data had been entered, and the enumerator was at the placse of residence finishing the survey, that they had to go back to change something earlier on, and when they did that the tablet automatically tried to get a new GPS reading, however, since they were no longer at the farm this resulted in a new set of (wrong) farm coordinates.
I would like to know if there is a way to get the GPS values automatically locked in place (I could create new variables and have the enumerator transcribe the values, but would like to automate the process if possible)
Thank you!
Aniseh
Re: locking GPS coordinates
After the GPS has been taken the first time you can set the fields to be protected using the set attributes command. Look under set attributes in the online help.
Re: locking GPS coordinates
Thank you Josh,
I am not able to use Set attributes the way I need it to (or understand it well enough)
I have my 4 variables: V1, GPS, LAT, LON. GPS calls the gps function when the respondent selects "yes" and skips LAT and LON if the respondent answers no.
I have protected LAT and LON so that they can never be manually entered.
My syntax looks like this:
PROC GPS
if GPS=1 then
set attributes (GPS) protect;
if gps(open)and gps(read, 60) then
LAT=gps(latitude);
LON=gps(longitude);
endif;
gps(close);
endif;
But if I come back to V1, and hit "next question" the tablet begins reading the GPS coordinates again...
I am not able to use Set attributes the way I need it to (or understand it well enough)
I have my 4 variables: V1, GPS, LAT, LON. GPS calls the gps function when the respondent selects "yes" and skips LAT and LON if the respondent answers no.
I have protected LAT and LON so that they can never be manually entered.
My syntax looks like this:
PROC GPS
if GPS=1 then
set attributes (GPS) protect;
if gps(open)and gps(read, 60) then
LAT=gps(latitude);
LON=gps(longitude);
endif;
gps(close);
endif;
But if I come back to V1, and hit "next question" the tablet begins reading the GPS coordinates again...
Re: locking GPS coordinates
The proc will still get called even if the field is protected. In your logic you need to avoid calling gps(open) and gps(read) in your proc if have already collected the coordinates.
Re: locking GPS coordinates
Thank you Josh, how can I collect coordinates and avoid calling gps(open) and gps(close) at the same time?josh wrote:The proc will still get called even if the field is protected. In your logic you need to avoid calling gps(open) and gps(read) in your proc if have already collected the coordinates.
Re: locking GPS coordinates
If the coordinates have been collected then the value of lat/lon will be non-blank. So if lat is non-blank (<> notappl) then don't call gps(open) and gps(read). Since you would do this check before you get to the field you would need to use visualvalue() (assuming you are in system control mode).
Code: Select all
PROC GPS
if visualvalue(LAT) = notappl and GPS=1 then
if gps(open)and gps(read, 60) then
LAT=gps(latitude);
LON=gps(longitude);
endif;
gps(close);
endif;
Re: locking GPS coordinates
After further testing this code, I found that it works well for single occurrence records (HH level), but not for multiple occurrence records (plot level).
Do you know why?
Do you know why?
Re: locking GPS coordinates
For multiple occurrence records you will need to add a subscript when you use visualvalue.
This is because normally when you are in the proc for a multiplying occurring item CSPro automatically uses curocc() as the current occurrence but when you use visualvalue for a lookahead it does not.
Code: Select all
visualvalue(LAT(curocc())) = notappl
Re: locking GPS coordinates
Thanks Josh - you have been so helpful through this entire process (preparing the instrument for the field).
Aniseh
Aniseh