<?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: Cannot read property of undefined error when trying to use esri/geometry/support/webMercatorUtils in Angular in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-read-property-of-undefined-error-when/m-p/1027650#M71797</link>
    <description>&lt;P&gt;The help doc says that&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-webMercatorUtils.html" target="_self"&gt;webMercatorUtils&lt;/A&gt;&amp;nbsp;is an Object not a Class, so I don't think we would create a new instance using the 'new' keyword.&amp;nbsp; I wonder if this would work in your code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let coordinates: any = EsriwebMercatorUtils.xyToLngLat(x,y);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Feb 2021 16:30:00 GMT</pubDate>
    <dc:creator>JohnGrayson</dc:creator>
    <dc:date>2021-02-17T16:30:00Z</dc:date>
    <item>
      <title>Cannot read property of undefined error when trying to use esri/geometry/support/webMercatorUtils in Angular</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-read-property-of-undefined-error-when/m-p/1027387#M71788</link>
      <description>&lt;P&gt;Hi I'm using Javascript api 4.X with Angular and am getting the subject error&amp;nbsp;when I try to call the xyToLngLat method on webMercatorUtils.&amp;nbsp; I'm using the esri-loader to load esri modules.&lt;/P&gt;&lt;P&gt;In the code below the PanMap method in the Map Component gets called from Component MtTicketListComponent.&amp;nbsp; Any ideas where I'm going wrong?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Pete&lt;/P&gt;&lt;P&gt;Component 1&lt;BR /&gt;export class MtTicketListComponent implements OnInit {&lt;BR /&gt;....&lt;BR /&gt;public mtMap:MtMapComponent = new MtMapComponent;&lt;BR /&gt;...&lt;BR /&gt;MarkTicket(ticketData:UnMarkedData) {&lt;BR /&gt;this.mtMap.PanMap(ticketData.ptCenterX, ticketData.ptCenterY);&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;Map Component&lt;BR /&gt;export class MtMapComponent implements OnInit {&lt;BR /&gt;...&lt;BR /&gt;utilsMerc: __esri.webMercatorUtils&lt;/P&gt;&lt;P&gt;ngOnInit(): void {&lt;BR /&gt;loadModules([&lt;BR /&gt;'esri/Map',&lt;BR /&gt;'esri/views/MapView',&lt;BR /&gt;'esri/geometry/support/webMercatorUtils'&lt;BR /&gt;])&lt;BR /&gt;.then(([EsriMap, EsriMapView, EsriwebMercatorUtils]) =&amp;gt; {&lt;BR /&gt;this.utilsMerc = new EsriwebMercatorUtils;&lt;BR /&gt;...&lt;BR /&gt;...&lt;BR /&gt;})&lt;BR /&gt;...&lt;BR /&gt;}&lt;BR /&gt;public PanMap(x: number, y: number) {&lt;BR /&gt;let coordinates: any = this.utilsMerc.xyToLngLat(x,y);//getting undefined error on this.utilsMerc&lt;BR /&gt;..&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2021 23:02:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-read-property-of-undefined-error-when/m-p/1027387#M71788</guid>
      <dc:creator>PeteVitt</dc:creator>
      <dc:date>2021-02-16T23:02:39Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot read property of undefined error when trying to use esri/geometry/support/webMercatorUtils in Angular</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-read-property-of-undefined-error-when/m-p/1027650#M71797</link>
      <description>&lt;P&gt;The help doc says that&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-support-webMercatorUtils.html" target="_self"&gt;webMercatorUtils&lt;/A&gt;&amp;nbsp;is an Object not a Class, so I don't think we would create a new instance using the 'new' keyword.&amp;nbsp; I wonder if this would work in your code:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;let coordinates: any = EsriwebMercatorUtils.xyToLngLat(x,y);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 16:30:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-read-property-of-undefined-error-when/m-p/1027650#M71797</guid>
      <dc:creator>JohnGrayson</dc:creator>
      <dc:date>2021-02-17T16:30:00Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot read property of undefined error when trying to use esri/geometry/support/webMercatorUtils in Angular</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-read-property-of-undefined-error-when/m-p/1027678#M71799</link>
      <description>&lt;P&gt;Hi John - I've tried that with no luck.&amp;nbsp; I think my problem is related to this issue (&lt;A href="https://github.com/Esri/angular-cli-esri-map/issues/8" target="_blank"&gt;https://github.com/Esri/angular-cli-esri-map/issues/8&lt;/A&gt;) discussed over on Github in 2018 about not being able to access the esri typescript namespace outside of the&amp;nbsp;ngOnInit function.&amp;nbsp; I've put in another issue over there to see if there have been an developments&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Pete&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2021 16:53:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/cannot-read-property-of-undefined-error-when/m-p/1027678#M71799</guid>
      <dc:creator>PeteVitt</dc:creator>
      <dc:date>2021-02-17T16:53:38Z</dc:date>
    </item>
  </channel>
</rss>

