Setting Default Map coordinate or Default area of map

Hello!
When using the geo-placement feature, I found it a bit annoying to have to zoom in every time to the desired location (the selection area isn't the same as the location of the survey i.e. you can't zoom to current location to find the area of interest). I was wondering if there was a way to limit the map to a certain longitude and latitude? Or if there was a way you could set a default position and zoom to that position? I hope that made sense
Thank you!
Anjali

You can read how to set defaults in XLSForm at http://xlsform.org/#default. For a geopoint you can set the default by including 4 space-separated values: latitude, longitude, altitude (0 works), accuracy (0 works). The user will be prompted to zoom to it on map launch. For geotrace or geoshape, include either a point as previously described or a list of points separated by semi-colons (;).

There are a series of changes to the geo question types planned and described in a Google doc linked from Collect geotrace and geoshape improvements. One of them is to automatically zoom in to the current location or the default location if it is set. Another is to adjust the default zoom level while collecting points. Please take a look and comment if there are any other improvements you'd like to suggest.

Thanks so much! This is exactly what I needed :slight_smile: I was dong the space separated values for lat and long, didn't realize you needed accuracy and altitude as well! I'll check out the improvements page as well. Thanks again!
-Anjali

1 Like

Hi @akatta13 can you share with us how did you setup the zoom for your form.
Thanks

Hi, I see this is an old topic but I think this is a related question -- when I define the default expression, is there a way to have that be not just a number but an expression or previous response?

For example, I want to have users manually enter a latitude and longitude (in case they have already taken data on this which exists on a gps unit) and then have the ODK form show them the gps point on a placement map to double check. I know this is ungainly - don't worry I also offer them a choice of the much easier placement-map arrangement. But users have asked for it as sometimes they have other sources of location information, even paper notes from a gps unit.

When I upload the form it gives me an error that it cannot assign the variables or value is not found - it seems like the geopoint can only be default-set with four decimal numbers separated by spaces and not by evaluating a variable? (gps_long and gps_lat are decimal types filled in by the user in a previous question, I was hoping to evaluate them using ${gps_long} for example to populate the default position in the geopoint question)

error message: DK Validate Errors: >> XForm is invalid. See below for the errors. : Invalid XPath in value set action declaration: ' ${gps_long} ${gps_lat) 0 0' Problem found at nodeset: ${model}[@xforms-version=1.0.0]/setvalue With element The following files failed validation: ${tmpb78knekx} Result: Invalid

1 Like

Hi @sjvanek
it would be better if you could attach your form it's always clearer. You can't use default because it only allows setting static values. You could try with calculates like I did in this sample form:
coordinates.xlsx (5.0 KB)
Please take a lokk and let us know if it helps you.

1 Like

Thanks very much, I will keep in mind about attaching the form. This was very helpful, it is working great now. Are there other question types where the calculate column is used in this way? very clever.

Steve

Are there other question types where the calculate column is used in this way?

Generally you can use it in any question, if you want to get to know more:

and you can also search here on the forum.