<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Geoprocessing in ESRI-Leaflet with a polygon returns an error 500 in Open Source Mapping Libraries Ques.</title>
    <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/geoprocessing-in-esri-leaflet-with-a-polygon/m-p/878866#M146</link>
    <description>&lt;P&gt;I'm having some trouble hooking up a geoprocessing task in esri-leaflet, when allowing the user to input a polygon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;I'm receiving an error 500 back from ArcGIS Server when I submit a polygon via ESRI-Leaflet. I'm not overly good with Javascript, so I may be missing something obvious - though it's not obvious to me.&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;I'm hoping you might be able to point at something in the first bit of javascript below with a "this is where it's wrong, try this instead". I've spent quite a number of hours searching esri-leaflet examples for polygon operations, but am coming up empty handed.&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-none" tabindex="0"&gt;&lt;CODE&gt;{"error":{"code":500,"message":"Error performing execute operation","details":[]}}‍&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;The page is very basic at the moment, and uses the leaflet example page, with esri-leaflet.js and esri-leaflet-gp added for the desired functionality.&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;I'll include the full page code at the bottom, but the main piece of JS in question is:&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-none" tabindex="0"&gt;&lt;CODE&gt;//Define the GP service location
var gpService = L.esri.GP.service({
url: "http://machine:6080/arcgis/rest/services/GPServices/TestPolygonGPService/GPServer/Test%20Polygon%20GP%20Service",
useCors:true
});


//Trigger when the create event is complete
map.on(L.Draw.Event.CREATED, function (event) {
    var layer = event.layer;

    var gpTask = gpService.createTask();
    gpTask.setParam("InputPolygonSymbology_lyr", layer.toGeoJSON());
    console.log(layer.toGeoJSON());
    console.log("setParameter of event.layer successful");
    gpTask.run(polyQueryCallback);
    console.log("successfully called and returned the callback");
    drawnItems.addLayer(layer);
});

function polyQueryCallback(error, response, raw){
    //map.addLayer(L.geoJSON(layer));
    //console.log(Polyarea);
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;The geoprocessing service looks like below. Notice that there is a field "rand" and the shape length and area that I'm not submitting to the GP service. "rand" is set to allow nulls.&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;In this scenario I'm hoping that the only required input is the polygon geometry as JSON via the esri-leaflet arrangment.&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-none" tabindex="0"&gt;&lt;CODE&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE class="lia-code-sample line-numbers language-none" tabindex="0"&gt;&lt;CODE&gt;Task: Test Polygon GP Service
Display Name: Test Polygon GP Service 

Description: This service is designed to test returning a single unique identifying parameter, together with comitting a polygon to an SDE database table whilst using in_memory workspaces. 

Category: 

Help URL: http://mi018461:6080/arcgis/rest/directories/arcgisoutput/GPServices/TestPolygonGPService_GPServer/GPServices_TestPolygonGPService/Model.htm 

Execution Type: esriExecutionTypeAsynchronous 

Parameters: 
Parameter: InputPolygonSymbology_lyr 
Data Type: GPFeatureRecordSetLayer 
Display Name InputPolygonSymbology.lyr 
Description: 50 percent opacity, and purple. 
Direction: esriGPParameterDirectionInput 
Default Value:
Geometry Type: esriGeometryPolygon 
HasZ: false 
HasM: false 
Spatial Reference: 102100  (3857) 

Fields:
objectid ( type: esriFieldTypeOID , alias: OBJECTID )
rand ( type: esriFieldTypeString , alias: rand , length: 50 )
shape_Length ( type: esriFieldTypeDouble , alias: shape_Length )
shape_Area ( type: esriFieldTypeDouble , alias: shape_Area )
Features: # records: 1

objectid: 1
rand: null
shape_Length: 8686075.788202167
shape_Area: 4.50582047673178E12
Polygon:
[-9999054.1244, 2095332.1645000018] , [-8234515.1612, 2524514.3561999984] , [-8203558.337300001, 139316.78449999914] more... 



Parameter Type: esriGPParameterTypeRequired 
Category: 

Parameter: RandVal 
Data Type: GPString 
Display Name RandVal 
Description: 
Direction: esriGPParameterDirectionOutput 
Default Value: 
Parameter Type: esriGPParameterTypeDerived 
Category: ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;&lt;BR /&gt;The data that the browser is sending seems to be in line with what I'd expect. Properly formed JSON, with coordinates, and type defined as polygon. It is perhaps missing the fields, as seen in the second image. The second image is the network output from Web App Builder with the geoprocessing widget (which returns a successful result)&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;&lt;IMG class="image-1 jive-image j-img-original" src="https://i.stack.imgur.com/FPYus.png" border="0" alt="" /&gt;&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;&lt;SPAN&gt;Web App Builder network output&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;&lt;SPAN&gt;&lt;IMG class="image-2 jive-image j-img-original" src="https://i.stack.imgur.com/Rn6PZ.png" border="0" alt="" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;So at this point, I can say it's something in how I'm submitting, but I'm not sure what to change, or how. Any keen suggestions?&lt;/P&gt;
&lt;P style="background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;The full code to the page is below - the GP service URL wont work - sorry.&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-none" tabindex="0"&gt;&lt;CODE&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Leaflet.draw vector editing handlers&amp;lt;/title&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/docs/examples/libs/leaflet-src.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;link rel="stylesheet" href="http://leaflet.github.io/Leaflet.draw/docs/examples/libs/leaflet.css"/&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/Leaflet.draw.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/Leaflet.Draw.Event.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;link rel="stylesheet" href="http://leaflet.github.io/Leaflet.draw/src/leaflet.draw.css"/&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/Toolbar.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/Tooltip.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/ext/GeometryUtil.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/ext/LatLngUtil.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/ext/LineUtil.Intersect.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/ext/Polygon.Intersect.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/ext/Polyline.Intersect.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/ext/TouchEvents.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/DrawToolbar.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.Feature.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.SimpleShape.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.Polyline.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.Marker.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.Circle.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.CircleMarker.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.Polygon.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.Rectangle.js"&amp;gt;&amp;lt;/script&amp;gt;


    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/EditToolbar.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/EditToolbar.Edit.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/EditToolbar.Delete.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/Control.Draw.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/Edit.Poly.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/Edit.SimpleShape.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/Edit.Rectangle.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/Edit.Marker.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/Edit.CircleMarker.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/Edit.Circle.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load Esri Leaflet from CDN --&amp;gt;
    &amp;lt;script src="https://unpkg.com/esri-leaflet@2.2.4/dist/esri-leaflet.js"
    integrity="sha512-tyPum7h2h36X52O2gz+Pe8z/3l+Y9S1yEUscbVs5r5aEY5dFmP1WWRY/WLLElnFHa+k1JBQZSCDGwEAnm2IxAQ=="
    crossorigin=""&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- load the latest release from the cdn automatically --&amp;gt;
    &amp;lt;script src="https://unpkg.com/esri-leaflet-gp"&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div id="map" style="width: 800px; height: 600px; border: 1px solid #ccc"&amp;gt;&amp;lt;/div&amp;gt;

&amp;lt;script&amp;gt;
    var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
            osmAttrib = '&amp;amp;copy; &amp;lt;a href="http://openstreetmap.org/copyright"&amp;gt;OpenStreetMap&amp;lt;/a&amp;gt; contributors',
            osm = L.tileLayer(osmUrl, { maxZoom: 18, attribution: osmAttrib }),
            map = new L.Map('map', { center: new L.LatLng(51.505, -0.04), zoom: 13 }),
            drawnItems = L.featureGroup().addTo(map);
    L.control.layers({
        'osm': osm.addTo(map),
        "google": L.tileLayer('http://www.google.cn/maps/vt?lyrs=s@189&amp;amp;gl=cn&amp;amp;x={x}&amp;amp;y={y}&amp;amp;z={z}', {
            attribution: 'google'
        })
    }, { 'drawlayer': drawnItems }, { position: 'topleft', collapsed: false }).addTo(map);
    map.addControl(new L.Control.Draw({
        edit: {
            featureGroup: drawnItems,
            poly: {
                allowIntersection: false
            }
        },
        draw: {
            polygon: {
                allowIntersection: false,
                showArea: true
            }
        }
    }));

    //Define the GP service location
    var gpService = L.esri.GP.service({
    url: "http://machine:6080/arcgis/rest/services/GPServices/TestPolygonGPService/GPServer/Test%20Polygon%20GP%20Service",
    useCors:true
    });


    //Trigger when the create event is complete
    map.on(L.Draw.Event.CREATED, function (event) {
        var layer = event.layer;

        var gpTask = gpService.createTask();
        gpTask.setParam("InputPolygonSymbology_lyr", layer.toGeoJSON());
        console.log(layer.toGeoJSON());
        console.log("setParameter of event.layer successful");
        gpTask.run(polyQueryCallback);
        console.log("successfully called and returned the callback");
        drawnItems.addLayer(layer);
    });

    function polyQueryCallback(error, response, raw){
        //map.addLayer(L.geoJSON(layer));
        //console.log(Polyarea);
    }

&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 28 Aug 2023 12:53:51 GMT</pubDate>
    <dc:creator>SimonWebster</dc:creator>
    <dc:date>2023-08-28T12:53:51Z</dc:date>
    <item>
      <title>Geoprocessing in ESRI-Leaflet with a polygon returns an error 500</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/geoprocessing-in-esri-leaflet-with-a-polygon/m-p/878866#M146</link>
      <description>&lt;P&gt;I'm having some trouble hooking up a geoprocessing task in esri-leaflet, when allowing the user to input a polygon.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;I'm receiving an error 500 back from ArcGIS Server when I submit a polygon via ESRI-Leaflet. I'm not overly good with Javascript, so I may be missing something obvious - though it's not obvious to me.&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;I'm hoping you might be able to point at something in the first bit of javascript below with a "this is where it's wrong, try this instead". I've spent quite a number of hours searching esri-leaflet examples for polygon operations, but am coming up empty handed.&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-none" tabindex="0"&gt;&lt;CODE&gt;{"error":{"code":500,"message":"Error performing execute operation","details":[]}}‍&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;The page is very basic at the moment, and uses the leaflet example page, with esri-leaflet.js and esri-leaflet-gp added for the desired functionality.&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;I'll include the full page code at the bottom, but the main piece of JS in question is:&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-none" tabindex="0"&gt;&lt;CODE&gt;//Define the GP service location
var gpService = L.esri.GP.service({
url: "http://machine:6080/arcgis/rest/services/GPServices/TestPolygonGPService/GPServer/Test%20Polygon%20GP%20Service",
useCors:true
});


//Trigger when the create event is complete
map.on(L.Draw.Event.CREATED, function (event) {
    var layer = event.layer;

    var gpTask = gpService.createTask();
    gpTask.setParam("InputPolygonSymbology_lyr", layer.toGeoJSON());
    console.log(layer.toGeoJSON());
    console.log("setParameter of event.layer successful");
    gpTask.run(polyQueryCallback);
    console.log("successfully called and returned the callback");
    drawnItems.addLayer(layer);
});

function polyQueryCallback(error, response, raw){
    //map.addLayer(L.geoJSON(layer));
    //console.log(Polyarea);
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;The geoprocessing service looks like below. Notice that there is a field "rand" and the shape length and area that I'm not submitting to the GP service. "rand" is set to allow nulls.&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;In this scenario I'm hoping that the only required input is the polygon geometry as JSON via the esri-leaflet arrangment.&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-none" tabindex="0"&gt;&lt;CODE&gt;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE class="lia-code-sample line-numbers language-none" tabindex="0"&gt;&lt;CODE&gt;Task: Test Polygon GP Service
Display Name: Test Polygon GP Service 

Description: This service is designed to test returning a single unique identifying parameter, together with comitting a polygon to an SDE database table whilst using in_memory workspaces. 

Category: 

Help URL: http://mi018461:6080/arcgis/rest/directories/arcgisoutput/GPServices/TestPolygonGPService_GPServer/GPServices_TestPolygonGPService/Model.htm 

Execution Type: esriExecutionTypeAsynchronous 

Parameters: 
Parameter: InputPolygonSymbology_lyr 
Data Type: GPFeatureRecordSetLayer 
Display Name InputPolygonSymbology.lyr 
Description: 50 percent opacity, and purple. 
Direction: esriGPParameterDirectionInput 
Default Value:
Geometry Type: esriGeometryPolygon 
HasZ: false 
HasM: false 
Spatial Reference: 102100  (3857) 

Fields:
objectid ( type: esriFieldTypeOID , alias: OBJECTID )
rand ( type: esriFieldTypeString , alias: rand , length: 50 )
shape_Length ( type: esriFieldTypeDouble , alias: shape_Length )
shape_Area ( type: esriFieldTypeDouble , alias: shape_Area )
Features: # records: 1

objectid: 1
rand: null
shape_Length: 8686075.788202167
shape_Area: 4.50582047673178E12
Polygon:
[-9999054.1244, 2095332.1645000018] , [-8234515.1612, 2524514.3561999984] , [-8203558.337300001, 139316.78449999914] more... 



Parameter Type: esriGPParameterTypeRequired 
Category: 

Parameter: RandVal 
Data Type: GPString 
Display Name RandVal 
Description: 
Direction: esriGPParameterDirectionOutput 
Default Value: 
Parameter Type: esriGPParameterTypeDerived 
Category: ‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;&lt;BR /&gt;The data that the browser is sending seems to be in line with what I'd expect. Properly formed JSON, with coordinates, and type defined as polygon. It is perhaps missing the fields, as seen in the second image. The second image is the network output from Web App Builder with the geoprocessing widget (which returns a successful result)&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;&lt;IMG class="image-1 jive-image j-img-original" src="https://i.stack.imgur.com/FPYus.png" border="0" alt="" /&gt;&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;&lt;SPAN&gt;Web App Builder network output&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;&lt;SPAN&gt;&lt;IMG class="image-2 jive-image j-img-original" src="https://i.stack.imgur.com/Rn6PZ.png" border="0" alt="" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="color: #242729; background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;So at this point, I can say it's something in how I'm submitting, but I'm not sure what to change, or how. Any keen suggestions?&lt;/P&gt;
&lt;P style="background-color: #f9f8f6; border: 0px; margin: 0px 0px 1em;"&gt;The full code to the page is below - the GP service URL wont work - sorry.&lt;/P&gt;
&lt;PRE class="lia-code-sample line-numbers language-none" tabindex="0"&gt;&lt;CODE&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Leaflet.draw vector editing handlers&amp;lt;/title&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/docs/examples/libs/leaflet-src.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;link rel="stylesheet" href="http://leaflet.github.io/Leaflet.draw/docs/examples/libs/leaflet.css"/&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/Leaflet.draw.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/Leaflet.Draw.Event.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;link rel="stylesheet" href="http://leaflet.github.io/Leaflet.draw/src/leaflet.draw.css"/&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/Toolbar.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/Tooltip.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/ext/GeometryUtil.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/ext/LatLngUtil.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/ext/LineUtil.Intersect.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/ext/Polygon.Intersect.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/ext/Polyline.Intersect.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/ext/TouchEvents.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/DrawToolbar.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.Feature.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.SimpleShape.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.Polyline.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.Marker.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.Circle.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.CircleMarker.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.Polygon.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/draw/handler/Draw.Rectangle.js"&amp;gt;&amp;lt;/script&amp;gt;


    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/EditToolbar.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/EditToolbar.Edit.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/EditToolbar.Delete.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/Control.Draw.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/Edit.Poly.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/Edit.SimpleShape.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/Edit.Rectangle.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/Edit.Marker.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/Edit.CircleMarker.js"&amp;gt;&amp;lt;/script&amp;gt;
    &amp;lt;script src="http://leaflet.github.io/Leaflet.draw/src/edit/handler/Edit.Circle.js"&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- Load Esri Leaflet from CDN --&amp;gt;
    &amp;lt;script src="https://unpkg.com/esri-leaflet@2.2.4/dist/esri-leaflet.js"
    integrity="sha512-tyPum7h2h36X52O2gz+Pe8z/3l+Y9S1yEUscbVs5r5aEY5dFmP1WWRY/WLLElnFHa+k1JBQZSCDGwEAnm2IxAQ=="
    crossorigin=""&amp;gt;&amp;lt;/script&amp;gt;

    &amp;lt;!-- load the latest release from the cdn automatically --&amp;gt;
    &amp;lt;script src="https://unpkg.com/esri-leaflet-gp"&amp;gt;&amp;lt;/script&amp;gt;

&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;div id="map" style="width: 800px; height: 600px; border: 1px solid #ccc"&amp;gt;&amp;lt;/div&amp;gt;

&amp;lt;script&amp;gt;
    var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
            osmAttrib = '&amp;amp;copy; &amp;lt;a href="http://openstreetmap.org/copyright"&amp;gt;OpenStreetMap&amp;lt;/a&amp;gt; contributors',
            osm = L.tileLayer(osmUrl, { maxZoom: 18, attribution: osmAttrib }),
            map = new L.Map('map', { center: new L.LatLng(51.505, -0.04), zoom: 13 }),
            drawnItems = L.featureGroup().addTo(map);
    L.control.layers({
        'osm': osm.addTo(map),
        "google": L.tileLayer('http://www.google.cn/maps/vt?lyrs=s@189&amp;amp;gl=cn&amp;amp;x={x}&amp;amp;y={y}&amp;amp;z={z}', {
            attribution: 'google'
        })
    }, { 'drawlayer': drawnItems }, { position: 'topleft', collapsed: false }).addTo(map);
    map.addControl(new L.Control.Draw({
        edit: {
            featureGroup: drawnItems,
            poly: {
                allowIntersection: false
            }
        },
        draw: {
            polygon: {
                allowIntersection: false,
                showArea: true
            }
        }
    }));

    //Define the GP service location
    var gpService = L.esri.GP.service({
    url: "http://machine:6080/arcgis/rest/services/GPServices/TestPolygonGPService/GPServer/Test%20Polygon%20GP%20Service",
    useCors:true
    });


    //Trigger when the create event is complete
    map.on(L.Draw.Event.CREATED, function (event) {
        var layer = event.layer;

        var gpTask = gpService.createTask();
        gpTask.setParam("InputPolygonSymbology_lyr", layer.toGeoJSON());
        console.log(layer.toGeoJSON());
        console.log("setParameter of event.layer successful");
        gpTask.run(polyQueryCallback);
        console.log("successfully called and returned the callback");
        drawnItems.addLayer(layer);
    });

    function polyQueryCallback(error, response, raw){
        //map.addLayer(L.geoJSON(layer));
        //console.log(Polyarea);
    }

&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Aug 2023 12:53:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/geoprocessing-in-esri-leaflet-with-a-polygon/m-p/878866#M146</guid>
      <dc:creator>SimonWebster</dc:creator>
      <dc:date>2023-08-28T12:53:51Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing in ESRI-Leaflet with a polygon returns an error 500</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/geoprocessing-in-esri-leaflet-with-a-polygon/m-p/878867#M147</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/366924"&gt;john gravois&lt;/A&gt;‌ Do you think you might be able to lend a hand, please?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 30 Jun 2019 22:15:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/geoprocessing-in-esri-leaflet-with-a-polygon/m-p/878867#M147</guid>
      <dc:creator>SimonWebster</dc:creator>
      <dc:date>2019-06-30T22:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing in ESRI-Leaflet with a polygon returns an error 500</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/geoprocessing-in-esri-leaflet-with-a-polygon/m-p/878868#M148</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As it turns out there's nothing wrong with the code - providing the geoprocessing service is Synchronous.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As soon as the geoprocessing service is set to Asynchronous this code fails with error 500, as described.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Jul 2019 07:58:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/geoprocessing-in-esri-leaflet-with-a-polygon/m-p/878868#M148</guid>
      <dc:creator>SimonWebster</dc:creator>
      <dc:date>2019-07-01T07:58:52Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing in ESRI-Leaflet with a polygon returns an error 500</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/geoprocessing-in-esri-leaflet-with-a-polygon/m-p/878869#M149</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Did you see this note in the documentation:&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;If you are working with an asynchronous service or one with a custom operation name and don't indicate corresponding information in the constructor, you'll have to leave the plugin enough time to make a roundtrip to the server to inquire before calling &lt;CODE&gt;run()&lt;/CODE&gt;.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A class="link-titled" href="https://esri.github.io/esri-leaflet/api-reference/tasks/gp.html" title="https://esri.github.io/esri-leaflet/api-reference/tasks/gp.html"&gt;L.esri.GP.Task | Esri Leaflet&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not totally sure this is your issue, but you might try following that example to see if it helps.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Jul 2019 13:14:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/geoprocessing-in-esri-leaflet-with-a-polygon/m-p/878869#M149</guid>
      <dc:creator>GavinRehkemper</dc:creator>
      <dc:date>2019-07-01T13:14:51Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing in ESRI-Leaflet with a polygon returns an error 500</title>
      <link>https://community.esri.com/t5/open-source-mapping-libraries-ques/geoprocessing-in-esri-leaflet-with-a-polygon/m-p/878870#M150</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Gavin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;That was exactly the issue. I have not tried that code snippet you linked to yet, but changing the task to synchronous showed that running an async service was the issue. I suspect I’ll have to convert back to async by the end of the exercise anyhow. Thank you very much for the link!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Jul 2019 21:23:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/open-source-mapping-libraries-ques/geoprocessing-in-esri-leaflet-with-a-polygon/m-p/878870#M150</guid>
      <dc:creator>SimonWebster</dc:creator>
      <dc:date>2019-07-01T21:23:45Z</dc:date>
    </item>
  </channel>
</rss>

