Zum Hauptinhalt gehen

SetLayerDefinition - By Geometry

Kommentare

6 Kommentare

  • Permanently deleted user

    is it possible to set layer definition using "geometry" ?  Has anyone done this successfully? 

    I'm looking to display point features within a user defined area. 

    • User selects area using "Display Geometry Capture"
    • Set the visibility of the map service and layer to True using "Set Layer" and "Set MapService" visibility.
    • And then use "Set Layer Definition"  to display the points with the user defined area......but how to I fill in the "definition"?

     

     

     

     

     

    0
  • Nico Burgerhart

    I did this the following way

    • Query task activity with a administrative and spatial selection (Where and Geometry properties)
    • Get Object IDs activity to get the OIDs
    • Create a where clause from the OIDs with an Assign activity: string.Format("OBJECTID IN ({0})",String.Join(",", CType(oids, IList(Of int32)).Select(Function(value) value.ToString )))
    • Set layer definition with with the where clause as definition
    0
  • Permanently deleted user

    Thx Nico...I'll definitely try this out.

    0
  • Permanently deleted user
    Hi All, i'm trying to use the SetLayerDefinition tool in my workflow. I'm unsure of how to utiliize a FeatureSet's geometry to restrict what features show in my Layer. Any help would be really appreciated at this point. Thank You!! -Laura
    0
  • Tyson Schoepflin

    Trying this again.  The form ate all the first post formating... thanks.

    Here is an example using Nico Burgerhart's solution.  Imho this process should be a single activity as it is a commonly used process.

     

    Example:  You need to select projects within a county.  There is no county field on your project features.  Use a county layer to select projects within a specific county's geometry.

     

     

    QueryTask

     

    Where: Find your county by name

     

    Return Geometry: True

     

    Result: A FeatureSet

     

    Get Geometry <Geometry>

     

    We are using polygon in this case as the county is a polygon.  There is only feature returned so we don't have to deal with the index.

     

    FeatureSet: Use the feature set from above

     

    Result: A new geometry variable

     

    QueryTask

     

    We now have the geometry to make our spacial selection.

     

    Where: "1=1"  We want everything in the geometry

     

    Geometry: The geometry variable from above.

     

    Return Geometry: false

     

    Out fields: "OBJECTID"

     

    Result: A feature set.  These are the OBJECTID's of the projects within the county geometry.

     

    Get Object IDs

     

    FeatureSet: The feature set from above.

     

    ObjectIDs: A new list variable.

     

    Assign

     

    The trick now is to create a string of comma delimited object ids which will be used for the definition input on SetLayerDefinition.

     

    Create a string variable for the To input.

     

    Then use Nico Burgerhart's code to convert the OBJECTIDs to a string.  Where "objectIDList" is the variable you created in the step above.

     

    string.Format("OBJECTID IN ({0})",String.Join(",", CType(objectIDList, IList(Of int32)).Select(Function(value) value.ToString )))

     

    SetLayerDefinition

     

    Definition: Use the string from the step above.
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.