<?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: Help for a newbie? view.goTo not working in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-for-a-newbie-view-goto-not-working/m-p/1344511#M82649</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;As far as I can tell, the issue you're encountering stems from line 20 above, where you convert the geometry data to JSON.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;feature.geometry.toJSON()&lt;/PRE&gt;&lt;P&gt;If you just get the feature's geometry without converting it to JSON, your zoomToFeature function then works as-is.&lt;BR /&gt;&lt;BR /&gt;Please let us know if this doesn't resolve your issue.&lt;/P&gt;&lt;P&gt;Dani&lt;/P&gt;</description>
    <pubDate>Wed, 01 Nov 2023 16:37:05 GMT</pubDate>
    <dc:creator>dani</dc:creator>
    <dc:date>2023-11-01T16:37:05Z</dc:date>
    <item>
      <title>Help for a newbie? view.goTo not working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-for-a-newbie-view-goto-not-working/m-p/1343854#M82631</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am very new to using the ArcGIS JavaScript API, but wanted to utilize it to challenge myself for a final project in a course I'm taking. I am building a React application. For the MenuPanel component, the shenandoahHikesLayer and sceneView props are passed from the parent "HomePage" component.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;What I am trying to accomplish is to create a dropdown menu and populating the values in the dropdown by querying the feature layer and pulling the "hikeName" attribute information for the dropdown values. (currently working). However, I want the sceneView to zoom to that feature when that option is selected from the dropdown, and that's what I can't get to work. Nothing is happening in the sceneView at all when I select various options from the dropdown menu.&lt;/P&gt;&lt;P&gt;Here is the code for the MenuPanel component:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;import React, { useEffect, useState } from "react";
import { loadModules } from "esri-loader";
import Auth from "../utils/auth";
import "../styles/menuPanel.css";

const MenuPanel = ({ shenandoahHikesLayer, sceneView }) =&amp;gt; {
  const [featureData, setFeatureData] = useState([]);
  const [selectedFeature, setSelectedFeature] = useState("");

  useEffect(() =&amp;gt; {
    if (shenandoahHikesLayer) {
      loadModules(["esri/rest/query"]).then(([Query]) =&amp;gt; {
        let query = shenandoahHikesLayer.createQuery();
        query.returnGeometry = true;
        query.outFields = ["hikeName"];

        shenandoahHikesLayer.queryFeatures(query).then((result) =&amp;gt; {
          const featuresData = result.features.map((feature) =&amp;gt; ({
            name: feature.attributes.hikeName,
            geometry: feature.geometry.toJSON(), // Convert geometry to JSON
          }));

          setFeatureData(featuresData);
        });
      });
    }
  }, [shenandoahHikesLayer]);

  const zoomToFeature = (geometry) =&amp;gt; {
    sceneView.goTo({
      target: geometry,
      scale: 10000,
      tilt: 60,
    });
  };

  const handleDropdownChange = (event) =&amp;gt; {
    const selectedName = event.target.value;
    setSelectedFeature(selectedName);

    const selectedFeatureData = featureData.find(
      (feature) =&amp;gt; feature.name === selectedName
    );

    if (sceneView &amp;amp;&amp;amp; selectedFeature) {
      zoomToFeature(selectedFeature.geometry);
    }
  };

  return (
    &amp;lt;div className="menu-panel"&amp;gt;
      &amp;lt;select value={selectedFeature} onChange={handleDropdownChange}&amp;gt;
        &amp;lt;option value=""&amp;gt;Select a Hike&amp;lt;/option&amp;gt;
        {featureData.map((feature) =&amp;gt; (
          &amp;lt;option key={feature.name} value={feature.name}&amp;gt;
            {feature.name}
          &amp;lt;/option&amp;gt;
        ))}
      &amp;lt;/select&amp;gt;
      {Auth.loggedIn() &amp;amp;&amp;amp; selectedFeature !== "" &amp;amp;&amp;amp; (
        &amp;lt;div&amp;gt;
          &amp;lt;span className="divider-menu-panel"&amp;gt;&amp;lt;/span&amp;gt;
          &amp;lt;button type="button" className="btn btn-dark btn-menu-panel"&amp;gt;
            I completed this hike!
          &amp;lt;/button&amp;gt;
          &amp;lt;button type="button" className="btn btn-dark btn-menu-panel"&amp;gt;
            Add this hike to my wishlist
          &amp;lt;/button&amp;gt;
        &amp;lt;/div&amp;gt;
      )}
    &amp;lt;/div&amp;gt;
  );
};

export default MenuPanel;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are some screenshots:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="kclarkGIS_0-1698763557570.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/84555iBBA8A1CB9DB48B01/image-size/medium?v=v2&amp;amp;px=400" role="button" title="kclarkGIS_0-1698763557570.png" alt="kclarkGIS_0-1698763557570.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Correctly pulling the hikeName information from the feature layer (right now only two features). But nothing changes in the sceneView when I click on the names in the dropdown.&lt;/P&gt;&lt;P&gt;As far as I can tell both the map and the layers are in Spatial Reference wkid 4269.&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated! Thank you so much!!&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2023 14:51:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-for-a-newbie-view-goto-not-working/m-p/1343854#M82631</guid>
      <dc:creator>kclarkGIS</dc:creator>
      <dc:date>2023-10-31T14:51:24Z</dc:date>
    </item>
    <item>
      <title>Re: Help for a newbie? view.goTo not working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-for-a-newbie-view-goto-not-working/m-p/1344511#M82649</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;As far as I can tell, the issue you're encountering stems from line 20 above, where you convert the geometry data to JSON.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;feature.geometry.toJSON()&lt;/PRE&gt;&lt;P&gt;If you just get the feature's geometry without converting it to JSON, your zoomToFeature function then works as-is.&lt;BR /&gt;&lt;BR /&gt;Please let us know if this doesn't resolve your issue.&lt;/P&gt;&lt;P&gt;Dani&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 16:37:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-for-a-newbie-view-goto-not-working/m-p/1344511#M82649</guid>
      <dc:creator>dani</dc:creator>
      <dc:date>2023-11-01T16:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: Help for a newbie? view.goTo not working</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-for-a-newbie-view-goto-not-working/m-p/1344757#M82654</link>
      <description>&lt;P&gt;Thanks for the response! I eventually got it to work, my main issue was how I had set up the menu panel component to access the map/scene view prop, I wasn't passing it in from the correct parent component.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Nov 2023 22:49:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/help-for-a-newbie-view-goto-not-working/m-p/1344757#M82654</guid>
      <dc:creator>kclarkGIS</dc:creator>
      <dc:date>2023-11-01T22:49:41Z</dc:date>
    </item>
  </channel>
</rss>

