<?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: Why is Geometry Server Project failing with toJson is not a function? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-geometry-server-project-failing-with-tojson/m-p/355599#M32937</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome, thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the updated code for the Main Body of the function for completeness sake:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var newPin = new Point(lonX, latY, new SpatialReference(4236));&lt;BR /&gt;var symbol = this.defaultSymbol;&lt;BR /&gt;console.log(newPin);&lt;BR /&gt;var geoService = new GeometryService(this.geometryService);&lt;BR /&gt;var outSpatialReference = new SpatialReference(this.map.spatialReference);&lt;BR /&gt;var coordParams = new ProjectParameters();&lt;BR /&gt;coordParams.inSR = newPin.spatialReference;&lt;BR /&gt;coordParams.outSR = outSpatialReference;&lt;BR /&gt;coordParams.geometries = [newPin];&lt;BR /&gt;geoService.project(coordParams,lang.hitch(this, function(result){&lt;/P&gt;&lt;P&gt;&amp;nbsp; var pnt = new Point(result[0]);&lt;/P&gt;&lt;P&gt;&amp;nbsp; var graphic = new Graphic(pnt);&lt;BR /&gt;&amp;nbsp; graphic.setSymbol(symbol);&lt;BR /&gt;&amp;nbsp; this.map.graphics.add(graphic);&lt;BR /&gt;&amp;nbsp; var newMapExtent&lt;BR /&gt;&amp;nbsp; var zoomBuffer = 750&lt;BR /&gt;&amp;nbsp; newMapExtent = new Extent(pnt.x-zoomBuffer,pnt.y-zoomBuffer,pnt.x+zoomBuffer,pnt.y+zoomBuffer,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pnt.spatialReference)&lt;BR /&gt;&amp;nbsp; this.map.setExtent(newMapExtent);&lt;BR /&gt;}))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will mark this as answered, I appreciate your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 04 Feb 2020 05:24:22 GMT</pubDate>
    <dc:creator>CodyMcDonald</dc:creator>
    <dc:date>2020-02-04T05:24:22Z</dc:date>
    <item>
      <title>Why is Geometry Server Project failing with toJson is not a function?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-geometry-server-project-failing-with-tojson/m-p/355595#M32933</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've inherited a mapviewer which provides a function that accepts latitude and longitude values, and should then move to that point on the map and place a pin. However, the input x and y come from Google Maps wkid 4326 and I need to convert them to wkid 2357. The function formerly relied on projectionPromise which was throwing web assembly errors in both IE and Chrome. I tried coding around this to use the Geometry Server Project function. Now I receive Uncaught TypeError: a.toJson is not a function.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can somebody save me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dropPin: function(e){&lt;BR /&gt; var latY = ""&lt;BR /&gt; var lonX = ""&lt;BR /&gt; var alertMessage = "Both Latttitude and Longitude must be entered"&lt;BR /&gt; if(!this.labelLayer){&lt;BR /&gt; this.labelLayer = new GraphicsLayer({id: "labelLayer"})&lt;BR /&gt; }&lt;BR /&gt; if(!this.resultsLayer){&lt;BR /&gt; this.resultsLayer = new GraphicsLayer({id: "resultsLayer"})&lt;BR /&gt; }&lt;BR /&gt; if(e.srcElement.dataset.dojoAttachPoint == "DropPinBtn"){&lt;BR /&gt; if(this.LatTxt.value == "" || this.LongTxt.value == ""){&lt;BR /&gt; alert(alertMessage)&lt;BR /&gt; return&lt;BR /&gt; } else {&lt;BR /&gt; lonX = this.LongTxt.value&lt;BR /&gt; latY = this.LatTxt.value&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;if(parseFloat(latY) &amp;amp;&amp;amp; parseFloat(lonX)){&lt;BR /&gt; latY = parseFloat(latY)&lt;BR /&gt; lonX = parseFloat(lonX)&lt;BR /&gt; if(latY&amp;gt;-90 &amp;amp;&amp;amp; latY&amp;lt;90){&lt;BR /&gt; if(lonX&amp;gt;-180 &amp;amp;&amp;amp; lonX&amp;lt;180){&lt;BR /&gt; //Main Body&lt;BR /&gt; //Create new graphic and symbolize&lt;BR /&gt; var newPin = {"geometry":{"x":lonX,"y":latY, "spatialReference":{"wkid":4326}} }&lt;BR /&gt; //var rePin = Projection.project(newPin, this.map.spatialReference)&lt;BR /&gt; var symbol = this.defaultSymbol;&lt;BR /&gt; var graphic = new Graphic(newPin);&lt;BR /&gt; graphic.setSymbol(symbol);&lt;BR /&gt; console.log(graphic);&lt;BR /&gt; var featureSet = jimuUtils.toFeatureSet(graphic);&lt;BR /&gt; jimuUtils.zoomToFeatureSet(this.map, featureSet);&lt;/P&gt;&lt;P&gt;//the above successfully re-centers the map, but does not draw the graphic&lt;BR /&gt; var geoService = new GeometryService(this.geometryService);&lt;BR /&gt; var outSpatialReference = new SpatialReference(this.map.spatialReference);&lt;BR /&gt; var coordParams = new ProjectParameters();&lt;BR /&gt; coordParams.inSR = newPin.geometry.spatialReference;&lt;BR /&gt; coordParams.outSR = outSpatialReference;&lt;BR /&gt; coordParams.geometries = [newPin.geometry.x, newPin.geometry.y];&lt;BR /&gt; console.log(coordParams);&lt;BR /&gt; var newCoords = geoService.project(coordParams);&lt;BR /&gt; //function fails at the above line of code&lt;BR /&gt; this.resultsLayer.add(graphic);&lt;BR /&gt; //this.map.graphics.add(graphic); &lt;BR /&gt; } else{&lt;BR /&gt; alert("Longitude is not within accpetable range of values")&lt;BR /&gt; }&lt;BR /&gt; } else{&lt;BR /&gt; alert("Lattitude is not within accpetable range of values")&lt;BR /&gt; }&lt;BR /&gt; } else {&lt;BR /&gt; alert("Either lattitude or logitude is not a valid number")&lt;BR /&gt; } &lt;BR /&gt; }&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Feb 2020 05:35:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-geometry-server-project-failing-with-tojson/m-p/355595#M32933</guid>
      <dc:creator>CodyMcDonald</dc:creator>
      <dc:date>2020-02-03T05:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: Why is Geometry Server Project failing with toJson is not a function?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-geometry-server-project-failing-with-tojson/m-p/355596#M32934</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;coordParams.geometries = [newPin.geometry.x, newPin.geometry.y];&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Looks like&amp;nbsp;&lt;SPAN&gt;[newPin.geometry.x, newPin.geometry.y] is a coordinates array other than a geometry array.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;try this:&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;coordParams.geometries = [newPin.geometry];&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 00:46:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-geometry-server-project-failing-with-tojson/m-p/355596#M32934</guid>
      <dc:creator>LeoLiu1</dc:creator>
      <dc:date>2020-02-04T00:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why is Geometry Server Project failing with toJson is not a function?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-geometry-server-project-failing-with-tojson/m-p/355597#M32935</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the feedback.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just tested using your suggestion and&amp;nbsp;coordParams.geometries takes the x and y values along with the spatialReference of newPin. However, the same error is thrown.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 01:39:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-geometry-server-project-failing-with-tojson/m-p/355597#M32935</guid>
      <dc:creator>CodyMcDonald</dc:creator>
      <dc:date>2020-02-04T01:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: Why is Geometry Server Project failing with toJson is not a function?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-geometry-server-project-failing-with-tojson/m-p/355598#M32936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Please try this:&lt;/P&gt;&lt;P&gt;reference esri/geometry/Point module, and change&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;var newPin = {"geometry":{"x":lonX,"y":latY, "spatialReference":{"wkid":4326}} }&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;to&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;var newPin = new Point(lonX, latY, new SpatialReference(4326));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;I am guessing your newPin is an object other than a Point object, therefore&amp;nbsp;doesn't have the 'toJson' method.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 02:13:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-geometry-server-project-failing-with-tojson/m-p/355598#M32936</guid>
      <dc:creator>LeoLiu1</dc:creator>
      <dc:date>2020-02-04T02:13:23Z</dc:date>
    </item>
    <item>
      <title>Re: Why is Geometry Server Project failing with toJson is not a function?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-geometry-server-project-failing-with-tojson/m-p/355599#M32937</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Awesome, thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the updated code for the Main Body of the function for completeness sake:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var newPin = new Point(lonX, latY, new SpatialReference(4236));&lt;BR /&gt;var symbol = this.defaultSymbol;&lt;BR /&gt;console.log(newPin);&lt;BR /&gt;var geoService = new GeometryService(this.geometryService);&lt;BR /&gt;var outSpatialReference = new SpatialReference(this.map.spatialReference);&lt;BR /&gt;var coordParams = new ProjectParameters();&lt;BR /&gt;coordParams.inSR = newPin.spatialReference;&lt;BR /&gt;coordParams.outSR = outSpatialReference;&lt;BR /&gt;coordParams.geometries = [newPin];&lt;BR /&gt;geoService.project(coordParams,lang.hitch(this, function(result){&lt;/P&gt;&lt;P&gt;&amp;nbsp; var pnt = new Point(result[0]);&lt;/P&gt;&lt;P&gt;&amp;nbsp; var graphic = new Graphic(pnt);&lt;BR /&gt;&amp;nbsp; graphic.setSymbol(symbol);&lt;BR /&gt;&amp;nbsp; this.map.graphics.add(graphic);&lt;BR /&gt;&amp;nbsp; var newMapExtent&lt;BR /&gt;&amp;nbsp; var zoomBuffer = 750&lt;BR /&gt;&amp;nbsp; newMapExtent = new Extent(pnt.x-zoomBuffer,pnt.y-zoomBuffer,pnt.x+zoomBuffer,pnt.y+zoomBuffer,&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;pnt.spatialReference)&lt;BR /&gt;&amp;nbsp; this.map.setExtent(newMapExtent);&lt;BR /&gt;}))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will mark this as answered, I appreciate your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 04 Feb 2020 05:24:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/why-is-geometry-server-project-failing-with-tojson/m-p/355599#M32937</guid>
      <dc:creator>CodyMcDonald</dc:creator>
      <dc:date>2020-02-04T05:24:22Z</dc:date>
    </item>
  </channel>
</rss>

