<?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: Get point address in popup on click in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-point-address-in-popup-on-click/m-p/1096841#M74627</link>
    <description>&lt;P&gt;Change your anonymous "function()" methods to arrow functions "() =&amp;gt;{}". The &lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this" target="_self"&gt;context of this&lt;/A&gt; isn't the same inside regular functions.&lt;/P&gt;&lt;P&gt;You may however run into another issue. view is not in your Vue data prop. But Vue also uses &lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy" target="_self"&gt;JavaScript Proxy&lt;/A&gt; for reactive state management. This isn't compatible with our &lt;A href="https://developers.arcgis.com/javascript/latest/programming-patterns/#properties" target="_self"&gt;Accessor class&lt;/A&gt; and how we watch for property changes yet. It's on the roadmap to update in the future, but no timeline.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a blog post here on how to use Vue and the ArcGIS JSAPI together without Vue reactive state management.&lt;/P&gt;&lt;P&gt;&lt;A href="https://odoe.net/blog/vue-jsapi-calcite" target="_blank"&gt;https://odoe.net/blog/vue-jsapi-calcite&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 09 Sep 2021 16:52:41 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2021-09-09T16:52:41Z</dc:date>
    <item>
      <title>Get point address in popup on click</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-point-address-in-popup-on-click/m-p/1096811#M74624</link>
      <description>&lt;P&gt;Hi all, I'm following this tutorial and trying to implement in my code&lt;/P&gt;&lt;P&gt;&lt;A href="https://totalapis.github.io/sample-code/get-started-popup/" target="_self"&gt;https://totalapis.github.io/sample-code/get-started-popup/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;However, when I implement, I get an error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Uncaught TypeError: Cannot read property 'view' of undefined&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code below. Anyone know what I might be doing wrong?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;&amp;lt;template&amp;gt;
  &amp;lt;div id="viewDiv" class="balt-theme"&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/template&amp;gt;
&amp;lt;script&amp;gt;
  /* eslint-disable */
  import { loadModules } from 'esri-loader';


  export default {
    mounted() {
      this.loadMap();
      this.getStops();
    },
    data() {
      return {
        stops: []
      }
    },
    methods: {
      loadMap() {
        loadModules(['esri/config', "esri/tasks/Locator", 'esri/Map', 'esri/views/MapView', "esri/Basemap", "esri/layers/VectorTileLayer", "esri/symbols/PictureMarkerSymbol", 'esri/Graphic','esri/layers/GraphicsLayer', "dojo/domReady!"], {
            css: true
          })
          .then(([esriConfig, Locator, Map, MapView, Basemap, VectorTileLayer, PictureMarkerSymbol, Graphic, GraphicsLayer]) =&amp;gt; {
            // create map with the given options
          esriConfig.apiKey = "";

          var locatorTask = new Locator({
            url: "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer"
          });


          // Where we add in the custom colored map 
          const vectorTileLayer = new VectorTileLayer({
            portalItem: {
              id: "afff5c72b30f4102be6abe62c3591803" // ID for Map Made
            },
          });

          const basemap = new Basemap({
            baseLayers: [
              vectorTileLayer
            ]
          });


          const map = new Map ({
              basemap: basemap
          });


          // assign map to this view
          this.view = new MapView({
            container: this.$el,
            map: map,
            center: [-118.48456934438383, 34.02280292519253],
            zoom: 10,
            constraints: {
            minZoom: 23,
            maxZoom: 13
          }
          });


              this.view.on("click", function(event) {
        event.stopPropagation(); // overwrite default click-for-popup behavior

        // Get the coordinates of the click on the view
        var lat = Math.round(event.mapPoint.latitude * 1000) / 1000;
        var lon = Math.round(event.mapPoint.longitude * 1000) / 1000;

        this.view.popup.open({
          // Set the popup's title to the coordinates of the location
          title: "Reverse geocode: [" + lon + ", " + lat + "]",
          location: event.mapPoint // Set the location of the popup to the clicked location
        });

        // Display the popup
        // Execute a reverse geocode using the clicked location
        locatorTask.locationToAddress(event.mapPoint).then(function(
          response) {
          // If an address is successfully found, show it in the popup's content
          this.view.popup.content = response.address;
        }).otherwise(function(err) {
          // If the promise fails and no result is found, show a generic message
          this.view.popup.content =
            "No address was found for this location";
        });
      });


            // initialize graphics layer, add it to the map
            const graphicsLayer = new GraphicsLayer();
            map.add(graphicsLayer);





          this.stops.forEach((value) =&amp;gt; {
            // using a for each function to create markers on the map for all the stops 
            //Create a point

            // location 
            const point = { 
            type: "point",
            longitude: value[0],
            latitude: value[1]
          };

          // const simpleMarkerSymbol = {
          //   type: "simple-marker",
          //   color: [226, 119, 40],  // Orange
          //   outline: {
          //   color: [255, 255, 255], // White
          //   width: 1
          //   }
          // };

        // we are creating the components of a graphic, then adding to graphic
        // graphic is then being added to the graphics layer

        // what it actually looks like 
        let symbol = {
          type: "picture-marker",  // autocasts as new PictureMarkerSymbol()
          url: "https://static.arcgis.com/images/Symbols/Shapes/BlackStarLargeB.png",
          width: "64px",
          height: "64px"
        };

        // what is being added to the graphic layer 
          const pointGraphic = new Graphic({
            geometry: point,
            symbol: symbol
          });




          graphicsLayer.add(pointGraphic);



        })

          });
      },
      async getStops() {

        // This is where we get big blue bus data initially 
        let stop = await fetch(
        'http://gtfs.bigbluebus.com/parsed/stops.geojson'
        ).then(res =&amp;gt; res.json())
      
        let obj = stop.features 
        // pushing stops data to stops array 
        obj.forEach((value) =&amp;gt; {
         this.stops.push(value.geometry.coordinates)
        })



      }
    }
  }
&amp;lt;/script&amp;gt;
&amp;lt;style&amp;gt;
  /* esri styles */
  @import url('https://js.arcgis.com/4.4/esri/themes/light/main.css');
  #app {
    font-family: Avenir, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-align: center;
    color: #2c3e50;
  }
  #nav {
    padding: 30px;
  }
  #nav a {
    font-weight: bold;
    color: #2c3e50;
  }
  #nav a.router-link-exact-active {
    color: #42b983;
  }
  #viewDiv {
    position: absolute;
    top: 3.5rem;
    bottom: 0;
    left: 0;
    right: 0;
  }

&amp;lt;/style&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 16:43:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-point-address-in-popup-on-click/m-p/1096811#M74624</guid>
      <dc:creator>jh9</dc:creator>
      <dc:date>2021-09-09T16:43:28Z</dc:date>
    </item>
    <item>
      <title>Re: Get point address in popup on click</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-point-address-in-popup-on-click/m-p/1096841#M74627</link>
      <description>&lt;P&gt;Change your anonymous "function()" methods to arrow functions "() =&amp;gt;{}". The &lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/this" target="_self"&gt;context of this&lt;/A&gt; isn't the same inside regular functions.&lt;/P&gt;&lt;P&gt;You may however run into another issue. view is not in your Vue data prop. But Vue also uses &lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy" target="_self"&gt;JavaScript Proxy&lt;/A&gt; for reactive state management. This isn't compatible with our &lt;A href="https://developers.arcgis.com/javascript/latest/programming-patterns/#properties" target="_self"&gt;Accessor class&lt;/A&gt; and how we watch for property changes yet. It's on the roadmap to update in the future, but no timeline.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a blog post here on how to use Vue and the ArcGIS JSAPI together without Vue reactive state management.&lt;/P&gt;&lt;P&gt;&lt;A href="https://odoe.net/blog/vue-jsapi-calcite" target="_blank"&gt;https://odoe.net/blog/vue-jsapi-calcite&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 09 Sep 2021 16:52:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/get-point-address-in-popup-on-click/m-p/1096841#M74627</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-09-09T16:52:41Z</dc:date>
    </item>
  </channel>
</rss>

