<?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: How to fixed the size of the map? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-fixed-the-size-of-the-map/m-p/1126259#M75605</link>
    <description>&lt;P&gt;Looking at the two images, you can see star pins in areas of the map that aren't visible on the first map. When you run the following code snippet, you are telling the map to resize.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const zoom = CalculateZoomLevel(mapDiv, locations);
mapDiv.current.center = [centerLocation.longitude, centerLocation.latitude];
mapDiv.current.zoom = [zoom];&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Without seeing everything in CalculateZoomLevel, it's hard to identify specifics, but I suspect the method is getting the extent of all the features and using that in part of the calculation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 15 Dec 2021 14:50:00 GMT</pubDate>
    <dc:creator>CourtneyMenikheim</dc:creator>
    <dc:date>2021-12-15T14:50:00Z</dc:date>
    <item>
      <title>How to fixed the size of the map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-fixed-the-size-of-the-map/m-p/1125776#M75595</link>
      <description>&lt;DIV class="lia-message-template-content-zone"&gt;&lt;P&gt;Hi all I hope you all doing well, I have a problem regarding of sizes of map, in the first load the size is good and correct and when the data is load the size of the map is changes, please check the image below&lt;/P&gt;&lt;P&gt;first load&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="altair_0-1639478968752.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29638iB860EB1C3B58AA88/image-size/medium?v=v2&amp;amp;px=400" role="button" title="altair_0-1639478968752.png" alt="altair_0-1639478968752.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;after the data finish the load&amp;nbsp;&lt;/P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="altair_1-1639479002666.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/29639i1A8CEB3F82066982/image-size/medium?v=v2&amp;amp;px=400" role="button" title="altair_1-1639479002666.png" alt="altair_1-1639479002666.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;const [getUserData] = useLazyQuery(ME);&lt;BR /&gt;const [getLocations] = useLazyQuery(GET_ALL_Star.);&lt;BR /&gt;const mapDiv = useRef(style);&lt;BR /&gt;let orgId = null;&lt;BR /&gt;useEffect(() =&amp;gt; {&lt;BR /&gt;location();&lt;BR /&gt;&lt;BR /&gt;}, []);&lt;/P&gt;&lt;P&gt;const fetchData = () =&amp;gt; {&lt;BR /&gt;getUserData()&lt;BR /&gt;.then((result) =&amp;gt; {&lt;BR /&gt;return result.data;&lt;BR /&gt;})&lt;BR /&gt;.then(({ me }) =&amp;gt; {&lt;BR /&gt;orgId = organization.id;&lt;BR /&gt;return getLocations({&lt;BR /&gt;variables: {&lt;BR /&gt;&lt;BR /&gt;paging: {},&lt;BR /&gt;},&lt;BR /&gt;});&lt;BR /&gt;})&lt;BR /&gt;.then((result) =&amp;gt; {&lt;BR /&gt;return result.data;&lt;BR /&gt;})&lt;BR /&gt;.then(({ location}) =&amp;gt; {&lt;BR /&gt;displayLocation(location)&lt;BR /&gt;});&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;const location = () =&amp;gt; {&lt;BR /&gt;if (mapDiv.current) {&lt;BR /&gt;esriConfig.apiKey = process.env.ARCGIS_API_KEY;&lt;BR /&gt;const map = new Map({&lt;BR /&gt;basemap: 'arcgis-light-gray',&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const view = new MapView({&lt;BR /&gt;center: [123.5504, 12.3574], // Longitude, latitude&lt;BR /&gt;container: mapDiv.current,&lt;BR /&gt;map: map,&lt;BR /&gt;zoom: 2, // Zoom level&lt;BR /&gt;autoResize:true&lt;BR /&gt;});&lt;BR /&gt;view&lt;BR /&gt;.when((r) =&amp;gt; {})&lt;BR /&gt;.then(() =&amp;gt; {&lt;BR /&gt;mapDiv.current = view;&lt;BR /&gt;fetchData();&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;const displayLocation = (locations) =&amp;gt; {&lt;BR /&gt;locations.data = locations.data.filter((l) =&amp;gt;{&lt;BR /&gt;return l.geoCode &amp;amp;&amp;amp; l.orgId == orgId;&lt;BR /&gt;})&lt;BR /&gt;const centerLocation = CalculateCenter(locations);&lt;BR /&gt;const zoom = CalculateZoomLevel(mapDiv, locations);&lt;/P&gt;&lt;P&gt;mapDiv.current.center = [centerLocation.longitude, centerLocation.latitude];&lt;/P&gt;&lt;P&gt;mapDiv.current.zoom = [zoom];&lt;BR /&gt;mapDiv.current.autoResize= false;&lt;BR /&gt;locations.data.map((location) =&amp;gt; {&lt;BR /&gt;const point = new Graphic({&lt;BR /&gt;geometry: {&lt;BR /&gt;latitude: location.geoCode.latitude,&lt;BR /&gt;longitude: location.geoCode.longitude,&lt;BR /&gt;type: 'point',&lt;BR /&gt;},&lt;BR /&gt;symbol: StarPin,&lt;BR /&gt;});&lt;BR /&gt;mapDiv.current.graphics.add(point);&lt;BR /&gt;});&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;return &amp;lt;div className="mapDiv" ref={mapDiv}&amp;gt;&amp;lt;/div&amp;gt;;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 14 Dec 2021 11:21:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-fixed-the-size-of-the-map/m-p/1125776#M75595</guid>
      <dc:creator>altair</dc:creator>
      <dc:date>2021-12-14T11:21:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to fixed the size of the map?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-fixed-the-size-of-the-map/m-p/1126259#M75605</link>
      <description>&lt;P&gt;Looking at the two images, you can see star pins in areas of the map that aren't visible on the first map. When you run the following code snippet, you are telling the map to resize.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const zoom = CalculateZoomLevel(mapDiv, locations);
mapDiv.current.center = [centerLocation.longitude, centerLocation.latitude];
mapDiv.current.zoom = [zoom];&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Without seeing everything in CalculateZoomLevel, it's hard to identify specifics, but I suspect the method is getting the extent of all the features and using that in part of the calculation.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Dec 2021 14:50:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-fixed-the-size-of-the-map/m-p/1126259#M75605</guid>
      <dc:creator>CourtneyMenikheim</dc:creator>
      <dc:date>2021-12-15T14:50:00Z</dc:date>
    </item>
  </channel>
</rss>

