I have two survey123 forms connected to the same feature service. The first is for receiving requests and the second is for inspectors to follow-up with the requests. With the first we are trying to capture a street address as just text (not the point location for the map) and then a point location on a map of where on the resident's property they are having issues. This is important because if we reverse geocode form the point sometimes we get the wrong street address for the inspector to go to. On the flip side if we just use the street address and it's a large parcel of land and no one is home it helps to have a more accurate point to navigate to once we've arrived.
Residents are frustrated that they have to enter their address twice. I'd like the map for the point location to automatically zoom once they've entered their address in the text field. I've tried using the calculate field on the geopoint field with the name of the address field but it doesn't work. Any assistance in getting this to work would be greatly appreciated!
This general functionality of being able to set the zoom/extent of a geopoint question map window based on a previous question or URL parameter would be extremely useful to our organisation as well. This is separate to setting the actual location of the point.
Hi Fred,
You could use the following calculation on the geopoint question. That way the geopoint would be automatically populated based on the text address/geocode question and the residents could either accept the calculated geopoint location or manually move the point to a better location.
concat(number(pulldata("@json",${res_address},"location.y"))," ",number(pulldata("@json",${res_address},"location.x")))
Also, this blog has some more discussion on working with geocode questions and it directs you to a sample survey that has some examples.
Thanks,
-Barbara
Hi Barbara,
Thanks so much for taking the time to respond and offer up this calculation as a possible solution. This works great for pre-loading the map with the xy from the text in the address field but the map doesn't pan or zoom to that location when it's updated. Here is the live form with the change you suggested: https://survey123.arcgis.com/share/2bb9905eb5b44d5ca48b93fa8c607bdb
It also appears that since it's pulling the xy from the address field that when the form is initially opened and that field is blank it's loading the map xy as 0,0 and overriding the default extent and zoom level set in survey123 connect.
Do you think there's a way to keep the default extent and zoom level but upon input of text in the address field to load the xy into the map and have it zoom and pan to that location?
Respectfully,
Fred
Hi @FredMitchell ,
This issue has been fixed in the latest Survey123 December 2021 update. Thanks again for your feedback.
Hi @ZhifangWang1 ,
This doesn't explain how to do it though. Is it using the calculation that Barbara shared?
I see what you mean about the map extent not updating in the web form. There is currently a bug logged with the developers for the map extent in the web form not updating when the geopoint is updated with a calculation. In the meantime one approach you could try to get around the initial map showing at 0,0 would be to add “string-length(${res_address})>0” to the geopoint’s relevant column so the map doesn’t appear or populate until an address is entered. This isn't a perfect solution but could be a possible workaround until the bug is resolved.
I wasn’t able to access your custom locator to test it, but if you are able see the dropdown menu of suggested locations while using your custom locator, you may want to check to make sure that the property names that your custom locator returns for the x and y coordinates are consistent with the ones used in the geopoint calculation.
Thanks,
-Barbara
Hi Barbara,
That works a little better for now. Is there any idea when this bug will be addressed? I stumbled across another post (https://community.esri.com/t5/arcgis-survey123-blog/calculations-on-geopoints/bc-p/893795#M441) and if you dig through the comments it seems as though this bug in regards to the web form has been around for a few years now. The custom locator service is working well!
Glad you got the custom locator workng! There isn't a firm fix date listed for this bug, but I added your use case to the internal issue. Here is a link to the status page for this bug, which will show any updates. This bug was originally filed for media locator files, but also applies to the geocode question use case.
Thanks,
-Barbara