<?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: Create extent to fit all points keeping centre fixed in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101529#M9343</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 11 Feb 2019 14:49:30 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2019-02-11T14:49:30Z</dc:date>
    <item>
      <title>Create extent to fit all points keeping centre fixed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101524#M9338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I'm trying to derive an extent out of a list of point geometries, so that all the geometries fit into the extent, keeping fixed to a provided centre. The problem I'm having with &lt;STRONG&gt;extent.union()&lt;/STRONG&gt; is it, doesn't keep the extent centre fixed. And doing &lt;STRONG&gt;extent.centerAt()&lt;/STRONG&gt; post all the union()s does not fit all the points. And extent.&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Extent.html#expand" style="color: #005e95; background-color: #ffffff; font-weight: 300; text-decoration: underline;" rel="nofollow noopener noreferrer" target="_blank"&gt;expand&lt;/A&gt;() does not take a point. Is there a similar solution as&amp;nbsp;&lt;STRONG&gt;&lt;SPAN style="color: #37474f;"&gt;google.maps&lt;/SPAN&gt;&lt;SPAN style="color: #37474f; background-color: #f7f7f7;"&gt;.&lt;/SPAN&gt;&lt;SPAN style="color: #37474f;"&gt;LatLngBounds.&lt;SPAN style="color: inherit; background-color: rgba(255, 255, 255, 0.87); text-decoration: none;"&gt;&lt;A href="https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLngBounds.extend" style="color: inherit; background-color: rgba(255, 255, 255, 0.87); text-decoration: none;" rel="nofollow noopener noreferrer" target="_blank"&gt;extend&lt;/A&gt;(Point)&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&amp;nbsp;in ARCGis to extend the extent to a given point keeping the centre fixed.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;fitBounds&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mapsterGeoJson&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; boundCen&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; me &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; tempExtnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; resExtnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;createPointExtent&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;boundCen&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getValue&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;        
        mapsterGeoJson&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getVendorGeoJSON&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;graphics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;forEach&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;graphics&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
            tempExtnt &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; me&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;createPointExtent&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;graphics&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;geometry&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
            &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;!&lt;/SPAN&gt;resExtnt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;contains&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tempExtnt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
                resExtnt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;union&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;tempExtnt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
            &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;                        
        &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;        
        resExtnt&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;centerAt&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;boundCen&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getValue&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        me&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getVendorView&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;whenLayerView&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;mapsterGeoJson&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getVendorGeoJSON&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt; 
        &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
            me&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getVendorView&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;goTo&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;resExtnt&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
        &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;          
        &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
createPointExtent&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pointGeometry&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
    &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt;  &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;this&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapObj&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;apiInterface&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;geometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Extent&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
            xmin&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; pointGeometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;longitude&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            xmax&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; pointGeometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;longitude&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            ymin&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; pointGeometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;latitude&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
            ymax&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; pointGeometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;latitude            
    &lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:16:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101524#M9338</guid>
      <dc:creator>Rupam_RanjanRana</dc:creator>
      <dc:date>2021-12-11T06:16:28Z</dc:date>
    </item>
    <item>
      <title>Re: Create extent to fit all points keeping centre fixed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101525#M9339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rupam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; The one way I can think of is to clone the&amp;nbsp;resExtnt to a new var before you center it. then union the centered&amp;nbsp;&lt;SPAN&gt;resExtnt&amp;nbsp;and the cloned one.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 09 Feb 2019 14:11:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101525#M9339</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-02-09T14:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Create extent to fit all points keeping centre fixed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101526#M9340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Robert,&lt;/P&gt;&lt;P&gt;Tried it, but doesn't work.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;setBounds: function (mapsterGeoJson, boundCen) {
        var me = this;
        var tempExtnt = null;
        var resExtnt = this.createPointExtent(boundCen.getValue());                 
        mapsterGeoJson.getVendorGeoJSON().graphics.forEach(function (graphics) {
            tempExtnt = me.createPointExtent(graphics.geometry);
            if (!resExtnt.contains(tempExtnt)) {
                resExtnt.union(tempExtnt);
            }                        
        });        
        var clonedExtent = resExtnt.clone();
        resExtnt.centerAt(boundCen.getValue());
        resExtnt.union(clonedExtent);
        me.getVendorView().whenLayerView(mapsterGeoJson.getVendorGeoJSON()).then( 
        function () {
            me.getVendorView().goTo(resExtnt);
        });          
        return this;
    },&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Also couldn't use&amp;nbsp;&lt;SPAN style="background-color: #ffffff;"&gt;extent.expand() as it requires a factor to multiply and I have to test all the points after expand till all the points fit. And also the point extents have zero height and width so expand will not modify the extent at all.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:16:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101526#M9340</guid>
      <dc:creator>Rupam_RanjanRana</dc:creator>
      <dc:date>2021-12-11T06:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: Create extent to fit all points keeping centre fixed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101527#M9341</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Rupam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I convert a point into an extent using a default 6 pixel tolerance. Normally I use this for getting an extent from a mouse click, but I think it will help in your situation.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;pointToExtent&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;pointGeometry&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; distance&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; clickOffset &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; distance &lt;SPAN class="operator token"&gt;||&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;6&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; centerPoint &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; pointGeometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;clone&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; mapWidth &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; me&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getVendorView&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;extent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;width&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; pixelWidth &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; mapWidth &lt;SPAN class="operator token"&gt;/&lt;/SPAN&gt; me&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getVendorView&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;width&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; tolerance &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; clickOffset &lt;SPAN class="operator token"&gt;*&lt;/SPAN&gt; pixelWidth&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; queryExtent &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;this&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;mapObj&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;apiInterface&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;geometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;Extent&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;xmin&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ymin&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; xmax&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; tolerance&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; ymax&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; tolerance&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; spatialReference&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; pointGeometry&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;spatialReference&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; queryExtent&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;centerAt&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;centerPoint&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;‍‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:16:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101527#M9341</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-11T06:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Create extent to fit all points keeping centre fixed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101528#M9342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert,&lt;/P&gt;&lt;P&gt;The solution worked. So the code now looks as follows.&amp;nbsp;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;setBounds: function (mapsterGeoJson, singularity) {
        var me = this;
        me.getVendorView().whenLayerView(mapsterGeoJson.getVendorGeoJSON()).then(function () {
            var blackhole = me.createPointExtent(singularity.getValue()); //Create extent at the center            
            var maxDist = 0, tempDist = 0;
            mapsterGeoJson.getVendorGeoJSON().graphics.forEach(function (graphics) {
                tempDist = me.mapObj.apiInterface.geometry.geometryEngine.distance(singularity.getValue(),
                    graphics.geometry);
                if (tempDist &amp;gt; maxDist) {
                    maxDist = tempDist;
                }
            }); //Find the farthest distance from center
            /*Expand the extent to the farthest geometry. And acounting for device aspect ratio.*/
            blackhole.expand((maxDist + (maxDist * 1.5)) / blackhole.width); 
            me.getVendorView().goTo(blackhole);
        });
        return this;
    },
createPointExtent: function (pointGeometry) {
        var clickOffset = 6;
        var centerPoint = pointGeometry.clone();
        var mapWidth = this.getVendorView().extent.width;
        var pixelWidth = mapWidth / this.getVendorView().width;
        var tolerance = clickOffset * pixelWidth;
        var queryExtent = new this.mapObj.apiInterface.geometry.Extent({
            xmin: 1,
            ymin: 1,
            xmax: tolerance,
            ymax: tolerance,
            spatialReference: pointGeometry.spatialReference
        });
        return queryExtent.centerAt(centerPoint);
    },&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thank you for the help.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:16:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101528#M9342</guid>
      <dc:creator>Rupam_RanjanRana</dc:creator>
      <dc:date>2021-12-11T06:16:36Z</dc:date>
    </item>
    <item>
      <title>Re: Create extent to fit all points keeping centre fixed</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101529#M9343</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Feb 2019 14:49:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-extent-to-fit-all-points-keeping-centre/m-p/101529#M9343</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-02-11T14:49:30Z</dc:date>
    </item>
  </channel>
</rss>

