<?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: ArcGIS Javascript API - GraphicsLayer misalignment in ArcGIS Server with JavaScript API Questions</title>
    <link>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857073#M606</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, so the problem seems to be that my data is in NAD83_UTM_10N and I'm publishing the map service as &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;WGS_1984_Web_Mercator&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I set the dataframe in my mxd to &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;WGS_1984_Web_Mercator and &lt;EM&gt;then&lt;/EM&gt; publish, the features line up nicely in the map but I get reprojection exceptions in chrome when I dump queryTask results into a graphics layer:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14339681410711853 jive_text_macro" data-renderedposition="116_8_913_16" jivemacro_uid="_14339681410711853"&gt;&lt;P&gt;Map: Geometry (wkid: 26910) cannot be converted to spatial reference of the map (wkid: 102100)&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that using the standard basemap layer I need to use the &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;WGS_1984_Web_Mercator projection, which is fine.&amp;nbsp; But how to I make things line up with my NAD83_UTM_10N data? &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;Again, when my mxd is published with the projection set to &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;WGS_1984_Web_Mercator, the Basemap and &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;ArcGISDynamicMapServiceLayer tiles line up as expected. The problem arises when I go to load queryTask results into a GraphicsLayer.&lt;/SPAN&gt;&lt;/SPAN&gt;&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;Is there some best practice for publishing data in differing projections that I am missing here?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jun 2015 20:35:17 GMT</pubDate>
    <dc:creator>AdamValair</dc:creator>
    <dc:date>2015-06-10T20:35:17Z</dc:date>
    <item>
      <title>ArcGIS Javascript API - GraphicsLayer misalignment</title>
      <link>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857069#M602</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Howdy ESRI Community.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a layer misalignment that I cannot explain. &lt;/P&gt;&lt;P&gt;The details:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - ArcGIS js api v3.12. &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - IE7.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - map loads with streets basemap.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - one ArcGISDynamicMapServiceLayer: projection set to: &lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;WGS_1984_Web_Mercator&lt;/P&gt;&lt;P style="padding-left: 90px;"&gt;WKID: 3785 Authority: EPSG&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - when a queryTask is executed against the ArcGISDynamicMapServiceLayer, the results are dumped into a graphicLayer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Screenshot of misalignment (red features are in the graphicsLayer):&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/107940_pastedImage_0.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I can confirm that:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;- the spatial reference of the map object's extent seems to be set correctly:&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;latestWkid: 3857&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;wkid: 102100 &lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;- the spatial reference of the graphics objects seem to be correct (sample of one of the objects):&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;latestWkid: 3857&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;wkid: 102100&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;- the spatial reference of the basemap layer object also seems to be correct:&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;latestWkid: 3857&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;wkid: 102100&lt;/P&gt;&lt;P style="padding-left: 60px;"&gt;&lt;/P&gt;&lt;P&gt;Any super duper GIS people out there with an idea? &lt;/P&gt;&lt;P&gt;If all the projections are the same, why the misalignment? &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2015 01:08:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857069#M602</guid>
      <dc:creator>AdamValair</dc:creator>
      <dc:date>2015-06-09T01:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Javascript API - GraphicsLayer misalignment</title>
      <link>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857070#M603</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Adam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can you &lt;A href="https://community.esri.com/migration-blogpost/1070"&gt;post &lt;/A&gt;your code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, does this occur in all browsers, or just IE7?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Jun 2015 11:52:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857070#M603</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-06-09T11:52:47Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Javascript API - GraphicsLayer misalignment</title>
      <link>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857071#M604</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey &lt;A href="https://community.esri.com/migrated-users/8586" target="_blank"&gt;Jake Skinner&lt;/A&gt;​,&lt;/P&gt;&lt;P&gt;I'm developing for IE7 but the shift appears in Chrome, FF, and IE (edge).&lt;/P&gt;&lt;P&gt;The dynamic map service is published by ArcGIS Server 10.2. &lt;/P&gt;&lt;P&gt;I've stripped out what I think are the relevant pieces of code. Let me know if there's anything else I can provide.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;//Query by extent tool:
registry.byId("tool_AssetQueryExtent").on("click", function () {
&amp;nbsp; toolbar_draw.activate(Draw["EXTENT"]);
});
toolbar_draw.on("draw-end", function(evt){
&amp;nbsp; //Execute query:
&amp;nbsp; doQueryFeatureService_spatial(evt);
});


function doQueryFeatureService_spatial(draw_event){


&amp;nbsp; //console.log(app.feature_service_info);
&amp;nbsp; clearQueryResults(dijit_id_results_target_container); //Clear any previous results (graphics and grids/tabs)


&amp;nbsp; var queries =[];
&amp;nbsp; var tmp_query;
&amp;nbsp; var tmp_queryTask;
&amp;nbsp; var query_geom;
&amp;nbsp; var layer_object;
&amp;nbsp; var layer_info;
&amp;nbsp; var sublayer_id;


&amp;nbsp; //If the user query came from a point-click then convert to extent before running the query:
&amp;nbsp; if (draw_event.geometry.type == "point"){query_geom = makeExtentFromGeometryPoint(draw_event.geometry);}
&amp;nbsp; else {query_geom = draw_event.geometry;}


&amp;nbsp; //Execute the query:
&amp;nbsp; //Loop over selected layer ids in the selected query layer object (maintained by layer selector dijit):
&amp;nbsp; for (var i=0;i&amp;lt;app.selected_query_layers["the_layers"].length;i++){
&amp;nbsp; sublayer_id =&amp;nbsp; app.selected_query_layers[map_layer_id]&lt;I&gt;;&lt;/I&gt;
&amp;nbsp; layer_info = getLayerInfo(layer_object,sublayer_id);


&amp;nbsp; //Skip any group layers:
&amp;nbsp; if(layer_info.type == "Group Layer"){continue;}


&amp;nbsp; tmp_query = new esri.tasks.Query();
&amp;nbsp; tmp_query.geometry = query_geom;
&amp;nbsp; tmp_query.returnGeometry = true;
&amp;nbsp; tmp_query.outFields = ["*"];
&amp;nbsp; tmp_query.Token = app.credentials.cred_feature_service.token; //This is initialized by the createFeatureServiceInfo function. WIll be a FAKE null token if using the proxy.
&amp;nbsp; tmp_queryTask = new esri.tasks.QueryTask(url_arcgis_feature_service + "/" + sublayer_id); //featureLayer url


&amp;nbsp; console.log("About to execute querytask on:" + url_arcgis_feature_service + "/" + sublayer_id);


&amp;nbsp; //Wrap the execute in an IFFE so that it is run right away (not after the loop finishes)
&amp;nbsp; (function(layer_info_object){
&amp;nbsp; //Execute the task:
&amp;nbsp; tmp_queryTask.execute(tmp_query, function (queryResults) {


&amp;nbsp; //Groups features into arrays in an object whose keys are layer ids.
&amp;nbsp; //Creates string properties and assigns to features
&amp;nbsp; //for retrieval later on.
&amp;nbsp; var processed_results = processQueryResults(queryResults.features, layer_info_object);

&amp;nbsp; //Add results to graphics layers
&amp;nbsp; highlightGraphics(processed_results, false); 


&amp;nbsp; //Send the results to the grids:
&amp;nbsp; app.results_grid.populateResultTables_dGrid(processed_results, dijit_id_results_target_container, app.feature_service_info);

&amp;nbsp; }, function (error) {
&amp;nbsp; console.log("Error executing query: ");
&amp;nbsp; console.log(error);
&amp;nbsp; console.log(layer_info_object);
&amp;nbsp; }); //End execute task
&amp;nbsp; }(layer_info)); //End immediately-invoked anyonmous function call --- "layer_info" is passed as a parameter to the anonymous function.
&amp;nbsp; }//end inner loop.
}


/*Create Graphics layer and add to map: */
graphicsLayer_highlight = new GraphicsLayer();
map_object.addLayer(graphicsLayer_highlight);


function highlightGraphics(processed_results,clear_previous){
&amp;nbsp; console.log(processed_results);
&amp;nbsp; if (clear_previous){
&amp;nbsp; graphicsLayer_highlight.clear();
&amp;nbsp; }


&amp;nbsp; var layer; //holds one-feature layer objects 
&amp;nbsp; var feature;
&amp;nbsp; var graphic;
&amp;nbsp; var symbol;


&amp;nbsp; //Go over the processed results, adding features to the graphics layer:
&amp;nbsp; for (var layer_group_key in processed_results){
&amp;nbsp; for (var i=0;i&amp;lt;processed_results[layer_group_key].length;i++){


&amp;nbsp; layer = processed_results[layer_group_key]&lt;I&gt;;&lt;/I&gt;


&amp;nbsp; if ((layer.feature.geometry.type == "point")|| (layer.feature.geometry.type == "multipoint")){symbol = symbol_highlight_results_POINT;}
&amp;nbsp; else if (layer.feature.geometry.type == "polyline"){symbol = symbol_highlight_results_LINE;}
&amp;nbsp; else if (layer.feature.geometry.type == "polygon") {symbol = symbol_highlight_results_POLYGON;}


&amp;nbsp; layer.feature.setSymbol(symbol);


&amp;nbsp; //Add the graphic and hold the object so we can insert the originating layer id:
&amp;nbsp; graphic = graphicsLayer_highlight.add(layer.feature);
&amp;nbsp; graphic.originating_layer_id = layer.layerId;
&amp;nbsp; console.log(graphic);
&amp;nbsp; console.log(map);
&amp;nbsp; }
&amp;nbsp; }
&amp;nbsp; graphicsLayer_highlight.redraw();
}&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 10:36:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857071#M604</guid>
      <dc:creator>AdamValair</dc:creator>
      <dc:date>2021-12-12T10:36:15Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Javascript API - GraphicsLayer misalignment</title>
      <link>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857072#M605</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm starting to think there is a projection problem with the data itself. I will post when I get it sorted.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 15:55:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857072#M605</guid>
      <dc:creator>AdamValair</dc:creator>
      <dc:date>2015-06-10T15:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Javascript API - GraphicsLayer misalignment</title>
      <link>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857073#M606</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, so the problem seems to be that my data is in NAD83_UTM_10N and I'm publishing the map service as &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;WGS_1984_Web_Mercator&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I set the dataframe in my mxd to &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;WGS_1984_Web_Mercator and &lt;EM&gt;then&lt;/EM&gt; publish, the features line up nicely in the map but I get reprojection exceptions in chrome when I dump queryTask results into a graphics layer:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14339681410711853 jive_text_macro" data-renderedposition="116_8_913_16" jivemacro_uid="_14339681410711853"&gt;&lt;P&gt;Map: Geometry (wkid: 26910) cannot be converted to spatial reference of the map (wkid: 102100)&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think that using the standard basemap layer I need to use the &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;WGS_1984_Web_Mercator projection, which is fine.&amp;nbsp; But how to I make things line up with my NAD83_UTM_10N data? &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;Again, when my mxd is published with the projection set to &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;WGS_1984_Web_Mercator, the Basemap and &lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;ArcGISDynamicMapServiceLayer tiles line up as expected. The problem arises when I go to load queryTask results into a GraphicsLayer.&lt;/SPAN&gt;&lt;/SPAN&gt;&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;Is there some best practice for publishing data in differing projections that I am missing here?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jun 2015 20:35:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857073#M606</guid>
      <dc:creator>AdamValair</dc:creator>
      <dc:date>2015-06-10T20:35:17Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Javascript API - GraphicsLayer misalignment</title>
      <link>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857074#M607</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Adam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Try setting the query results to the NAD_1983_UTM_Zone_10N (26910) coordinate system using the &lt;A href="https://developers.arcgis.com/javascript/jsapi/query-amd.html#outspatialreference"&gt;outSpatialReference &lt;/A&gt;property to see if this fixes the issue.&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 _jivemacro_uid_14340182538431463 jive_text_macro" data-renderedposition="113_8_912_16" jivemacro_uid="_14340182538431463"&gt;&lt;P&gt;tmp_query.outSpatialReference =&amp;nbsp; new SpatialReference(26910);&lt;/P&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 10:24:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857074#M607</guid>
      <dc:creator>JakeSkinner</dc:creator>
      <dc:date>2015-06-11T10:24:22Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS Javascript API - GraphicsLayer misalignment</title>
      <link>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857075#M608</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/8586"&gt;Jake Skinner&lt;/A&gt;​: that seems be it! I assumed that since my map service was published using (102100), any features coming out of it would have that projection. Apparently that isn't so. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So query results had to be requested in web mercator (102100) because that's my app's projection:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="javascript" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14340353600748399 jive_text_macro" data-renderedposition="116_8_913_16" jivemacro_uid="_14340353600748399"&gt;&lt;P&gt;tmp_query.outSpatialReference =&amp;nbsp; new SpatialReference(102100);&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I had been digging through the properties of the graphics objects and they all had their spatial reference properties correctly set (to 102100) even though their coordinates were wonky. Meh, I don't get that, but who cares, it's working!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Jun 2015 15:14:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-server-with-javascript-api-questions/arcgis-javascript-api-graphicslayer-misalignment/m-p/857075#M608</guid>
      <dc:creator>AdamValair</dc:creator>
      <dc:date>2015-06-11T15:14:59Z</dc:date>
    </item>
  </channel>
</rss>

