<?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: QueryTask result returns incorrect geometry in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611827#M57222</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As I've been pretty sure that my problems lie with some spatial reference / projection problems, I've been experimenting with different spatial references, but they've all been either 3857 or 102100 (web mercator).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I published my map document, I made sure the data frame and all data layers had the same projection (WGS 1984 Web Mercator - Auxiliary Sphere or just the WGS 1984 Web Mercator.&amp;nbsp; Sometimes though results may have ended up as 4326 spatial reference, but I don't know how....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So are saying if I load a layer _without_ a spatial reference first then that would overwrite the hard-coded spatial reference of my map when I set the extent?&amp;nbsp; I think I loaded the basemap first (using map.addLayer), but I may have loaded a generic graphics layer without a spatial reference second....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Jay what's the spatialReference of map? you have set in query map.spatialReference but the map.spatialReference&amp;nbsp; can be &amp;lt;&amp;gt; from spatialReference of your service if you have load in map how first layer (service) another service with spatial reference &amp;lt;&amp;gt; your service.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Apr 2012 14:35:52 GMT</pubDate>
    <dc:creator>JayGregory</dc:creator>
    <dc:date>2012-04-17T14:35:52Z</dc:date>
    <item>
      <title>QueryTask result returns incorrect geometry</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611823#M57218</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm having this really strange problem with some queries and have tried everything.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;First, I construct a query to retrieve the District of Columbia boundary:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryTask = new esri.tasks.QueryTask(districtURL);
&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.returnGeometry = true;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outFields = ["*"];
&amp;nbsp; query.where = "CITY_NAME = 'Washington'"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outSpatialReference = map.spatialReference;
&amp;nbsp; queryTask.execute(query);
&amp;nbsp; dojo.connect(queryTask, "onComplete", queryResults);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;The districtURL variable points to a ArcGIS for Server 10 map server layer, which when displayed on a base map is correctly positioned on the District of Columbia.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;HOWEVER, while the queryTask returns one result (as it should - DC boundary), the geometry of that result is located as if it has no associated projection, off the coast of Africa near Nigeria and Cameroon (I zoom to the results in the following code).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;function queryResults(featureSet){
 console.log(featureSet.features.length);
 map.setExtent(featureSet.features[0].geometry);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm tearing my hair out here - the spatial reference of the layers and map service are all 3857.&amp;nbsp; Why won't the service return the correct geometry?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks, Jay&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2012 02:02:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611823#M57218</guid>
      <dc:creator>JayGregory</dc:creator>
      <dc:date>2012-04-17T02:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: QueryTask result returns incorrect geometry</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611824#M57219</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Is the districtURL site public-facing? If not, can you show us the results of featureSet.features[0].geometry?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Steve&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2012 03:05:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611824#M57219</guid>
      <dc:creator>StephenLead</dc:creator>
      <dc:date>2012-04-17T03:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: QueryTask result returns incorrect geometry</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611825#M57220</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It is public facing: &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://129.2.24.163/ArcGIS/rest/services/Capstone_Projects/JayGregoryStatic/MapServer/7"&gt;http://129.2.24.163/ArcGIS/rest/services/Capstone_Projects/JayGregoryStatic/MapServer/7&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;My code is at home, so can't get the results until this evening, but maybe the map server will help...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Jay&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2012 13:45:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611825#M57220</guid>
      <dc:creator>JayGregory</dc:creator>
      <dc:date>2012-04-17T13:45:45Z</dc:date>
    </item>
    <item>
      <title>Re: QueryTask result returns incorrect geometry</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611826#M57221</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Jay what's the spatialReference of map? you have set in query map.spatialReference but the map.spatialReference&amp;nbsp; can be &amp;lt;&amp;gt; from spatialReference of your service if you have load in map how first layer (service) another service with spatial reference &amp;lt;&amp;gt; your service.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2012 13:52:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611826#M57221</guid>
      <dc:creator>nicogis</dc:creator>
      <dc:date>2012-04-17T13:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: QueryTask result returns incorrect geometry</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611827#M57222</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;As I've been pretty sure that my problems lie with some spatial reference / projection problems, I've been experimenting with different spatial references, but they've all been either 3857 or 102100 (web mercator).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;When I published my map document, I made sure the data frame and all data layers had the same projection (WGS 1984 Web Mercator - Auxiliary Sphere or just the WGS 1984 Web Mercator.&amp;nbsp; Sometimes though results may have ended up as 4326 spatial reference, but I don't know how....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So are saying if I load a layer _without_ a spatial reference first then that would overwrite the hard-coded spatial reference of my map when I set the extent?&amp;nbsp; I think I loaded the basemap first (using map.addLayer), but I may have loaded a generic graphics layer without a spatial reference second....&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Jay what's the spatialReference of map? you have set in query map.spatialReference but the map.spatialReference&amp;nbsp; can be &amp;lt;&amp;gt; from spatialReference of your service if you have load in map how first layer (service) another service with spatial reference &amp;lt;&amp;gt; your service.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Apr 2012 14:35:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611827#M57222</guid>
      <dc:creator>JayGregory</dc:creator>
      <dc:date>2012-04-17T14:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: QueryTask result returns incorrect geometry</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611828#M57223</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;So I've checked the spatial reference of the queryTask (the one I set equal to map.spatialReference) - it's 102100.&amp;nbsp; And then, as soon as the query runs, I check the spatial reference of the feature set it returns, using the following code: &lt;/SPAN&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function queryResults(featureSet){
 console.log(esri.geometry.webMercatorToGeographic(featureSet.features[0].geometry));
 console.log(featureSet.features[0].geometry);&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;The first console log has a spatial reference of 4236, and the second has one of 3857.&amp;nbsp; Yet still the geometry when I use either one (webMercatorToGeographic or original featureSet returned) is wrong, and pans to a location as if it has no projection at all.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for your assistance....&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Jay&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Jay what's the spatialReference of map? you have set in query map.spatialReference but the map.spatialReference&amp;nbsp; can be &amp;lt;&amp;gt; from spatialReference of your service if you have load in map how first layer (service) another service with spatial reference &amp;lt;&amp;gt; your service.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:10:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611828#M57223</guid>
      <dc:creator>JayGregory</dc:creator>
      <dc:date>2021-12-12T02:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: QueryTask result returns incorrect geometry</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611829#M57224</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;Even I am facing the same issue, what Jay has faced.&lt;/P&gt;&lt;P&gt;1. Task : Migrating of Arcgis server from 10.0 to 10.2.1&lt;/P&gt;&lt;P&gt;2. Development : Silverlight application version 5.0&lt;/P&gt;&lt;P&gt;3. All original map service layers render in correct location in the Map control&lt;/P&gt;&lt;P&gt;4. But after the using Query task on route event layer, the result objects are set to wrong projection system, it pans to &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt; the coast of Africa near Nigeria and Cameroon.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;I have also set outSpatialReference [source from map] on query result features no use, &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Any one can help on this, please...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Sadanand&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 19 Nov 2014 06:20:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/querytask-result-returns-incorrect-geometry/m-p/611829#M57224</guid>
      <dc:creator>SadanandacharB1</dc:creator>
      <dc:date>2014-11-19T06:20:00Z</dc:date>
    </item>
  </channel>
</rss>

