<?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: Undefined SpatialReference in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358331#M83067</link>
    <description>&lt;P&gt;I think I have found the problem. Your points are an array and the distance is a single value. That is not allowed.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;geometry&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html" target="_blank" rel="noopener"&gt;Geometry&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;|&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html" target="_blank" rel="noopener"&gt;Geometry&lt;/A&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array" target="_blank" rel="noopener"&gt;[]&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;The buffer input geometry. The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;geometry&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;distance&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;parameters must be specified as either both arrays or both non-arrays. Never specify one as an array and the other a non-array.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;distance&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number" target="_blank" rel="noopener"&gt;Number&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;|&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number" target="_blank" rel="noopener"&gt;Number&lt;/A&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array" target="_blank" rel="noopener"&gt;[]&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;The specified distance(s) for buffering. The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;geometry&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;distance&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;parameters must be specified as either both arrays or both non-arrays. Never specify one as an array and the other a non-array. When using an array of geometries as input, the length of the geometry array does not have to equal the length of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;distance&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;array. For example, if you pass an array of four geometries:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;[g1, g2, g3, g4]&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and an array with one distance:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;[d1], all four geometries will be buffered by the single distance value. If instead you use an array of three distances:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;[d1, d2, d3],&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;g1&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;will be buffered by&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;d1,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;g2&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;by&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;d2, and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;g3&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;g4&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;will both be buffered by&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;d3. The value of the geometry array will be matched one to one with those in the distance array until the final value of the distance array is reached, in which case that value will be applied to the remaining geometries.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;</description>
    <pubDate>Thu, 07 Dec 2023 22:01:10 GMT</pubDate>
    <dc:creator>JeffreyThompson2</dc:creator>
    <dc:date>2023-12-07T22:01:10Z</dc:date>
    <item>
      <title>Undefined SpatialReference</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358268#M83060</link>
      <description>&lt;P&gt;So I want to create a buffer around addresses (received via user upload) and extract aggregated data for them but I'm getting issues around the geometry() in BufferGeom(). Could someone please help me understand and resolve this issue?&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;            const address_geo = []

            document.getElementById("download-button").onclick = () =&amp;gt; {
              var fileInput = document.getElementById('fileInput');
              var file = fileInput.files[0];
              if (file) {
                var reader = new FileReader();

                reader.onload = function (e) {
                  var data = e.target.result;
                  var workbook = XLSX.read(data, { type: 'binary' });
                  var sheetName = workbook.SheetNames[0];
                  var sheet = workbook.Sheets[sheetName];

                  var dataArray = XLSX.utils.sheet_to_json(sheet, { header: 1 });
                  list_address = dataArray.flat()
                  const geocode = "https://geocode-api.arcgis.com/arcgis/rest/services/World/GeocodeServer";
                  for (var i = 0; i &amp;lt; list_address.length; i++) {
                    const addressinput = list_address[i]
                    const params = {
                      address: {
                        address: addressinput,
                      },
                      countryCode: "CAN",
                    };
                    locator.addressToLocations(geocode, params).then((results) =&amp;gt; {
                      showResult(results);
                    });
                    function showResult(results) {
                      if (results.length) {
                        const result = results[0];
                        uniqueAddressID2.push(result.address);

                        const point = new Graphic({
                        symbol: {
                          type: "simple-marker",
                          style: "circle",
                          size: "16px",
                          color: [70, 90, 141, 0.4],
                        },
                        geometry: result.location,
                        attributes: {
                          title: "Address",
                          address: result.address,
                          score: result.score,
                        },
                      });
                      address_geo.push(point)

                      }
                    };
                  }
                  BufferGeom(address_geo)
                };
                reader.readAsBinaryString(file);
              } else {
                alert('Please select a file.');
              }
            }
            function BufferGeom(geo_points) {
              var d = document.getElementById("distance");
              const buffGeoms = geometryEngine.geodesicBuffer(
                geo_points,
                d.value,
                "kilometers"
              );
              buffGeoms.forEach((buffGeom) =&amp;gt; {
                const buffgra = new Graphic({
                  geometry: buffGeom,
                  symbol: {
                    type: "simple-fill",
                    color: [112, 128, 144, 0],
                  },
                });
              });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Charan_0-1701980882235.png" style="width: 450px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/88409i4B85C16C95FCC586/image-dimensions/450x72?v=v2" width="450" height="72" role="button" title="Charan_0-1701980882235.png" alt="Charan_0-1701980882235.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 20:46:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358268#M83060</guid>
      <dc:creator>Charan</dc:creator>
      <dc:date>2023-12-07T20:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined SpatialReference</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358274#M83061</link>
      <description>&lt;P&gt;I think you need to explicitly load the projection. Try wrapping projection.load() around your call to the BufferGeom function. Something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;projection.load().then(() =&amp;gt; {
 BufferGeom(address_geo)
})&lt;/LI-CODE&gt;&lt;P&gt;You will also need to load projection into your imports if you haven't already.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-projection.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 20:48:21 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358274#M83061</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2023-12-07T20:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined SpatialReference</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358282#M83062</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/677423"&gt;@JeffreyThompson2&lt;/a&gt;&amp;nbsp;I added the above code and it is still giving me the same error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 21:07:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358282#M83062</guid>
      <dc:creator>Charan</dc:creator>
      <dc:date>2023-12-07T21:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined SpatialReference</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358290#M83063</link>
      <description>&lt;P&gt;What projection are you working in? geodesicBuffer only works in WGS84 or Web Mercator.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN&gt;This method only works with WGS84 (wkid: 4326) and&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-SpatialReference.html#isWebMercator" target="_blank"&gt;Web Mercator&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;spatial references. In general, if your input geometries are assigned one of those two spatial references, you should always use geodesicBuffer() to obtain the most accurate results for those geometries. If needing to buffer points assigned a&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/rest/services-reference/enterprise/using-spatial-references.htm" target="_blank" rel="noopener"&gt;projected coordinate system other than Web Mercator&lt;/A&gt;&lt;SPAN&gt;, use&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#buffer" target="_blank"&gt;buffer()&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;instead. If the input geometries have a geographic coordinate system other than WGS84 (wkid: 4326), use&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-geometryService.html#buffer" target="_blank"&gt;geometryService.buffer()&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#geodesicBuffer" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#geodesicBuffer&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 21:18:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358290#M83063</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2023-12-07T21:18:03Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined SpatialReference</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358300#M83064</link>
      <description>&lt;P&gt;I used WKID 4326 as the spatial reference for the point as well as during projection.load()&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 21:33:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358300#M83064</guid>
      <dc:creator>Charan</dc:creator>
      <dc:date>2023-12-07T21:33:46Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined SpatialReference</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358315#M83065</link>
      <description>&lt;P&gt;Calling projection.project() that way will re-project the points in address_geo, not the basemap.&lt;/P&gt;&lt;P&gt;Have you console logged geo_points and d.value? Are they properly defined?&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 21:40:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358315#M83065</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2023-12-07T21:40:36Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined SpatialReference</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358317#M83066</link>
      <description>&lt;P&gt;When i do console.log(d.value) I get a number and console.log(geo_points) i get:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Charan_0-1701985812361.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/88422i90BA539E160E9EBE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Charan_0-1701985812361.png" alt="Charan_0-1701985812361.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Dec 2023 21:50:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358317#M83066</guid>
      <dc:creator>Charan</dc:creator>
      <dc:date>2023-12-07T21:50:22Z</dc:date>
    </item>
    <item>
      <title>Re: Undefined SpatialReference</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358331#M83067</link>
      <description>&lt;P&gt;I think I have found the problem. Your points are an array and the distance is a single value. That is not allowed.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;geometry&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html" target="_blank" rel="noopener"&gt;Geometry&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;|&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Geometry.html" target="_blank" rel="noopener"&gt;Geometry&lt;/A&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array" target="_blank" rel="noopener"&gt;[]&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;The buffer input geometry. The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;geometry&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;distance&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;parameters must be specified as either both arrays or both non-arrays. Never specify one as an array and the other a non-array.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;&lt;DIV class=""&gt;&lt;SPAN class=""&gt;distance&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;SPAN class=""&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number" target="_blank" rel="noopener"&gt;Number&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;|&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number" target="_blank" rel="noopener"&gt;Number&lt;/A&gt;&lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array" target="_blank" rel="noopener"&gt;[]&lt;/A&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;P&gt;The specified distance(s) for buffering. The&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;geometry&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;distance&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;parameters must be specified as either both arrays or both non-arrays. Never specify one as an array and the other a non-array. When using an array of geometries as input, the length of the geometry array does not have to equal the length of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;distance&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;array. For example, if you pass an array of four geometries:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;[g1, g2, g3, g4]&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and an array with one distance:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;[d1], all four geometries will be buffered by the single distance value. If instead you use an array of three distances:&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;[d1, d2, d3],&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;g1&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;will be buffered by&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;d1,&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;g2&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;by&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;d2, and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;g3&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;g4&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;will both be buffered by&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;d3. The value of the geometry array will be matched one to one with those in the distance array until the final value of the distance array is reached, in which case that value will be applied to the remaining geometries.&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;</description>
      <pubDate>Thu, 07 Dec 2023 22:01:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/undefined-spatialreference/m-p/1358331#M83067</guid>
      <dc:creator>JeffreyThompson2</dc:creator>
      <dc:date>2023-12-07T22:01:10Z</dc:date>
    </item>
  </channel>
</rss>

