Zum Hauptinhalt gehen

how to change esri mappoint to projectable data type

Kommentare

5 Kommentare

  • Ryan Cooney

    The Project Task activity has an input argument called "FeatureSet" that is of type IEnumerable<Graphic>. So you need to create one of those. The easiest way to do that is to wrap your MapPoint in a FeatureSet. A FeatureSet is an IEnumerable<Graphic> and you can create one from one or more geometries. For example: if you have a MapPoint in a variable called "point" you can create a FeatureSet with the VB expression:

    New FeatureSet(point)

    Also before using the Project Task activity (or any other Geometry Service operation) be sure to set the SpatialReference of your geometry.

    Here is a sample workflow that demonstrates this: (https://support.geocortex.com/Data/Sites/1/userfiles/1725/projecttask.xaml) /Data/Sites/1/userfiles/1725/projecttask.xaml  (save as).

    --Ryan

    0
  • Permanently deleted user

    Thanks--

    That works for me.  Sometimes knowing how to do the smallest dumbest things can make the biggest difference.

    J

    0
  • Permanently deleted user

    I see you "transfer to client"  results(0).geometry.  How do I convert that to a mappoint or get the x y and spatial reference for it?  I  have never use the transfer to client function.

    0
  • Ryan Cooney

    Hi Jeff,

    I just used Transfer To Client so that you could "see" the output in the simulator. That activity can't really be used in a real workflow without some supporting custom code. 

    The easiest (laziest) way to get a MapPoint from a Geometry is to use the center of its extent:

    results(0).Geometry.Extent.GetCenter()

    To understand what is really going on... results(0).Geometry returns us an object of type Geometry. We know that this will in fact be a MapPoint (a particular type of Geometry), but the workflow framework doesn't know this. To be able to use it as a MapPoint we have to cast/convert it to the MapPoint type first. There are a couple ways to do this:

    • In a VB expression you can perform a conversion: CType(results(0).Geometry, MapPoint)
    • Use the Cast<T> activity and choose MapPoint when it prompts you for a type. This activity is kind of like the Assign activity, but it will also cast the object to the desired type.

    --Ryan

    0
  • Permanently deleted user

    Excellent Answer!  This was very helpful. Thanks greatly!

    Sonia

    0

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