<?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 Re: Project extent driving me insane in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/project-extent-driving-me-insane/m-p/358241#M33199</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was going the same route, console.log() says it's an object. Since it's coming from JSON, I'd almost expect that it would be a string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me try manually setting the spatial reference and see if that takes care of it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Jan 2014 16:02:59 GMT</pubDate>
    <dc:creator>JimWharton</dc:creator>
    <dc:date>2014-01-10T16:02:59Z</dc:date>
    <item>
      <title>Project extent driving me insane</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/project-extent-driving-me-insane/m-p/358238#M33196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I used to have a nifty coordinate display handler that worked just fine in pre-3.0. It looked like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function updateExtentStatePlaneNevadaWest(updatedExtent) {
 geometryService.project([updatedExtent], new esri.SpatialReference({ wkid: 102709}), function(featVar) {
&amp;nbsp; newExtent = featVar[0]; 
&amp;nbsp; //after reprojected, connect to listen to mouse move and drag events
&amp;nbsp; var onMouseMoveHandler = dojo.connect(map, "onMouseMove", showCoordinates);
&amp;nbsp; var onMouseDragHandler = dojo.connect(map, "onMouseDrag", showCoordinates);
 });
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Now I am trying to catch up with the crowd and get my applications on JSAPI version 3.2. This simple extent project is causing me a major headache. Below was my first attempt, but the "outputExtent" variable just wouldn't get populated:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;function updateExtentStatePlaneNevadaWest(updatedExtent) {
 var inputExtent = new esri.geometry.Extent(updatedExtent.xmin,updatedExtent.ymin,updatedExtent.xmax,updatedExtent.ymax, new esri.SpatialReference({ wkid: 102113} ));
 var params = new esri.tasks.ProjectParameters();
 params.geometries = [inputExtent];
 params.outSR = new esri.SpatialReference({ wkid: 102709});
 geometryService.project(params, function(outputExtent) {
&amp;nbsp; newExtent = outputExtent[0]; //&amp;lt;-- comes out as undefined
&amp;nbsp; //after reprojected, connect to listen to mouse move and drag events
&amp;nbsp; var onMouseMoveHandler = dojo.connect(map, "onMouseMove", showCoordinates);
&amp;nbsp; var onMouseDragHandler = dojo.connect(map, "onMouseDrag", showCoordinates);
 });
}&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In trying to debug this thing, I have broken down the variables and put the callback into a separate function, but I still can't get it to trigger. I'll admit that I'm probably not deciphering the error message properly. I can get the error callback to trigger, but I can't see what it is telling me. Chrome just gives me this error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;GET http://services.arcgisonline.com/ArcGIS/rest/info?f=json undefined (undefined)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I know there has got to be something simple I am over-looking. Any guidance is much appreciated.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 04 Mar 2013 20:50:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/project-extent-driving-me-insane/m-p/358238#M33196</guid>
      <dc:creator>MatthewLawton</dc:creator>
      <dc:date>2013-03-04T20:50:40Z</dc:date>
    </item>
    <item>
      <title>Re: Project extent driving me insane</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/project-extent-driving-me-insane/m-p/358239#M33197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;To provide a follow-up... I think I am getting stuck in some sort of JSON formatting problem. If I define the input extent as an extent object, as I have always done, then I get an error about the "toJson" method being unavailable on undefined. So that seems to tell me that perhaps I am not providing the project function a properly formatted extent object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code below returns the error "TypeError: Object [object Object] has no method 'toJson':&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function updateExtentStatePlaneNevadaWest(updatedExtent) {
 var inputExtent = new esri.geometry.Extent([updatedExtent], new esri.SpatialReference({ wkid: 102113} ));
 gsvc.project([inputExtent], [{"wkid":102709}], function(geometries) {
&amp;nbsp; newExtent = geometries[0]; //&amp;lt;-- comes out as undefined
&amp;nbsp; //after reprojected, connect to listen to mouse move and drag events
&amp;nbsp; var onMouseMoveHandler = dojo.connect(map, "onMouseMove", showCoordinates);
&amp;nbsp; var onMouseDragHandler = dojo.connect(map, "onMouseDrag", showCoordinates);
 }, onError);
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I modify the input projection to conform to the JSON format as below, then I get the same error:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function updateExtentStatePlaneNevadaWest(updatedExtent) {
 var inputExtent = new esri.geometry.Extent({"xmin":updatedExtent.xmin,"ymin":updatedExtent.ymin,"xmax":updatedExtent.xmax,"ymax":updatedExtent.ymax, "spatialReference":{"wkid":102113}});
 gsvc.project([inputExtent], [{"wkid":102709}], function(geometries) {
&amp;nbsp; newExtent = geometries[0]; //&amp;lt;-- comes out as undefined
&amp;nbsp; //after reprojected, connect to listen to mouse move and drag events
&amp;nbsp; var onMouseMoveHandler = dojo.connect(map, "onMouseMove", showCoordinates);
&amp;nbsp; var onMouseDragHandler = dojo.connect(map, "onMouseDrag", showCoordinates);
 }, onError);
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If I change the spatial reference output to follow the example in the API reference, then I get the error "Error: JSON syntax error":&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function updateExtentStatePlaneNevadaWest(updatedExtent) {
 var inputExtent = new esri.geometry.Extent([updatedExtent], new esri.SpatialReference({ wkid: 102113} ));
 var outSR = new esri.SpatialReference({wkid: 102709});
 gsvc.project(inputExtent, outSR, function(geometries) {
&amp;nbsp; newExtent = geometries[0]; //&amp;lt;-- comes out as undefined
&amp;nbsp; //after reprojected, connect to listen to mouse move and drag events
&amp;nbsp; var onMouseMoveHandler = dojo.connect(map, "onMouseMove", showCoordinates);
&amp;nbsp; var onMouseDragHandler = dojo.connect(map, "onMouseDrag", showCoordinates);
 }, onError);
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Very frustrating. I hope somebody can provide me with the magic combination.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 16:44:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/project-extent-driving-me-insane/m-p/358239#M33197</guid>
      <dc:creator>MatthewLawton</dc:creator>
      <dc:date>2021-12-11T16:44:53Z</dc:date>
    </item>
    <item>
      <title>Re: Project extent driving me insane</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/project-extent-driving-me-insane/m-p/358240#M33198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;in case you didn't solve this, or for the next person to come across this thread:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;replace &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var outSR = new esri.SpatialReference({wkid: 102709});&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;with&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;var outSR = new esri.SpatialReference(102709);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;works for me, and I solved another issue I was having by looking at your posted code.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Oct 2013 20:46:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/project-extent-driving-me-insane/m-p/358240#M33198</guid>
      <dc:creator>HeathClark</dc:creator>
      <dc:date>2013-10-17T20:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Project extent driving me insane</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/project-extent-driving-me-insane/m-p/358241#M33199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I was going the same route, console.log() says it's an object. Since it's coming from JSON, I'd almost expect that it would be a string.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Let me try manually setting the spatial reference and see if that takes care of it.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Jan 2014 16:02:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/project-extent-driving-me-insane/m-p/358241#M33199</guid>
      <dc:creator>JimWharton</dc:creator>
      <dc:date>2014-01-10T16:02:59Z</dc:date>
    </item>
    <item>
      <title>Re: Project extent driving me insane</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/project-extent-driving-me-insane/m-p/358242#M33200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This helped me 3+ years later. Thanks for posting.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 17 Feb 2017 05:01:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/project-extent-driving-me-insane/m-p/358242#M33200</guid>
      <dc:creator>DavidPuckett</dc:creator>
      <dc:date>2017-02-17T05:01:11Z</dc:date>
    </item>
  </channel>
</rss>

