What is parish.geometry.rings? Is that a single ring or an array of rings? I don't think addRing() can handle an array of rings...
parish={"geometry":{ "rings":[[ [-93.342379335, 33.0183192760001], [-93.2386607509999, 33.0175064210001], [-93.2377443679999, 32.715973435], [-93.186697908, 32.716227121], [-93.186091692, 32.6729424970001], [-93.1777359559999, 32.6722301020001], [-93.182898703, 32.6657050920001], [-93.1777075959999, 32.6648898650001] ]] }};
var polygonJson = { "rings": parish.geometry.rings, "spatialReference": { "wkid": 4269} }; var polygon = new esri.geometry.Polygon(polygonJson);
Also, are you using a proxy page? If you're sending a geometry that is more than a few points you'll want to have a proxy page configured.
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/ags_proxy.htm
function init() { //identify proxy page to use if the toJson payload to the geometry service is greater than 2000 characters. //If this null or not available the project and lengths operation will not work. Otherwise it will do a http post to the proxy. esriConfig.defaults.io.proxyUrl = "/arcgisserver/apis/javascript/proxy/proxy.ashx"; esriConfig.defaults.io.alwaysUseProxy = false; //create map map = new esri.Map("mapDiv", { slider: false }); dojo.connect(map, "onLoad", initFunctionality); //create and add new layer var layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://maps.lsuagcenter.com/ArcGIS/rest/services/LAFloods/LAFloodMaps/MapServer"); map.addLayer(layer); } function initFunctionality(){ //code to add graphics - I have not included here showpopUp(obj); } function showpopUp(obj){ var obj; var parishFIPS = obj.value; var graphic; var graphics = map.graphics.graphics; for (var i = 0; i < graphics.length; i++) { if (parishFIPS == graphics.attributes.FIPS) { graphic = graphics; break; } } var geometryService = new esri.tasks.GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); var geometry = graphic.geometry; // geometry.setSpatialReference(new esri.SpatialReference({"wkid":4269})); try { geometryService.labelPoints([geometry], function(labelPoints) { dojo.forEach(labelPoints, function(labelPoint) { var x; }); }); } catch (Error) { alert(Error); } }
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.0/js/dojo/dijit/themes/tundra/tundra.css"> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.0" ></script>
Note: "esri.config" is a replacement to "esriConfig" as of version 1.3. If you are using version 1.2 or lower, you should refer to Default API configurations for v1.2 and lower. For version 1.3 or higher, you use "esri.config" in place of "esriConfig". Although "esriConfig" will continue to work with version 1.3, you should update your applications to use "esri.config" instead.
http://localhost/proxy.ashx?http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer/labelPoints