Map not loading (Lines and polygons example) when using multiple calculations

386
1
01-05-2022 06:39 AM
kelin84
New Contributor III

Hi, I want to create a question where I can choose different inputs to create the area extend in a geoshape.

Therefor I have a single choise list, where I can choose:
1. Use multiple vertices
2. Use one location
3. Draw on a map

so by having multiple calculations ${vertices} + ${one_location} going into the geoshape, seems to make the map keep loading in the webform, is it possible to make this work at all?

I can see that is the same if I publish the line and polygon example, some of the maps are just loading and nothing is happening.


If this is a failure in the map, and not the data model, is it then posible to render multiple maps, going to the same geoshape question? 

Thanks.

0 Kudos
1 Reply
DerrickWestoby
Occasional Contributor III

Hi Kelin, 

I don't fully understand your question, but it sounds pretty close to a few implementations I have and possibly an untested idea. 

First off, your example (${vertices} + ${one_location}) won't work because you need to format the geometry string perfectly.  See this esri article, under "Defaults and expressions", for an example of the exact format this string needs to be in. 

Example:

  -37.842156723211474 144.95942945338243; -37.83554486071995 144.9726235713864; -37.85681405373047 144.98240735651922; -37.85954045531896 144.97715349053766

 

You want to use concatenate for this example.  If we assume that your ${vertices} field contains a perfectly formatted string of vertices and you want to add an additional vertex called ${one_location that is also perfectly formatted, you could do something like this in a calculate field and then point your geoshape calculate column at it:

concat(${vertices},' ',${one_location})

(for reference, here's a functional calculate from one of my forms where I'm finding the min/max lat/lon value across a repeat to generate a work extents geoshape:

concat(${max_lat},' ',${min_lon},';',${max_lat},' ',${max_lon},';',${min_lat},' ',${max_lon},';',${min_lat},' ',${min_lon})

IF You have multiple geo_____ questions in your survey - Make sure that the geoshape question where you are actually storing geometry and uploading to your feature layer is the FIRST geo____ question in your survey.  If you have other geo questions in your survey, even if they are set to <null>, make sure they're lower down in the XLS than the one that will be storying the geometry.  I had an issue a few weeks ago where this was preventing my geoshape from being pushed to the feature layer. 

 

As far as the ability to let your users select which method they want to use, I've been brainstorming this as well.  The early forms that I had set up all require a photo attachment and the location of the geopoint (in a repeat) is set up to extract the image's geotags and use those (because I wanted to be able to use drone imagery).  The updated forms I'm working on just pull from the device's GPS instead.  I wanted to add the option to let people select which to use, but all of the implementations I've tried so far end up as a pretty clunky user experience.   Assuming that's a similar sort of situation for you, you're welcome to try out an untested idea that I haven't gotten to yet:

1. ${upload_geoshape} - The Geoshape that will ultimately be uploaded/used

2. ${select_method} - Select_one question that the user sees based on your options

3. ${method_1}, ${method_2}, ${method_3} - 3x different geoshape questions with bind::type set to null and the relevant column based on the user's ${select_method}

4. A calculate field that handles the IF statement and pulls the geometry from whichever selected method (and geoshape) that the user selects. 

 

You could hide #1 in a collapsed group or something at the beginning of the form, and 2-4 would be in their own group.  The user would only see the select_one ${select_method} question initially.  When they select the option, the relevant geoshape question would appear.   The geometry they input would then be extracted by the calculate field (#4) and used to populate your ${upload_geoshape} question that the user wouldn't even see.  

Again....that process is untested, but I'm pretty sure it'll work.  The only reason I haven't implemented it on my forms yet is because they're for field users to go out and collect a lot of points in a short amount of time and I'm trying to minimize clicks and button presses for them.  I know that most of them aren't going to want to be forced to select an option each  time and if I were to use a default option the ${upload_geoshape} question, I'd still have to ask them to hit the "recalculate" button if they changed it. 

0 Kudos