<?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: view.goTo method doesn't succeed in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024333#M71682</link>
    <description>&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;now it works when using the topo-vector basemap. But it still doesn`t work when using the custom basemap.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Feb 2021 14:08:32 GMT</pubDate>
    <dc:creator>MichaelBoschert</dc:creator>
    <dc:date>2021-02-08T14:08:32Z</dc:date>
    <item>
      <title>view.goTo method doesn't succeed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024289#M71677</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I tried to develope a map with JS API4 that shows several features depending on the used url.&lt;/P&gt;&lt;P&gt;So if you call "https://serverurl/Map.html?fs=Feature1 i would like the map to zoom to that features.&lt;BR /&gt;My problem is, that the map doesn't zoom to the feature. I think it could be a spatial reference problem but i'm not able to fix it.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="utf-8"&amp;gt;
  &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"&amp;gt;
  &amp;lt;title&amp;gt;Bebauungsplan Protoyp API4&amp;lt;/title&amp;gt;
  &amp;lt;style&amp;gt;
    html, body, #viewDiv {
      padding: 0;
      margin: 0;
      height: 100%;
      width: 100%;
    }
  &amp;lt;/style&amp;gt;
  &amp;lt;link rel="stylesheet" href="https://js.arcgis.com/4.18/esri/themes/light/main.css"&amp;gt;
  &amp;lt;script src="https://js.arcgis.com/4.18/"&amp;gt;&amp;lt;/script&amp;gt;

  &amp;lt;script&amp;gt;
    require([
      "esri/Map",
      "esri/views/MapView",
      "esri/layers/FeatureLayer",
      "esri/layers/ImageryLayer",
      "esri/widgets/LayerList",
      "esri/widgets/Search",
      "esri/portal/Portal",
      "esri/layers/Layer",
      "esri/layers/MapImageLayer",
      "esri/layers/ImageryLayer",
      "esri/Basemap",
      "esri/geometry/Extent",
      "esri/geometry/SpatialReference"
    ], function(
        Map,
        MapView,
        FeatureLayer,
        ImageryLayer,
        LayerList,
        Search,
        Portal,
        Layer,
        MapImageLayer,
        ImageryLayer,
        Basemap,
        Extent,
        SpatialReference
      )
    {

      if ('URLSearchParams' in window) { // Feature detection (URLSearchParams is not supported by Internet Explorer)
        var url = new URL(document.URL);
        var search_params = url.searchParams;
        if(search_params.has('fs')) {
          var url_bplan = search_params.get('fs');
          var expr = "bemerkung = '"+url_bplan+"'";
        } else {
          expr1 = "leer";
        }
      };

      var bplan_feature = new FeatureLayer({
        url: "https://serverurl/FeatureServer/1",
        outFields: ["*"],
        definitionExpression : expr,
        title : "Layer",
      });

      var baselayer = new ImageryLayer({
        // URL to the imagery service
        url: "https://serverurl/ImageServer",
        wkid: 25832
      });

      var basemap = new Basemap({
        baseLayers: [baselayer],
        title: "Luftbild 2020"
      })

      var map = new Map({
        basemap: basemap,
      });

      var view = new MapView({
        container: "viewDiv",
        map: map
      });


      map.add(bplan_feature);
      view.goTo(bplan_feature);


      //add layerlist
      var layerList = new LayerList({
        view: view,
        selectionEnabled : true
      });

      view.ui.add(layerList, {
      position: "top-right",
      });
    });
  &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;div id="viewDiv"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What you see is just a part of the script but I think one can see the problem. Using the goTo Method results in nothing.&amp;nbsp; Features and Basemap are all in 25832 UTM&lt;/P&gt;&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 09:48:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024289#M71677</guid>
      <dc:creator>MichaelBoschert</dc:creator>
      <dc:date>2021-02-08T09:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: view.goTo method doesn't succeed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024317#M71678</link>
      <description>&lt;P&gt;The target property of &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#goTo" target="_self"&gt;view.goTo&lt;/A&gt; has to be a lat/long, a geometry, a graphic, or a Viewpoint. You're providing it a FeatureLayer. Try&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;view.goTo(bplan_feature.fullExtent);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 13:00:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024317#M71678</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-02-08T13:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: view.goTo method doesn't succeed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024320#M71679</link>
      <description>&lt;P&gt;Thanks for your reply!&lt;/P&gt;&lt;P&gt;I tried that already but still the same behaviour. The coordinate-system is projected, does that affect?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 13:11:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024320#M71679</guid>
      <dc:creator>MichaelBoschert</dc:creator>
      <dc:date>2021-02-08T13:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: view.goTo method doesn't succeed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024324#M71680</link>
      <description>&lt;P&gt;You also have to wait until the featureLayer is created:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;view.whenLayerView(featureLayer)
  .then(() =&amp;gt; {
    view.goTo(featureLayer.fullExtent);
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 13:34:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024324#M71680</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-02-08T13:34:35Z</dc:date>
    </item>
    <item>
      <title>Re: view.goTo method doesn't succeed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024333#M71682</link>
      <description>&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;now it works when using the topo-vector basemap. But it still doesn`t work when using the custom basemap.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 14:08:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024333#M71682</guid>
      <dc:creator>MichaelBoschert</dc:creator>
      <dc:date>2021-02-08T14:08:32Z</dc:date>
    </item>
    <item>
      <title>Re: view.goTo method doesn't succeed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024344#M71683</link>
      <description>&lt;P&gt;It looks like you'll have to &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-tasks-GeometryService.html#project" target="_self"&gt;project&lt;/A&gt; the extent to the basemap's spatial reference using GeometryService&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 14:25:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024344#M71683</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-02-08T14:25:56Z</dc:date>
    </item>
    <item>
      <title>Re: view.goTo method doesn't succeed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024355#M71685</link>
      <description>&lt;P&gt;Using the following code snippet resulted in succes!&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;      view.whenLayerView(bplan_feature).then(function(layerView) {
        layerView.watch("updating", function(val) {
// wait for the layer view to finish updating
        if (!val) {
          layerView.queryExtent().then(function(response) {
  // go to the extent of all the graphics in the layer view
      view.goTo(response.extent);
      });
    }
    });
    });&lt;/LI-CODE&gt;&lt;P&gt;Thanks for your help KenBuja!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 14:33:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/view-goto-method-doesn-t-succeed/m-p/1024355#M71685</guid>
      <dc:creator>MichaelBoschert</dc:creator>
      <dc:date>2021-02-08T14:33:38Z</dc:date>
    </item>
  </channel>
</rss>

