Zum Hauptinhalt gehen

Sorting Results by Distance

Kommentare

7 Kommentare

  • Denise Beckham
    Update

     

    I tried switching Geometry 1 and Geometry 2 in the distance task.  It assigned different distances to each feature, but sorted them from east to west.  I then realized that the minimum distance is 7,830 miles.  I used Google maps to take some measurements, and that seems to be the distance to (0,0), off the coast of Africa.  I'm wondering if it has something to do with coordinate systems.  However, this workflow allows users to choose whether to use their current location or enter in an address.  I've been working with the current location part of the workflow, but the address search part of the workflow sorts the results properly with the exact same technique.  It must have something to do with the Get Current Position Task...
    0
  • Nico Burgerhart
    Get Current Position Activity: This activity always reports positions using the WGS84 (4326) spatial reference. This may not match the spatial reference of your application. Perhaps you have to add a Project Single Geometry Task?

     

     
    0
  • Denise Beckham
    Hello Nico,

     

    Thank you for the suggestion! I had actually been having a problem with the results highlights matching up, so I changed the data frame in the mxd I published the service from to WGS84 and applied a transformation.  That fixed the misalligned hightlights.  But would the actual feature class have to be in WGS84 as well for this to work? If so, I can project the feature class in ArcMap and overwite the service.

     

    I tried using a Project Single Geometry Task, but it doesn't like the feature set variable.
    0
  • Nico Burgerhart
    In case of a featureset, you should use the Project Task.
    0
  • Denise Beckham
    I used the project Task, but the result is an IList Graphic, so I can't add a distance field to it.
    0
  • Permanently deleted user
    Hi Denise, 

     

    Try using Project Single Geometry Task, instead of Project Task.  It just gives back a single geometry result.  You could use that to project the user location point to match the other featureset.

     

    (for cases where you get back an IList of Graphics though, you can always create a new featureset and then use AddRangeToCollection to push the IList into myFSVariable.Features)

     

    Hope that helps!

     

    -Amanda
    0
  • Denise Beckham
    Hello Amanda,

     

    I used the Project Single Geometry Task on the user location point, but it made no difference.  I tried projecting the feature set as well, but I still can't figure out how to convert the IList Graphic Results back to a feature set.  I don't get how Add Range to Collection fits in.  Do I need to use Create Collection rather than Assign to create a new feature set?
    0

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