<?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 Setting a map view center when using British National Grid coordinates in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/setting-a-map-view-center-when-using-british/m-p/1273469#M80693</link>
    <description>&lt;P&gt;Hello there,&lt;/P&gt;&lt;P&gt;I am working with a map that uses the BNG coordinate system (spatial reference 27700).&lt;/P&gt;&lt;P&gt;I have created a control that displays and draws on a map, this all works well.&lt;/P&gt;&lt;P&gt;I am also able to fly to a location on the map by setting the map view &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#center" target="_self"&gt;centre&lt;/A&gt; with a [lon, lat] pair of values:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.view.center = [-5.33420, 56.23880]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also hooked up a reactive event that when the map stop scrolling it gives me the current view.center values so I can see where the view is currently centered:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;reactiveUtils.when(
    () =&amp;gt; this.view.stationary === true,
    () =&amp;gt; {
        const lonLat = webMercatorUtils.xyToLngLat(this.view.center.x, this.view.center.y);
        console.log(`      Center XY ${this.view.center.x}, ${this.view.center.y}`);
        console.log(`  Center LatLon ${this.view.center.latitude}, ${this.view.center.longitude}`);
        console.log(`Mercator LatLon ${lonLat[1]}, ${lonLat[0]}`);
    }
);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which returns the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Center XY 187578.10796897276, 688867.6335343525&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Center LatLon null, null&lt;BR /&gt;Mercator LatLon 6.176207331557647, 1.6850428135475004&lt;/P&gt;&lt;P&gt;My goal is to be able to scroll a map to a predefined place, however because I do not have the lat lon values available to me in the map as it is using BNG I cannot use the method I described above.&amp;nbsp; I need to return the user to their selected position and zoom level if they save and close the app as the map will initially start at a way larger scale than the final selection of the user when they draw the geometry on the map (starting at county level, but drawing on a street in a town).&lt;/P&gt;&lt;P&gt;I've tried setting the x and y values on the centre but this doesn't work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.view.center.x =  187578.10796897276;
this.view.center.y =  688867.6335343525;
this.view.focus;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way for me to navigate using the center.x and center.y values, or for me to somehow get the lat lon for the current map center point or to convert to a Point that I can then set the center as?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Thu, 30 Mar 2023 12:22:59 GMT</pubDate>
    <dc:creator>nevvo</dc:creator>
    <dc:date>2023-03-30T12:22:59Z</dc:date>
    <item>
      <title>Setting a map view center when using British National Grid coordinates</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/setting-a-map-view-center-when-using-british/m-p/1273469#M80693</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;&lt;P&gt;I am working with a map that uses the BNG coordinate system (spatial reference 27700).&lt;/P&gt;&lt;P&gt;I have created a control that displays and draws on a map, this all works well.&lt;/P&gt;&lt;P&gt;I am also able to fly to a location on the map by setting the map view &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-views-MapView.html#center" target="_self"&gt;centre&lt;/A&gt; with a [lon, lat] pair of values:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.view.center = [-5.33420, 56.23880]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also hooked up a reactive event that when the map stop scrolling it gives me the current view.center values so I can see where the view is currently centered:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;reactiveUtils.when(
    () =&amp;gt; this.view.stationary === true,
    () =&amp;gt; {
        const lonLat = webMercatorUtils.xyToLngLat(this.view.center.x, this.view.center.y);
        console.log(`      Center XY ${this.view.center.x}, ${this.view.center.y}`);
        console.log(`  Center LatLon ${this.view.center.latitude}, ${this.view.center.longitude}`);
        console.log(`Mercator LatLon ${lonLat[1]}, ${lonLat[0]}`);
    }
);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Which returns the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Center XY 187578.10796897276, 688867.6335343525&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Center LatLon null, null&lt;BR /&gt;Mercator LatLon 6.176207331557647, 1.6850428135475004&lt;/P&gt;&lt;P&gt;My goal is to be able to scroll a map to a predefined place, however because I do not have the lat lon values available to me in the map as it is using BNG I cannot use the method I described above.&amp;nbsp; I need to return the user to their selected position and zoom level if they save and close the app as the map will initially start at a way larger scale than the final selection of the user when they draw the geometry on the map (starting at county level, but drawing on a street in a town).&lt;/P&gt;&lt;P&gt;I've tried setting the x and y values on the centre but this doesn't work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;this.view.center.x =  187578.10796897276;
this.view.center.y =  688867.6335343525;
this.view.focus;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is there a way for me to navigate using the center.x and center.y values, or for me to somehow get the lat lon for the current map center point or to convert to a Point that I can then set the center as?&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 12:22:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/setting-a-map-view-center-when-using-british/m-p/1273469#M80693</guid>
      <dc:creator>nevvo</dc:creator>
      <dc:date>2023-03-30T12:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a map view center when using British National Grid coordinates</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/setting-a-map-view-center-when-using-british/m-p/1273486#M80694</link>
      <description>&lt;P&gt;You may try something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;center: new Point({x: 500000, y: 500000, spatialReference: 27700})&lt;/LI-CODE&gt;&lt;P&gt;For a fully working example, please have a look at the script shown in this post:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/gis-blog/arcgis-javascript-with-uk-data-url-searchparams/ba-p/898659" target="_blank"&gt;ArcGIS JavaScript with UK data - URL.searchParams - Esri Community&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Egge-Jan&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 12:57:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/setting-a-map-view-center-when-using-british/m-p/1273486#M80694</guid>
      <dc:creator>Egge-Jan_Pollé</dc:creator>
      <dc:date>2023-03-30T12:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a map view center when using British National Grid coordinates</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/setting-a-map-view-center-when-using-british/m-p/1273521#M80696</link>
      <description>&lt;P&gt;D'oh - thanks very much.&amp;nbsp; Brain fail.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Mar 2023 13:44:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/setting-a-map-view-center-when-using-british/m-p/1273521#M80696</guid>
      <dc:creator>nevvo</dc:creator>
      <dc:date>2023-03-30T13:44:38Z</dc:date>
    </item>
  </channel>
</rss>

