Hi,
My application has a function that performs a query based in the current map.graphcis. If there are more than 1 graphic I perform a union, and here the problem starts.
This works well most of the times, but depending in the number/type of geometries to be "unified", sometimes the union throws two types of errors:The first one the error returned is "Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property.
- One that I handle using the errback function
- One that returns a 500 Internal Serve error code
Parameter name: input". This error occurs when I send more than 100 geometries. Does anyone have any idea how to get around this?
The second one doesn't give out a specific error... I noticed that it happens when I send big geometries. I'll try to see the server logs and try to find some clues.
Can anyone give me a help/hint?
Thanks
Have you tried a proxy page?
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/ags_proxy.htm
Just did a further research and found you may experiencing the known bug with the javascriptserializer::MaxJsonLength property.
[#NIM066822 MaxJsonLength exceeded error message is returned when an input geometry to an SOE contains a large number of vertices ]
I checked the bug status, it is fixed in version 10 SP3. Have you installed SP3?
<system.web.extensions> <scripting> <webServices> <jsonSerialization maxJsonLength="50000000"> </jsonSerialization> </webServices> </scripting> </system.web.extensions>
I've set up a simple example to show you what's happening.
Here, http://193.136.119.25/tests/test_union.html, you'll find a map with only one layer.
When you click on the buttons, a query will be performed, the results will be added to the map and then I try to perform the union based in the graphics of the map. The only difference is that one works and the other doesn't. Use the console to see what's happening.
You can also switch between ESRI and local geometry services... the results will be the same.
Is it a problem with the geometries? Is it something I can configure in the server? Is it just a limitation of the geometry service?
var generalizeParams = new esri.tasks.GeneralizeParameters(); generalizeParams.geometries =esri.getGeometries(map.graphics.graphics); geometryServiceLocal.generalize(generalizeParams, function(geometries){ geometryServiceLocal.union(esri.getGeometries(map.graphics.graphics), function(geometry){ ...... }); });
The problem usually has something to do with the length of the polyon JSON string. One solution you could try is to generalize the polygons prior to union to reduce the length of the JSON string. something this this:var generalizeParams = new esri.tasks.GeneralizeParameters(); generalizeParams.geometries =esri.getGeometries(map.graphics.graphics); geometryServiceLocal.generalize(generalizeParams, function(geometries){ geometryServiceLocal.union(esri.getGeometries(map.graphics.graphics), function(geometry){ ...... }); });