3

Pinched the code from this profiler sample. Having some trouble setting it up with my custom Esri Flex application.

My Flex application is using the Web Mercator Aux Sphere WKID and is using v10 map services, and therefore is 3857 WKID.

When using the tool within my application, I get a 500 error. This is the request is sends:

http://sampleserver2.arcgisonline.com/ArcGIS/rest/services/Elevation/ESRI_Elevation_World/GPServer/ProfileService/execute?f=json&Display_Segments=true&Image_Width=600&Input_Polylines={%22features%22%3A[{%22geometry%22%3A{%22paths%22%3A[[[16616585.72030409%2C-4240972.45511179]%2C[16390943.612806262%2C-4351041.775842438]]]%2C%22spatialReference%22%3A{%22wkid%22%3A3857}}}]}&Image_Height=250

sampleserver2 is on a 9.3.1 setup.

If I swap out the 3857 at the end of that link for the older 102100, I get a correct JSON response.

So how do I get around this?

I can't see an equivalent service on the v10 sample servers.
My environment is all v10, and I would prefer to keep my app within the newer 102100 WKID.

Further info on the change in WKIDs.

1 Answer 1

3

Edit: sorry, my original answer was incorrect. Problem is the spatialReference of the input geometry cannot be understood by 9.3.1 (i.e. wkid 3857). Easy fix, simply set the spatialReference of the input geometry to 102100 before assigning it to the GP Params:

var g:Graphic = event.graphic;
g.geometry.spatialReference = new SpatialReference(102100);
var featureSet:FeatureSet = new FeatureSet([ event.graphic ]);
var params:Object = {
    "Input_Polylines": featureSet,
    "Image_Width": 600,
    "Image_Height": 250,
    "Display_Segments": true
};
gp.execute(params);

You can also set the outSpatialReference for the GP task to 102100 just to make sure the data is returned in the correct projection, though it seems to work fine on my end without setting it.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.