Input of GP: GPFeatureRecordSetLayer ; how to send featureSet?

1598
1
09-10-2013 02:15 PM
Ravichandran_M_Kaushika
Occasional Contributor
Readers,

good evening. thanks for taking the time to read this entire post.

We have a GP service that returns rasters based on a bounding box. the raster services are downloaded from an REST URL of esri image service created from a mosaic dataset.

Since it was working well and users could download from a multiple rest service, some users requested a modification that would enable end users to send features to this GP function and download a cookie cut of the rasters based on the feature outline.

So working GP function was copied and modified to be a new GP service. One of the input params of the new service:

Parameter: InputAOIBBox[INDENT]Data Type: GPFeatureRecordSetLayer
Display Name InputAOIBBox
Description: Some Description.
Direction: esriGPParameterDirectionInput
Default Value: [/INDENT]



    • Geometry Type:

    • HasZ: false
      HasM: false
      Spatial Reference: N/A
      Fields: None

      Features: None.
    Parameter Type: esriGPParameterTypeRequired
    Category:
name of the parameter was not changed from the previous working GP function - I hope that is not the issue.


feature set is created from 2 steps:
1. when users click on a feature based REST service mapserver layer, some features are queried and features are successfully returned as follows:

aoiSelectionLayer.selectFeatures(query, esri.layers.FeatureLayer.SELECTION_NEW, function (results) {
            dojo.forEach(results, function (individualFeature) {
                
                var individualFeatureInGCS = new esri.geometry.webMercatorToGeographic(individualFeature.geometry);
                var newGraphicsInGCS = new esri.Graphic(individualFeatureInGCS, null, individualFeature.attributes, null);


                inputAttributesList4GP = individualFeature.attributes;
                inputFeatureSetParamWGS.push(newGraphicsInGCS);
            });              
        });




Many code lines later:

var fsFeatureset2BSet = new esri.tasks.FeatureSet();
fsFeatureset2BSet.features = inputFeatureSetParamWGS;
fsFeatureset2BSet.spatialReference = new esri.SpatialReference(4326);
fsFeatureset2BSet.geometryType = "esriGeometryPolygon";



gpparams = {
"InputImageServiceURL": inputimageserviceurlwithpipe, 
"InputAOIBBox": fsFeatureset2BSet
};




Old function calls to GP were retained because they were working in the previous version of the GP funciton; of course, the new GP function URL was called.

using Fiddler the input feature information was also traced:



f=json&InputImageServiceURL=http://myservername.domain.gov:6080/arcgis/rest/services/LiDAR/bare_earth_2m_feet/ImageServer|http://myservername.domain.gov:6080/arcgis/rest/services/LiDAR/bare_earth_2m_hillshade/ImageServer&InputAOIBBox={"geometryType":"esriGeometryPolygon","features":[{"geometry":{"rings":[[[-98.58835071731345,35.241297119115806],[-98.58833275100777,35.24327803182062],[-98.58439813006332,35.243043259509136],[-98.58433524799344,35.24511950356405],[-98.5825835331894,35.245545016982945],[-98.58261048264792,35.24650608217724],[-98.58190081357347,35.24657944546455],[-98.57976282319727,35.246594118114054],[-98.57976282319727,35.240394687285466],[-98.58128995918027,35.24040936105408],[-98.5815145380013,35.24043870858333],[-98.58176606628085,35.24053408798009],[-98.58305065713714,35.241201740616454],[-98.58381422512865,35.24161993781974],[-98.5839579555741,35.24172265259243],[-98.58398490503262,35.24184004074476],[-98.58400287133831,35.2422362245044],[-98.58403880394967,35.24243431565839],[-98.5840657534082,35.242463662454874],[-98.58413761863092,35.24241964225617],[-98.58410168601957,35.24183270399022],[-98.58403880394967,35.24162727459353],[-98.58396693872695,35.24154657004533],[-98.58325726965249,35.24119440380416],[-98.58214335870018,35.24058544607032],[-98.58164928529392,35.2403800135142],[-98.58128995918027,35.24030664461804],[-98.58835071731345,35.240328655293865],[-98.58835071731345,35.241297119115806]]],"spatialReference":{"wkid":4326}},"attributes":{"OBJECTID":24298014}},{"geometry":{"rings":[[[-98.58850343091174,35.247247048328674],[-98.58809020588104,35.24726172085735],[-98.58789257651854,35.24721036699533],[-98.58778477868445,35.24714434055352],[-98.58778477868445,35.247019623794486],[-98.5878835933657,35.2468142075379],[-98.58773986292024,35.24671883552758],[-98.58764104823899,35.24673350815185],[-98.58756019986342,35.24682154384174],[-98.58751528409921,35.247026960079744],[-98.58741646941796,35.24714434055352],[-98.58731765473671,35.24715167682748],[-98.58731765473671,35.2474451272419],[-98.58418253439513,35.247423118497665],[-98.57975384004443,35.247430454746414],[-98.57976282319727,35.246594118114054],[-98.58190081357347,35.24657944546455],[-98.58261048264792,35.24650608217724],[-98.5825835331894,35.245545016982945],[-98.58433524799344,35.24511950356405],[-98.58439813006332,35.243043259509136],[-98.58833275100777,35.24327803182062],[-98.58835071731345,35.240328655293865],[-98.5884495319947,35.240328655293865],[-98.58850343091174,35.247247048328674]]],"spatialReference":{"wkid":4326}},"attributes":{"OBJECTID":24298016}}],"sr":{"wkid":4326}} 


after sending this amount of information, server returns an error:

<Msg time='2013-09-10T14:16:29,939' type='SEVERE' code='20010' target='ElevationClipNShipGP/ElevationClipNShipFeatSet.GPServer' methodName='GPServerSync.CheckMessages' machine='GISDEV1.GDW.ONE.USDA.GOV' process='12904' thread='19120' user='null' >ERROR 000735: InputAOIBBox: Value is required
ERROR 000735: InputAOIBBox: Value is required</Msg>


Any suggestions: i went round and round; no solutions for me till now.

regards
ravi.
1 Reply
Ravichandran_M_Kaushika
Occasional Contributor
Problem solved:  GP function's input parameter was modified to be 'Feature layer' instead of feature set ALTHOUGH javascript app is sending the graphics drawn as a featureset.

var fsFeatureset2BSent = new esri.tasks.FeatureSet();
fsFeatureset2BSent.features = inputFeatureSetParamWGS;
fsFeatureset2BSent.spatialReference = new esri.SpatialReference(4326);
fsFeatureset2BSent.geometryType = "esriGeometryPolygon";




Rest Service of GP function....

Parameter: InputAOIBBox
    Data Type: GPFeatureRecordSetLayer
    Display Name InputAOIBBox
    Description: some description
    Direction: esriGPParameterDirectionInput
    Default Value:
      Geometry Type: esriGeometryPolygon
      HasZ: false
      HasM: false
      Spatial Reference: 4326 (4326)

      Fields:

      • FID ( type: esriFieldTypeOID , alias: FID )

      • Id ( type: esriFieldTypeInteger , alias: Id )

      • Shape_Length ( type: esriFieldTypeDouble , alias: Shape_Length )

      • Shape_Area ( type: esriFieldTypeDouble , alias: Shape_Area )

      Features: None.

    Parameter Type: esriGPParameterTypeRequired
    Category:


    Hope it helps.

    regards
    ravi.