$.each(results.features, function (_key, _val) {{ var generalizeParams = esri.tasks.GeneralizeParameters(); generalizeParams.geometries = [_val.geometry]; generalizeParams.maxDeviation = 0.05; getGeomService().generalize(generalizeParams, function (geometries) { _val.geometry = geometries; }, function (err) { }); }
I am running a query that results into a set of very complex geometries. I am trying to use the generalize tool from geometryservice
https://developers.arcgis.com/javascript/jsapi/geometryservice-amd.html#generalize to generalize each of the geometries.
Here is my partial code:
$.each(results.features, function (_key, _val) {{ var generalizeParams = esri.tasks.GeneralizeParameters(); generalizeParams.geometries = [_val.geometry]; generalizeParams.maxDeviation = 0.05; getGeomService().generalize(generalizeParams, function (geometries) { _val.geometry = geometries; }, function (err) { }); }
getGeomService() basically goes and gets the geometry service: return esri.config.defaults.geometryService;
When I run this, my FireBug goes to the error function and says:
SyntaxError: syntax error
The resource from this URL is not text: https://js.arcgis.com/3.8/
Any idea what I am doing wrong?
Could you paste your full code or provide a JSFiddle so we can better understand what's happenin
Sorry, but it is huge app with more than 6000 lines of code. No way I can paste the full code. But the one I provided is the only "new code" I added. Rest has been tested and has been working fine.
Do you think I have a syntax error causing it?
I don't think so. I think that this is a issue with a resource content type. Which browser and version are you using?
IE10, FF & Chrome latest.
Could you double check if your web server is returning the correct mime types for the resources (.js and .css) requested by your app?
This thread explains what I suspect.
<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/3.8/js/dojo/dijit/themes/claro/claro.css">
<script type="text/javascript" src="https://js.arcgis.com/3.8/"></script>
<meta http-equiv="X-UA-Compatible" content="IE=10; IE=9; IE=8; IE=7; IE=EDGE" /> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="viewport" content="width=device-width, initial-scale=1.02, maximum-scale=1.0, user-scalable = no">
Could you double check if your web server is returning the correct mime types for the resources (.js and .css) requested by your app?
This thread explains what I suspect.