Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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 cant 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.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

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.

share|improve this answer
    
Thanks Sasa! Works a treat. Lesson learned... –  Simon Oct 5 '11 at 23:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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