<?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 Problem centering to a polygon. Javascript api in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-centering-to-a-polygon-javascript-api/m-p/306034#M28076</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I am pulling parcels, running a query, and trying to center the map to the parcels from the query.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting this error:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="plain" name="code"&gt;Map: Geometry (wkid: 26912) cannot be converted to spatial reference of the map (wkid: 102100)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The coordinates I get from the query are ridiculous, an example is [&lt;SPAN class="objectBox-number objectBox"&gt;4109465.94230973, &lt;SPAN class="objectBox-number objectBox"&gt;270652.7635476563]. They display fine when I enable the layer, though. It is only when I do a query that things get weird.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this is all of my code dealing with the parcels&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="javascript" name="code"&gt;$(document).on('click', '#parcel_submit', function(){ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; parcelId = $('#parcel_input').val(); //get the parcel to search for from the text box &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; queryTask = new esri.tasks.QueryTask("https://mapserv.utah.gov/arcgis/rest/services/Parcels/MapServer/27"); &amp;nbsp;&amp;nbsp;&amp;nbsp; //initialize query &amp;nbsp;&amp;nbsp;&amp;nbsp; query = new esri.tasks.Query(); &amp;nbsp;&amp;nbsp;&amp;nbsp; query.returnGeometry = true; &amp;nbsp;&amp;nbsp;&amp;nbsp; query.outFields = ["OBJECTID", "PARCEL_ID"]; &amp;nbsp;&amp;nbsp;&amp;nbsp; query.where = "PARCEL_ID = '" + parcelId + "';"; //only look for the desired parcel &amp;nbsp;&amp;nbsp;&amp;nbsp; queryTask.execute(query,showResults); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }); function showResults(featureSet){ &amp;nbsp;&amp;nbsp;&amp;nbsp; var features = featureSet.features; //all of the parcels matching the search. There should only be one &amp;nbsp;&amp;nbsp;&amp;nbsp; var parcel = features[0]; //get the first parcel &amp;nbsp;&amp;nbsp;&amp;nbsp; var geometry = parcel.geometry.getCentroid(); //get the center of the parcel &amp;nbsp;&amp;nbsp;&amp;nbsp; var point = esri.geometry.Point(geometry.y, geometry.x) //create a point &amp;nbsp;&amp;nbsp;&amp;nbsp; map.centerAndZoom(geometry, 16); //it is centering at some crazy coordinates in the hundreds of thousands.&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(features, parcel, geometry, point); }; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bit of honesty, I hardly know the basics since this project was assigned out of nowhere &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; I apologize if this question is dumb&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 21 Jul 2014 18:40:59 GMT</pubDate>
    <dc:creator>alexlambson</dc:creator>
    <dc:date>2014-07-21T18:40:59Z</dc:date>
    <item>
      <title>Problem centering to a polygon. Javascript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-centering-to-a-polygon-javascript-api/m-p/306034#M28076</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;So I am pulling parcels, running a query, and trying to center the map to the parcels from the query.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting this error:&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="plain" name="code"&gt;Map: Geometry (wkid: 26912) cannot be converted to spatial reference of the map (wkid: 102100)&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The coordinates I get from the query are ridiculous, an example is [&lt;SPAN class="objectBox-number objectBox"&gt;4109465.94230973, &lt;SPAN class="objectBox-number objectBox"&gt;270652.7635476563]. They display fine when I enable the layer, though. It is only when I do a query that things get weird.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and this is all of my code dealing with the parcels&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class="javascript" name="code"&gt;$(document).on('click', '#parcel_submit', function(){ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; parcelId = $('#parcel_input').val(); //get the parcel to search for from the text box &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; queryTask = new esri.tasks.QueryTask("https://mapserv.utah.gov/arcgis/rest/services/Parcels/MapServer/27"); &amp;nbsp;&amp;nbsp;&amp;nbsp; //initialize query &amp;nbsp;&amp;nbsp;&amp;nbsp; query = new esri.tasks.Query(); &amp;nbsp;&amp;nbsp;&amp;nbsp; query.returnGeometry = true; &amp;nbsp;&amp;nbsp;&amp;nbsp; query.outFields = ["OBJECTID", "PARCEL_ID"]; &amp;nbsp;&amp;nbsp;&amp;nbsp; query.where = "PARCEL_ID = '" + parcelId + "';"; //only look for the desired parcel &amp;nbsp;&amp;nbsp;&amp;nbsp; queryTask.execute(query,showResults); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }); function showResults(featureSet){ &amp;nbsp;&amp;nbsp;&amp;nbsp; var features = featureSet.features; //all of the parcels matching the search. There should only be one &amp;nbsp;&amp;nbsp;&amp;nbsp; var parcel = features[0]; //get the first parcel &amp;nbsp;&amp;nbsp;&amp;nbsp; var geometry = parcel.geometry.getCentroid(); //get the center of the parcel &amp;nbsp;&amp;nbsp;&amp;nbsp; var point = esri.geometry.Point(geometry.y, geometry.x) //create a point &amp;nbsp;&amp;nbsp;&amp;nbsp; map.centerAndZoom(geometry, 16); //it is centering at some crazy coordinates in the hundreds of thousands.&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; console.log(features, parcel, geometry, point); }; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bit of honesty, I hardly know the basics since this project was assigned out of nowhere &lt;span class="lia-unicode-emoji" title=":confused_face:"&gt;😕&lt;/span&gt; I apologize if this question is dumb&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 18:40:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-centering-to-a-polygon-javascript-api/m-p/306034#M28076</guid>
      <dc:creator>alexlambson</dc:creator>
      <dc:date>2014-07-21T18:40:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problem centering to a polygon. Javascript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-centering-to-a-polygon-javascript-api/m-p/306035#M28077</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alex,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try specifying the outSpatialReference property for the Query class to be the same as the map's spatial reference.&amp;nbsp; Ex:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code jive_text_macro _jivemacro_uid_14059691011858246" jivemacro_uid="_14059691011858246"&gt;
&lt;P&gt;query.outSpatialReference = map.spatialReference;&lt;/P&gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 18:58:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-centering-to-a-polygon-javascript-api/m-p/306035#M28077</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2014-07-21T18:58:26Z</dc:date>
    </item>
    <item>
      <title>Re: Problem centering to a polygon. Javascript api</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-centering-to-a-polygon-javascript-api/m-p/306036#M28078</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks to people like you, I am slowly learning this api.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 21 Jul 2014 19:40:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/problem-centering-to-a-polygon-javascript-api/m-p/306036#M28078</guid>
      <dc:creator>alexlambson</dc:creator>
      <dc:date>2014-07-21T19:40:47Z</dc:date>
    </item>
  </channel>
</rss>

