Create Buffer at Submit using Quick Report Template

1406
10
Jump to solution
09-17-2018 04:30 AM
KrishV
by
Frequent Contributor

Hi All,

I want to create a buffer in Polygon Feature Service when I capture Point Feature using Quick Report Template. How to achieve this.

Appreciate your suggestions.

Thanks,

Krish

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

Hi Krish

console.log(JSON.stringify((newPolygon1)))

in your example code above, if "newPolygon1" is a geometry object, then I think trying to stringify it will crash the programme. You would need to stringify the json property, e.g.

console.log(JSON.stringify( newPolygon1.json ) )

Geometry QML Type | ArcGIS for Developers 

cheers,

-Paul

View solution in original post

10 Replies
ErwinSoekianto
Esri Alum

Krish, 

If I understand this correctly, you should be able to make additional network request call to "create a buffer in polygon feature service" when you click submit, as we are sending a network request to add new point for the new report that has just been submitted. 

Thank you,

Erwin. 

KrishV
by
Frequent Contributor

Hi Erwin Soekianto‌,

Thanks for your response. 

Yes, you are right. I want to make additional network request. Please help me how to do this. I'm trying to generate Buffer geometry using Geometry Engine but it always shows null.

I have imported ArcGISRuntime in FeatureServiceManager.qml  and added below code in applyEdits function:

 function applyEdits(attributes, callback){
        console.log("token when edits", token)
        console.log(JSON.stringify(attributes[0].geometry))
        var obj = {"adds": JSON.stringify(attributes),
            "f": "json"};
        var newPolygon = GeometryEngine.buffer(attributes[0].geometry, 5)
        console.log(JSON.stringify((newPolygon)))
        console.log(newPolygon)

But I'm getting below null values after newPolygon as shown below

Please let me know how to create buffer and send a new network Request for creating buffered polygon. Appreciate your support.

Thanks,

Krish

0 Kudos
ErwinSoekianto
Esri Alum

Krish, 

That should work, it is weird. 

I have a feeling that `attributes[0].geometry` is not a Runtime Geometry (Point in this case) object as it is what the GeometryEngine.buffer expects as the first parameter since we are sending a REST call to feature layer to add the point for QuickReport, not using Runtime. 

As for sending new network Request for your polygon, you can copy and follow the current function you are at, to add new feature using ApplyEdits operation if it is going to the same feature layer. 

Thank you,

Erwin. 

0 Kudos
KrishV
by
Frequent Contributor

Hi Erwin,

Can you point me to any sample for creating buffer using GeometryEngine & network Request.

Thank you,

Krish

0 Kudos
KrishV
by
Frequent Contributor

Hi Erwin,

I have also tried below code in ApplyEdits function

var currentPositionForBuffer = app.theNewPoint
        var newPolygon1 = GeometryEngine.buffer(currentPositionForBuffer, 5.0)
                console.log(JSON.stringify((newPolygon1)))
                console.log(newPolygon1)

but the app is getting closed with below message.

Please suggest how to proceed.

Thank you,

Krish

0 Kudos
by Anonymous User
Not applicable

Hi Krish

console.log(JSON.stringify((newPolygon1)))

in your example code above, if "newPolygon1" is a geometry object, then I think trying to stringify it will crash the programme. You would need to stringify the json property, e.g.

console.log(JSON.stringify( newPolygon1.json ) )

Geometry QML Type | ArcGIS for Developers 

cheers,

-Paul

KrishV
by
Frequent Contributor

Hi Paul Haakma‌,

Thanks for your response. Yes when I use console.log(JSON.stringify( newPolygon1.json ) ), I'm able to see the result. Now, I want to add this geometry in my Polygon Feature Service using Network Reqeust.

Can you tell me how to achieve this?

Thank you,

Krish

0 Kudos
ErwinSoekianto
Esri Alum

Krish, 

It sounds like this requires more troubleshooting, you can try calling Esri Tech Support, and show why GeometryEngine.buffer()is not returning you a Polygon object back in Runtime SDK for Qt. 

Thank you,

Erwin

0 Kudos
KrishV
by
Frequent Contributor

Hi Erwin,

Thanks for your response. I have generated the polygon in SubmitReport function and created one more applyEdits functions to add this polygon through network request and Now I'm able to submit both point and polygon on Submit.

Thank you,

Krish

0 Kudos