+ Reply to Thread
Results 1 to 8 of 8

Thread: how to pass the parameter in silverlight about call GeoProcessing?

  1. #1
    tan yg
    Join Date
    Oct 2010
    Posts
    11
    Points
    0
    Answers Provided
    0


    0

    Default how to pass the parameter in silverlight about call GeoProcessing?

    hi all
    i build a GeoProcessing server in ModelBuilder:
    i use the IDW in Raster Interpolation to convert some point to raster,and then publish it to ArcGIS Server, in ArcGIS Desktop and Web Application ,call the GP it is ok, but in Silverlight C# , ERROR!

    the rest info is :

    Task: Model
    Display Name: Model

    Category:
    Help URL: http://demoserver/arcgisoutput/th/Model.htm
    Execution Type: esriExecutionTypeAsynchronous
    Parameters:
    Parameter: Stations
    Data Type: GPFeatureRecordSetLayer
    Display Name: Stations
    Direction: esriGPParameterDirectionInput
    Default Value:

    Geometry Type: esriGeometryPoint
    Spatial Reference: 102100
    Fields:
    OBJECTID (Type: esriFieldTypeOID, Alias: OBJECTID)
    SHAPE (Type: esriFieldTypeGeometry, Alias: SHAPE)
    FVALUE (Type: esriFieldTypeInteger, Alias: FVALUE)
    Parameter Type: esriGPParameterTypeRequired
    Category:


    Parameter: Idw_1

    Data Type: GPRasterDataLayer
    Display Name: Idw_1
    Direction: esriGPParameterDirectionOutput
    Parameter Type: esriGPParameterTypeRequired
    Category:

    and the call code is :
    GraphicsLayer graphicsLayer = (GraphicsLayer)myMap.Layers["test"];

    Random rand = new Random();
    List<Graphic> lstItems = new List<Graphic>();
    foreach (Graphic g in graphicsLayer.Graphics)
    {
    g.Attributes["FVALUE"] = rand.Next(1, 12);
    lstItems.Add(g);
    }
    FeatureSet fs = new FeatureSet(lstItems);
    fs.SpatialReference = new SpatialReference(102100);

    lstParms.Add(new GPFeatureRecordSetLayer("Stations", fs));
    geoprocessorTask.SubmitJobAsync(lstParms);

    especially, i want pass some points with attribute,and then according these point's attribute call the GP to generator IDW Raster,but how to pass the parameter??
    thx

  2. #2
    Jennifer Nery

    Join Date
    May 2010
    Posts
    2,449
    Points
    289
    Answers Provided
    51


    0

    Default Re: how to pass the parameter in silverlight about call GeoProcessing?

    What error message do you get? Please try to use Fiddler to see that the GP parameters are correct and that you can run the same job from the web browser. It should be similar to the steps described in post #14 on this thread: http://forums.arcgis.com/threads/147...-And-Perimeter Run Fiddler and your SL app.
    Jennifer Nery
    Software Developer
    ArcGIS API for SL/WPF/WP7

  3. #3
    tan yg
    Join Date
    Oct 2010
    Posts
    11
    Points
    0
    Answers Provided
    0


    0

    Default Re: how to pass the parameter in silverlight about call GeoProcessing?

    first thanks a lot.
    i use the Fiddler ,and the json information is:

    Stations={"geometryType":"esriGeometryPoint","spatialReference":{"wkid":102100},"features":[{"geometry":{"x":13381735,"y":3702724,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"8"}},{"geometry":{"x":13384167,"y":3696158,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"1"}},{"geometry":{"x":13372653,"y":3698329,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"2"}},{"geometry":{"x":13372947,"y":3694618,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"9"}},{"geometry":{"x":13376655,"y":3685459,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"10"}},{"geometry":{"x":13383735,"y":3685039,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"3"}},{"geometry":{"x":13372207,"y":3699378,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"8"}},{"geometry":{"x":13371507,"y":3698318,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"9"}},{"geometry":{"x":13372947,"y":3694618,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"6"}},{"geometry":{"x":13374367,"y":3694538,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"10"}},{"geometry":{"x":13384887,"y":3703838,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"8"}},{"geometry":{"x":13384167,"y":3696158,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"5"}},{"geometry":{"x":13383907,"y":3683678,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"8"}},{"geometry":{"x":13382467,"y":3687998,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"4"}},{"geometry":{"x":13376607,"y":3690378,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"7"}},{"geometry":{"x":13374229,"y":3696227,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"11"}},{"geometry":{"x":13370729,"y":3691187,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"10"}},{"geometry":{"x":13375337,"y":3685363,"spatialReference":{"wkid":102100}},"attributes":{"FVALUE":"10"}}]}&f=json&
    ........
    Especially ,in web application all is ok,
    i guess the parameters i pass to the GP is not correct, and in json information the {"FVALUE":"10"}
    is wrong, FVALUE should be integer type,here is string type???

    can you show me a sample with how to pass the a lot of graphic with attribute to GP Service.
    thanks very much!
    Last edited by tanyg; 11-13-2010 at 03:27 AM.

  4. #4
    tan yg
    Join Date
    Oct 2010
    Posts
    11
    Points
    0
    Answers Provided
    0


    0

    Default Re: how to pass the parameter in silverlight about call GeoProcessing?

    hi all
    i find the problem is not how to pass the parameters.
    when i pass the parameters less than 9,all is correct,but when more than 9 wrong!
    and i find by using Fiddler when the parameters less than 9 ,the web method is "GET",but more than 9 the web method is "POST"??
    and is there anywhere i can config or other??

    thx!

  5. #5
    Morten Nielsen

    Join Date
    Oct 2009
    Posts
    1,166
    Points
    44
    Answers Provided
    7


    0

    Default Re: how to pass the parameter in silverlight about call GeoProcessing?

    This smells like a bug in IE that ArcGIS Server exposes. Try it in FireFox and see if that works. If that's the case, try running this line of code when your app first starts up, and see if that doesn't fix it:

    WebRequest.RegisterPrefix("http://www.myserver.com/arcgis/rest", WebRequestCreator.ClientHttp);

    This basically forces Silverlight to perform the request for that domain instead of letting the browser do the work for it. Silverlight handles the response from ArcGIS server correctly.
    /Morten Nielsen
    ArcGIS Runtime SDK for .NET
    silverlight team blog - twitter - personal blog

  6. #6
    tan yg
    Join Date
    Oct 2010
    Posts
    11
    Points
    0
    Answers Provided
    0


    0

    Default Re: how to pass the parameter in silverlight about call GeoProcessing?

    thank you very much !
    follow your method, i add "WebRequest.RegisterPrefix("http://www.myserver.com/arcgis/rest", WebRequestCreator.ClientHttp); " before call the GP Service ,it's running correct,
    and i increase the points to 5000,also correct!

    FYI
    http://blogs.msdn.com/b/silverlight_...erlight-3.aspx

    thank you very much again!
    Last edited by tanyg; 11-15-2010 at 05:12 PM.

  7. #7
    Morten Nielsen

    Join Date
    Oct 2009
    Posts
    1,166
    Points
    44
    Answers Provided
    7


    0

    Default Re: how to pass the parameter in silverlight about call GeoProcessing?

    Don't call RegisterPrefix everytime you call the GP service. Only do it once (ie. at app startup or the first time you use the GP tool).
    /Morten Nielsen
    ArcGIS Runtime SDK for .NET
    silverlight team blog - twitter - personal blog

  8. #8
    tan yg
    Join Date
    Oct 2010
    Posts
    11
    Points
    0
    Answers Provided
    0


    0

    Default Re: how to pass the parameter in silverlight about call GeoProcessing?

    thanks for your tip! i do that as your method!

+ Reply to Thread

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts