How to prefill geopoint in enketo form through URL

I want to pre fill geopoint(latitude,longitude,altitude,accuracy) through URL?

i tried like this : www.myform.com?d[/data/myformname/lat]=28.5825583292
but it not reflected in form. Can anybody help?

Hi @ashish1807,

Welcome to the community! Have you gone through the post discussed previously (it should solve your issue):

Have a great day!

@Kal_Lam hey thank you for your response. But its not working. My latitude field name is “lat”.
I wrote www.myform.com?d[lat]=29.123. Didn’t work

@Kal_Lam is there any solution?

Hi @ashish1807,

Would you mind trying it as follows:

Step 1: Design the survey tab of your xlsform as outlined below:

Image 1

Reference xlsform: You could use this for ease

Pre-fill with Enketo Link (2020 07 22).xlsx (9.5 KB)

Step 2: Deploy your survey form.

Step 3: Copy the link as outlined below:

Step 4: Paste it in a notepad/MS Word or any other software (you feel comfortable to edit with). You should see something like this:

https://ee.kobotoolbox.org/x/SHDBV1bT

Step 4: Customize the link by adding the following at the end of the link shared above (change it as required):

?d[lat]=11.110&?d[long]=12.120&?d[altitude]=90&?d[accuracy]=5

So your new link should be like:

https://ee.kobotoolbox.org/x/SHDBV1bT?d[lat]=11.110&?d[long]=12.120&?d[altitude]=90&?d[accuracy]=5

Step 5: Copy the link to a modern browser (like chrome etc.) and you should see the variables (lat, long, altitude, accuracy) filled out automatically.

Have a great day!

But this is not only just a field. It is a geopicker like this

@Kal_Lam its input type is “number”

@Kal_Lam you know how to pre fill fields whose input type=“number” ?

Hi @ashish1807,

Would you mind having a look at post 5 where the variable lat and long are decimal while the variable altitude and accuracy are integer.

Have a great day!

@Kal_Lam this is in my excel sheet. It’s geopoint which shows all the fields with map

Hi @ashish1807,

I have come up with the answer you have requested for. This could be helpful for a lot of users. Try following the instructions as outlined below.

Step 1: Design the survey tab of your xlsform as outlined below:

Image 1

Reference xlsform: You could use this for ease

GPS Default.xlsx (9.3 KB)

Step 2: Deploy your survey form.

Step 3: Copy the link as outlined below:

image

Step 4: Paste it in a notepad/MS Word or any other software (you feel comfortable to edit with). You should see something like this:

https://ee.kobotoolbox.org/x/b3kheU2b

Step 5: Customize the link by adding the following at the end of the link shared above (change it as required):

?d[GPS]=29.65947736 86.31874018 130.69580078125 3.2900925

So your new link should be like:

https://ee.kobotoolbox.org/x/b3kheU2b?d[GPS]=29.65947736 86.31874018 130.69580078125 3.2900925

Step 6: Copy the link to a modern browser (like chrome etc.) and you should see the GPS being loaded automatically (lat, long, altitude, accuracy) with the one you have provided.

Have a great day!

2 Likes