<?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 polygon that holds a series of points in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033425#M71945</link>
    <description>&lt;P&gt;Good catch but unfortunately that doesn't solve my problem.&amp;nbsp; It still isnt' showing the polygon when I change it to:&lt;/P&gt;&lt;P&gt;var polySymbol = {&lt;BR /&gt;type: "simple-fill",&lt;BR /&gt;color: [ 255, 99, 71, 0.85 ],&lt;BR /&gt;outline: {&lt;BR /&gt;color: "white",&lt;BR /&gt;width: .5&lt;BR /&gt;}};&lt;/P&gt;</description>
    <pubDate>Fri, 05 Mar 2021 16:20:22 GMT</pubDate>
    <dc:creator>FrankLaFone</dc:creator>
    <dc:date>2021-03-05T16:20:22Z</dc:date>
    <item>
      <title>Create polygon that holds a series of points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033252#M71941</link>
      <description>&lt;P&gt;I'm trying to create a polygon that shows the extent of a series of points.&amp;nbsp; I have a series of addresses and can get back the centroids for the points.&amp;nbsp; All I really want is a polygon that represents the area of those points (technically plus a small buffer).&amp;nbsp; Then I want to add that polygon to the view, but not add the points.&amp;nbsp; I can add the points ok and the constructed polygon looks ok as far as it's object properties, but it just won't show up on the view.&amp;nbsp; Anyone have any ideas what I'm doing wrong here? (code below)&lt;/P&gt;&lt;P&gt;var points = [];&lt;BR /&gt;for(let i=0;i&amp;lt;results.features.length;i++){&lt;BR /&gt;points.push(results.features[i].geometry.centroid);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;var polylineSymbol = {&lt;BR /&gt;type: "simple-line", // autocasts as SimpleLineSymbol()&lt;BR /&gt;color: [226, 119, 40],&lt;BR /&gt;width: 4&lt;BR /&gt;};&lt;BR /&gt;var areaPolygon = new Polygon();&lt;BR /&gt;areaPolygon.addRing(points);&lt;BR /&gt;&lt;BR /&gt;var polylineGraphic = new Graphic({&lt;BR /&gt;geometry: areaPolygon,&lt;BR /&gt;symbol: polylineSymbol,&lt;BR /&gt;});&lt;BR /&gt;App.policyView.graphics.add(polylineGraphic);&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 04:31:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033252#M71941</guid>
      <dc:creator>FrankLaFone</dc:creator>
      <dc:date>2021-03-05T04:31:01Z</dc:date>
    </item>
    <item>
      <title>Re: Create polygon that holds a series of points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033417#M71944</link>
      <description>&lt;P&gt;Hi there,&lt;/P&gt;&lt;P&gt;Looks like you are assigning SimpleLineSymbol to a polygon graphic. You should assign &lt;A href="https://next.sites.afd.arcgis.com/javascript/latest/api-reference/esri-symbols-SimpleFillSymbol.html" target="_self"&gt;SimpleFillSymbol&lt;/A&gt; to your polygon graphic.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 16:15:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033417#M71944</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2021-03-05T16:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Create polygon that holds a series of points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033425#M71945</link>
      <description>&lt;P&gt;Good catch but unfortunately that doesn't solve my problem.&amp;nbsp; It still isnt' showing the polygon when I change it to:&lt;/P&gt;&lt;P&gt;var polySymbol = {&lt;BR /&gt;type: "simple-fill",&lt;BR /&gt;color: [ 255, 99, 71, 0.85 ],&lt;BR /&gt;outline: {&lt;BR /&gt;color: "white",&lt;BR /&gt;width: .5&lt;BR /&gt;}};&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 16:20:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033425#M71945</guid>
      <dc:creator>FrankLaFone</dc:creator>
      <dc:date>2021-03-05T16:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: Create polygon that holds a series of points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033592#M71950</link>
      <description>&lt;P&gt;Try setting the polygon geometry's spatialReference. By default, the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-Polygon.html#spatialReference" target="_self"&gt;Graphic's spatialReference&lt;/A&gt; is WGS84. You may also have to check if your polygon is a simple polygon. If it is not then you have to simplify it. Here is a simple test app that add polygon from points.&lt;/P&gt;&lt;P&gt;&lt;A href="https://codepen.io/U_B_U/pen/JjbaoqR?editors=100" target="_blank"&gt;https://codepen.io/U_B_U/pen/JjbaoqR?editors=100&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Hope this helps,&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 20:50:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033592#M71950</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2021-03-05T20:50:41Z</dc:date>
    </item>
    <item>
      <title>Re: Create polygon that holds a series of points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033627#M71953</link>
      <description>&lt;P&gt;Any other ideas?&amp;nbsp; It looks like the graphic is being constructed and is adding to my view, but it doesn't show up.&amp;nbsp; I can put the points in there without any issues so I know the graphics layer is working, just not this polygon.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 22:41:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033627#M71953</guid>
      <dc:creator>FrankLaFone</dc:creator>
      <dc:date>2021-03-05T22:41:27Z</dc:date>
    </item>
    <item>
      <title>Re: Create polygon that holds a series of points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033646#M71955</link>
      <description>&lt;P&gt;Sounds like you might be looking to create the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-geometry-geometryEngine.html#convexHull" target="_self"&gt;convex hull&lt;/A&gt; around a set of points?&amp;nbsp; Maybe something similar to this might work for your needs:&amp;nbsp;&lt;A href="https://codepen.io/john-grayson/pen/NWbLGaR" target="_blank" rel="noopener"&gt;https://codepen.io/john-grayson/pen/NWbLGaR&amp;nbsp;&lt;/A&gt;If not, maybe you could provide a CodePen using your data so we can see what might be going on?&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 23:40:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1033646#M71955</guid>
      <dc:creator>JohnGrayson</dc:creator>
      <dc:date>2021-03-05T23:40:28Z</dc:date>
    </item>
    <item>
      <title>Re: Create polygon that holds a series of points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1034017#M71963</link>
      <description>&lt;P&gt;That didn't work either.&amp;nbsp; The hullGraphic seems to be getting populated but the graphic never shows itself on the view.&amp;nbsp; I can't seem to get a Codepen working correctly because the application currently uses a localized CSV file for an important step before this graphic gets generated.&amp;nbsp; However, here is the relevant function:&lt;/P&gt;&lt;P&gt;Note that below the code, errr... below, I have copied the code that just puts the points on the map.&amp;nbsp; It works fine.&amp;nbsp; But if I swap it out for the convex hull it does not.&amp;nbsp; Ideally I'd like to have both.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;makePolicyExtentMap: function(LandUseCodes, countyCode){&lt;BR /&gt;console.log("Land Use Codes: "+LandUseCodes);&lt;BR /&gt;&lt;BR /&gt;var queryTask = new QueryTask({&lt;BR /&gt;url: "&lt;A href="https://services.wvgis.wvu.edu/arcgis/rest/services/Planning_Cadastre/WV_Parcels/MapServer/11" target="_blank"&gt;https://services.wvgis.wvu.edu/arcgis/rest/services/Planning_Cadastre/WV_Parcels/MapServer/11&lt;/A&gt;"&lt;BR /&gt;});&lt;BR /&gt;var query = new Query();&lt;BR /&gt;query.returnGeometry = true;&lt;BR /&gt;query.outFields = ["*"];&lt;BR /&gt;query.where = "LandUseCode="+ LandUseCodes + " AND CountyCode="+ countyCode;&lt;BR /&gt;&lt;BR /&gt;queryTask.execute(query).then(function(results){&lt;BR /&gt;//console.log(results.features);&lt;BR /&gt;&lt;BR /&gt;var parcelIDResults = [];&lt;BR /&gt;for(let i=0;i&amp;lt;results.features.length;i++){&lt;BR /&gt;parcelIDResults.push(results.features[i].attributes["CleanParcelID"]);&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;console.log(parcelIDResults.length);&lt;BR /&gt;&lt;BR /&gt;var parcelIDS = "";&lt;BR /&gt;for(let j=0;j&amp;lt;results.features.length;j++){&lt;BR /&gt;parcelIDS += "'"+parcelIDResults[j]+"',";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;parcelIDS = parcelIDS.substring(0, parcelIDS.length - 1);&lt;BR /&gt;&lt;BR /&gt;var queryTask = new QueryTask({&lt;BR /&gt;url: "&lt;A href="https://services.wvgis.wvu.edu/arcgis/rest/services/Planning_Cadastre/WV_Parcels/MapServer/0" target="_blank"&gt;https://services.wvgis.wvu.edu/arcgis/rest/services/Planning_Cadastre/WV_Parcels/MapServer/0&lt;/A&gt;"&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;var parcelsQuery = new Query();&lt;BR /&gt;parcelsQuery.returnGeometry = true;&lt;BR /&gt;parcelsQuery.outFields = ["*"];&lt;BR /&gt;parcelsQuery.where = "CleanParcelID IN ("+parcelIDS+")";&lt;BR /&gt;&lt;BR /&gt;queryTask.execute(parcelsQuery).then(function(results){&lt;BR /&gt;&lt;BR /&gt;const points = new Multipoint({&lt;BR /&gt;spatialReference: App.policyView.spatialReference,&lt;BR /&gt;points: results.features.map(feature =&amp;gt; {&lt;BR /&gt;return [&lt;BR /&gt;feature.geometry.centroid.x,&lt;BR /&gt;feature.geometry.centroid.y&lt;BR /&gt;];&lt;BR /&gt;})&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;// CONVEXHULL //&lt;BR /&gt;const hullPolygon = geometryEngine.convexHull(points);&lt;BR /&gt;const hullGraphic = new Graphic({&lt;BR /&gt;geometry: hullPolygon,&lt;BR /&gt;symbol: {&lt;BR /&gt;type: 'simple-fill',&lt;BR /&gt;color: 'transparent',&lt;BR /&gt;outline: { color: 'red', width: 1.8 }&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;console.log(hullGraphic);&lt;BR /&gt;App.policyView.graphics.add(hullGraphic);&lt;BR /&gt;&lt;BR /&gt;});&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;THIS IS THE WORKING POINT ONE&lt;BR /&gt;&lt;BR /&gt;const simpleMarkerSymbol = {&lt;BR /&gt;type: "simple-marker",&lt;BR /&gt;//color: [ 20, 130, 200, 0.5 ],&lt;BR /&gt;color: [ 255, 99, 71, 0.85 ],&lt;BR /&gt;outline: {&lt;BR /&gt;color: "white",&lt;BR /&gt;width: 1&lt;BR /&gt;},&lt;BR /&gt;};&lt;BR /&gt;results.features.map((feature) =&amp;gt; {&lt;BR /&gt;feature.symbol = simpleMarkerSymbol;&lt;BR /&gt;return feature;&lt;BR /&gt;});&lt;BR /&gt;App.policyView.graphics.removeAll();&lt;BR /&gt;&lt;BR /&gt;// Add features to graphics layer&lt;BR /&gt;App.policyView.graphics.addMany(results.features);&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 17:14:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1034017#M71963</guid>
      <dc:creator>FrankLaFone</dc:creator>
      <dc:date>2021-03-08T17:14:03Z</dc:date>
    </item>
    <item>
      <title>Re: Create polygon that holds a series of points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1034104#M71971</link>
      <description>&lt;P&gt;Could you maybe create a CodePen where a few of the locations from the csv are created manually?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 19:19:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1034104#M71971</guid>
      <dc:creator>JohnGrayson</dc:creator>
      <dc:date>2021-03-08T19:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Create polygon that holds a series of points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1034110#M71973</link>
      <description>&lt;P&gt;&lt;A href="https://codepen.io/flafone/pen/ExNdQEy" target="_blank"&gt;https://codepen.io/flafone/pen/ExNdQEy&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hopefully that works...&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 19:33:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1034110#M71973</guid>
      <dc:creator>FrankLaFone</dc:creator>
      <dc:date>2021-03-08T19:33:08Z</dc:date>
    </item>
    <item>
      <title>Re: Create polygon that holds a series of points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1034136#M71975</link>
      <description>&lt;P&gt;You need to make sure you're returning the geometries from your query in the correct spatial reference or you'll subsequently be creating geometries with a defined spatial reference different than the coordinates themselves.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;parcelsQuery.outSpatialReference = App.policyView.spatialReference;       &lt;/LI-CODE&gt;&lt;P&gt;&lt;A href="https://codepen.io/john-grayson/pen/eYBPMgv" target="_blank"&gt;https://codepen.io/john-grayson/pen/eYBPMgv&lt;/A&gt;&lt;/P&gt;&lt;P&gt;I hope this helps...&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 20:23:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1034136#M71975</guid>
      <dc:creator>JohnGrayson</dc:creator>
      <dc:date>2021-03-08T20:23:13Z</dc:date>
    </item>
    <item>
      <title>Re: Create polygon that holds a series of points</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1034153#M71977</link>
      <description>&lt;P&gt;That did it!&amp;nbsp; Although... I now know "Convex Hull" isn't what I want.&amp;nbsp; But at least graphics are showing up again.&amp;nbsp; I don't know why it works with points but not polygons but... eh, I'm not going to lose too much sleep over it.&amp;nbsp; Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Mon, 08 Mar 2021 20:51:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/create-polygon-that-holds-a-series-of-points/m-p/1034153#M71977</guid>
      <dc:creator>FrankLaFone</dc:creator>
      <dc:date>2021-03-08T20:51:45Z</dc:date>
    </item>
  </channel>
</rss>

