Hoppa till huvudinnehållet

How to get Geometry from Geometry Picker Activity

Kommentarer

9 kommentarer

  • Amanda Frech

    Hi Robbie,

     

    The output for the geometry from the Geometry Picker looks something like this:

    $form1.state.GeometryPicker1.value.geometry[0]

     

    where $form1 is the ID of your form and GeometryPicker1 is the ID of the geometry picker form element.

    geometry[0] is the first geometry result from the Geometry picker. If you have the "Maximum Geometries" property set to more than 1, you could have [0], [1], [2], [3], etc. But if you've got "Maximum Geometries" set to 1, then [0] is the index you'll want to use.

     

    An example to test this would be to add an Alert activity that uses

    Text: =$form1.state.GeometryPicker1.value.geometry[0].x.toString()

     

    0
  • Permanently deleted user
    Ok great thanks! I am able to get the x y coordinates from the geometry but now how do I reproject the value from Geometry Picker to wkid 4326 (WGS 84)? Looks like I’m pulling in Web Mercator coordinates. I’ve been playing around with the Project Geometry activity but I haven’t had any luck. I am using our ArcGIS Geometry Server, setting the geometry to =$form1.state.GeometryPicker1.value.geometry[0] and then the spatial reference to =new SpatialReference(4326). I’m not sure if this syntax is correct or what to do with the result of Project Geometry activity to get the coordinates as string variables. [cid:image001.png@01D310FD.4398E420]
    0
  • Amanda Frech

    Hi Robbie,

     

    The Geometry Picker will use the spatial reference of your viewer/app for the geometry that it gets. There's likely a Web Mercator basemap that's setting this projection.

     

    The Project Geometry activity's Spatial Reference input takes a string or number. To get wkid 4326, you would want it to look like

    Out Spatial Reference: 4326

     

    Then to use your new projected geometry's x and y coordinates, the format would be:

    $projectservicetask1.geometry.x

    $projectservicetask1.geometry.y

     

    Where $projectservicetask1 is the ID of your Project Geometry activity. Depending on where you're using it, you might also need to add a .toString() to the end.

     

    0
  • Permanently deleted user

    Perfect! Now that I have it working, one last question for future reference. What is the best way to create variables and assign them values? Say I want to store the geometry coordinates of the Project Geometry Activity to separate x and y variables like so:

    var pointX = $projectservicetask1.geometry.x

    var pointY = $projectservicetask1.geometry.y

     

    Would I use the Create Value Activity?

    0
  • Amanda Frech

    Hi Robbie,

     

    Geocortex Workflow uses the concept of "outputs" rather than variables. So typically you would want to use $projectservicetask1.geometry.x wherever it needs to be used, rather than assigning the value to something else.

     

    That said, if you want to create a new output with a new name, or use expressions to create outputs that incorporate several values, there's the Create Value activity.

     

    Example of use:

    Expression: ="my x value is: " + $projectservicetask1.geometry.x

    The syntax for the result is

    $value1.result

    where value1 is the ID of the the Create Value activity (you can change the ID to something more intuitive if you like).

    0
  • Permanently deleted user

    Thank you. Sorry one more. Is there an activity to open a web page? I know in Essentials you could use RunExternalCommand "OpenWebPage" and then supply the URL as the parameter. Is there something similar in Workflow 5 that would work?

    0
  • Amanda Frech

    If you're using an Essentials HTML5 viewer, you can use the Run Command activity, which is pretty equivalent to the previous RunExternalCommand activity.

     

    Example of use:

    Command Name: OpenWebPage

    Command Parameter: http://www.google.com

     

    Alternatively, you could provide a Form if you wanted to present a hyperlink for the user to click.

    0
  • Ethan Granger

    Is this case sensitive? If so the autocomplete doesn't have the proper case.

    0
  • Ethan Granger

    AutoComplete

    0

Du måste logga in om du vill lämna en kommentar.