<?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 Survey123 Arcade Expression join multiple polylines in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-arcade-expression-join-multiple/m-p/1063320#M34951</link>
    <description>&lt;P&gt;Hi All&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create an arcade expression that returns a URL to populate a survey123 form with a single path from numerous polylines with a common attribute, ordered by a segment id field. so basically I have multiple polylines to be converted into one long polyline and to be passed it into the survey123 form.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var mainTable= OrderBy(FeatureSetByPortalItem(Portal('https://tlilimerick.maps.arcgis.com/'),'xxxxxxxxx', 0),'Segment')
var Job = $feature.Job
var SQL1 = 	"Job='" + Job+"'"
var Polylines_in_Job = OrderBy(filter(Fibre,SQL1),'Segment')
var i = 0

for (var f in Fibre_Job) {
geom[i++] = Geometry(f);

}

return geom&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the code above returns an array with the exact number of polyline objects required in it&amp;nbsp; and normally&amp;nbsp; I have no problem passing a single polyline in on it s own I just can t figure out how to access every vertex in each polyline and generating a new string to include in the URL. I got it to work for start and end points but that's not exactly what I want. I also realised i needed the order to be correct or else it would be a nonsensical line ,so I added a segment id to be prepopulated by the user to inform the desired route. 1,2,3 etc&amp;nbsp; &amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp; would you be able to assist with this one?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 31 May 2021 16:19:29 GMT</pubDate>
    <dc:creator>PaulSweeney3</dc:creator>
    <dc:date>2021-05-31T16:19:29Z</dc:date>
    <item>
      <title>Survey123 Arcade Expression join multiple polylines</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-arcade-expression-join-multiple/m-p/1063320#M34951</link>
      <description>&lt;P&gt;Hi All&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to create an arcade expression that returns a URL to populate a survey123 form with a single path from numerous polylines with a common attribute, ordered by a segment id field. so basically I have multiple polylines to be converted into one long polyline and to be passed it into the survey123 form.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var mainTable= OrderBy(FeatureSetByPortalItem(Portal('https://tlilimerick.maps.arcgis.com/'),'xxxxxxxxx', 0),'Segment')
var Job = $feature.Job
var SQL1 = 	"Job='" + Job+"'"
var Polylines_in_Job = OrderBy(filter(Fibre,SQL1),'Segment')
var i = 0

for (var f in Fibre_Job) {
geom[i++] = Geometry(f);

}

return geom&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;the code above returns an array with the exact number of polyline objects required in it&amp;nbsp; and normally&amp;nbsp; I have no problem passing a single polyline in on it s own I just can t figure out how to access every vertex in each polyline and generating a new string to include in the URL. I got it to work for start and end points but that's not exactly what I want. I also realised i needed the order to be correct or else it would be a nonsensical line ,so I added a segment id to be prepopulated by the user to inform the desired route. 1,2,3 etc&amp;nbsp; &amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp; would you be able to assist with this one?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 16:19:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-arcade-expression-join-multiple/m-p/1063320#M34951</guid>
      <dc:creator>PaulSweeney3</dc:creator>
      <dc:date>2021-05-31T16:19:29Z</dc:date>
    </item>
    <item>
      <title>Re: Survey123 Arcade Expression join multiple polylines</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-arcade-expression-join-multiple/m-p/1063333#M34954</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363822"&gt;@PaulSweeney3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;It is possible to use a union to merge geometries into a single geometry, but normally with lines, this will result in a multipart geometry. If that is not a problem, you should probably use this option.&lt;/P&gt;&lt;P&gt;You can also access the individual vertices and create a single polyline. This challenge will be to get the lines in the right order and make sure that each individual line is captured in the same direction to avoid obtaining weird lines.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know in what direction you want to go.&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 17:45:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-arcade-expression-join-multiple/m-p/1063333#M34954</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-05-31T17:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: Survey123 Arcade Expression join multiple polylines</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-arcade-expression-join-multiple/m-p/1063374#M34957</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/1108"&gt;@XanderBakker&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The union tool seems like it does the trick,&amp;nbsp; i ve pieced together this code thanks for that&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;var mainTable= xxx
var Job = $feature.Job
var SQL1 = 	"Job='" + Job+"'"
var Fibre_Job = OrderBy(filter(mainTable,SQL1),'Segment')
var i = 0
var geom = []
for (var f in Fibre_Job) {
geom[i++] = Geometry(f);

}

var merge = Union(geom)
var  i = 0 
var outparts = []
for(var f in merge.paths[i]) {
    var e= 0
    var ptstr=Concatenate(merge.paths[e][i].y," ",merge.paths[e][i].x)
    TotalPoly[i++]= ptstr;
}

return Concatenate(TotalPoly, ";");&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for my own education id love to see how you would have managed the second option you mentioned above. You can see from my code I used ordered by and I have a 'segment' field for the end user to populate to specify the order he polyline would follow. This will help&amp;nbsp;&lt;SPAN&gt;to get the lines in the right order. The lines are already captured in the correct direction.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Also is there a limit to how long a URL can be? as some of these segments are quite long . if its the&amp;nbsp;case that they are very long and i cant use them have you any advice on how to minimise the length&amp;nbsp;of the URL&amp;nbsp;while still maintaining the general location of the line maybe only use vertices at a regular defined interval or&amp;nbsp; something along those&amp;nbsp;lines.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Regards&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Paul&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 31 May 2021 20:32:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-arcade-expression-join-multiple/m-p/1063374#M34957</guid>
      <dc:creator>PaulSweeney3</dc:creator>
      <dc:date>2021-05-31T20:32:08Z</dc:date>
    </item>
    <item>
      <title>Re: Survey123 Arcade Expression join multiple polylines</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/survey123-arcade-expression-join-multiple/m-p/1065324#M35082</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/363822"&gt;@PaulSweeney3&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Not sure if this will work, but from what I can deduce from what you did it could be something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var id = $feature.ID;
var sql  = "ID LIKE '" + Left(id, Count(id)-1) + "%'"; // ignore this
var fs = OrderBy(Filter($layer, sql),'ID ASC');

var TotalPoly = [];
var i = 0;
for (var feat in fs) {
    var pnts = Geometry(feat)["paths"][0];
    for (var p in pnts) {
        TotalPoly[i++] = pnts[p].y + " " + pnts[p].x;
    }
}

return Concatenate(TotalPoly, ";"); &lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am sure there must be a limit on the length of the URL, but not sure what it is... You can round the coordinates, but this will affect the precision of the geometry that results.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 04 Jun 2021 21:40:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/survey123-arcade-expression-join-multiple/m-p/1065324#M35082</guid>
      <dc:creator>XanderBakker</dc:creator>
      <dc:date>2021-06-04T21:40:11Z</dc:date>
    </item>
  </channel>
</rss>

