<?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 set offset for a line symbol? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-offset-for-a-line-symbol/m-p/465321#M43064</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can only set offset for Point geometries by means of the graphic object definition.&lt;/P&gt;&lt;P&gt;For the Polyline graphic you could iterate through the line path and specify an offset for each coordinate:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var g = routeLayer.graphics[1];&amp;nbsp; // red line
var offset = 0.0001;&amp;nbsp; // decimal degrees
for (p in g.geometry.paths){
&amp;nbsp; var path = g.geometry.paths
;
&amp;nbsp; for (pnt in path){
&amp;nbsp;&amp;nbsp;&amp;nbsp; var xy = path[pnt];
&amp;nbsp;&amp;nbsp;&amp;nbsp; xy[0] += offset;
&amp;nbsp;&amp;nbsp;&amp;nbsp; xy[1] += offset;
&amp;nbsp; }
}
routeLayer.redraw();&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 20:39:08 GMT</pubDate>
    <dc:creator>FC_Basson</dc:creator>
    <dc:date>2021-12-11T20:39:08Z</dc:date>
    <item>
      <title>How to set offset for a line symbol?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-offset-for-a-line-symbol/m-p/465320#M43063</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have a routing layer with lots of bus route.&amp;nbsp; In order to distinguish the collinear route, I used offset property in arcmap line properties.&amp;nbsp; But how to show the same effect on a web map?&amp;nbsp; Since the route is dynamic solved by route task, it may be not suit to publish a map services.&amp;nbsp; Is there a way to set the symbol of a graphic?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The mapping result in arcmap:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="OffsetLineSymbolInArcMap.png" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/211081_OffsetLineSymbolInArcMap.png" style="width: 620px; height: 443px;" /&gt;&lt;/P&gt;&lt;P&gt;The webmap I've tried:&lt;/P&gt;&lt;P&gt;&lt;IMG alt="MapSymbolOfRouteLine.png" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/211082_MapSymbolOfRouteLine.png" style="width: 620px; height: 388px;" /&gt;&lt;/P&gt;&lt;P&gt;The JS Code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;head&amp;gt;
&amp;nbsp; &amp;lt;title&amp;gt;SymbolForRoute&amp;lt;/title&amp;gt;
&amp;nbsp; &amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;
&lt;SPAN&gt;&amp;nbsp; &amp;lt;link rel="stylesheet" type="text/css" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Flocalhost%2Farcgis_js_api%2Flibrary%2F3.16%2F3.16%2Fesri%2Fcss%2Fesri.css" target="_blank"&gt;http://localhost/arcgis_js_api/library/3.16/3.16/esri/css/esri.css&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&lt;/SPAN&gt;
&amp;nbsp; &amp;lt;style&amp;gt;html, body, #mapDiv, .map.container{padding: 0; margin: 0; height: 100%;}&amp;lt;/style&amp;gt;
&amp;lt;/head&amp;gt;
&amp;nbsp; &amp;lt;div id="mapDiv"&amp;gt;&amp;lt;/div&amp;gt;
&amp;nbsp; &amp;lt;script&amp;gt;var dojoConfig = { parseOnLoad: true };&amp;lt;/script&amp;gt;
&lt;SPAN&gt;&amp;nbsp; &amp;lt;script src="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Flocalhost%2Farcgis_js_api%2Flibrary%2F3.16%2F3.16%2Finit.js" target="_blank"&gt;http://localhost/arcgis_js_api/library/3.16/3.16/init.js&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;
&amp;nbsp; &amp;lt;script&amp;gt;


&amp;nbsp; var map, mapSpatialReference;
&amp;nbsp; var json, graphic, geometry, symbol;
&amp;nbsp; var routeLayer;


&amp;nbsp; require(["esri/map", "esri/geometry/Point", "esri/geometry/Polyline", "esri/geometry/Polygon", "esri/SpatialReference", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/symbols/TextSymbol", "esri/symbols/SimpleFillSymbol", "esri/symbols/Font", "esri/Color", "esri/renderers/UniqueValueRenderer", "esri/layers/GraphicsLayer", "esri/graphic", "esri/urlUtils", "esri/tasks/RouteTask", "esri/tasks/locator", "esri/tasks/RouteParameters", "esri/tasks/NATypes", "esri/tasks/FeatureSet", "esri/graphicsUtils", "esri/toolbars/edit", "esri/geometry/geometryEngine", "dojo/_base/event", "dojo/domReady!"],
&amp;nbsp; function (Map, Point, Polyline, Polygon, SpatialReference, SimpleMarkerSymbol, SimpleLineSymbol, TextSymbol, SimpleFillSymbol, Font, Color, UniqueValueRenderer, GraphicsLayer, Graphic, urlUtils, RouteTask, Locator, RouteParameters, NATypes, FeatureSet, graphicsUtils, Edit, geometryEngine, event) {

&amp;nbsp; Main();


&amp;nbsp; function Main(){
&amp;nbsp; InitLayers();
&amp;nbsp; LoadMap();
&amp;nbsp; };


&amp;nbsp; function InitLayers(){
&amp;nbsp; routeLayer = new GraphicsLayer({id: "routeLayer"});


&amp;nbsp; json = {
&amp;nbsp; "paths": [[[-118.30031412099999,33.971014280000077],[-118.30027129099994,33.967302321000034],[-118.30466853499996,33.967302321000034],[-118.30466853499996,33.96458973600005],[-118.30024273699996,33.96458973600005],[-118.30027129099994,33.959464377000074],[-118.29591687699997,33.959492930000067],[-118.29591687699997,33.958964690000073],[-118.29190986499998,33.958990864000043],[-118.29190986499998,33.957937953000055],[-118.29193960799995,33.957372831000043],[-118.29192771099997,33.957009963000075],[-118.29186227599996,33.956843400000025],[-118.29189796799994,33.949580096000034],[-118.29173735399996,33.949359996000055],[-118.29165407299996,33.949127998000051],[-118.28932814999996,33.949133947000064],[-118.28933409799998,33.950609213000064],[-118.28909615199996,33.950686545000053],[-118.28894148699999,33.950882851000074],[-118.28893553899997,33.951025618000074],[-118.28898312799998,33.951227872000061],[-118.28914374099998,33.951358743000071],[-118.28933409799998,33.951394435000054]]],
&amp;nbsp; "spatialReference": {"wkid": 4326}
&amp;nbsp; };
&amp;nbsp; geometry = new Polyline(json);


&amp;nbsp; symbol = new SimpleLineSymbol().setWidth(8).setColor("#000000");
&amp;nbsp; graphic = new Graphic(geometry, symbol);
&amp;nbsp; routeLayer.add(graphic);


&amp;nbsp; symbol = new SimpleLineSymbol().setWidth(4).setColor("#FF0000");
&amp;nbsp; graphic = new Graphic(geometry, symbol);
&amp;nbsp; routeLayer.add(graphic);






&amp;nbsp; json = {
&amp;nbsp; "paths": [[[-118.28933409799998,33.951394435000054],[-118.28952802399999,33.951327572000025],[-118.28964937699999,33.951252619000059],[-118.28971719199996,33.951181235000035],[-118.28978500599999,33.951002775000063],[-118.28973146799996,33.950813608000033],[-118.28958513099997,33.950681548000034],[-118.28933409799998,33.950609213000064],[-118.28932814999996,33.949133947000064],[-118.29159101499999,33.949128159000054],[-118.29157673999998,33.956834834000063],[-118.29149464899996,33.956874095000046],[-118.29148751099996,33.957038278000027],[-118.29153034099994,33.957959130000063],[-118.29152320199995,33.958976349000068],[-118.29190986499998,33.958990864000043],[-118.29591687699997,33.958964690000073],[-118.30026415199995,33.958962073000066],[-118.30024273699996,33.96458973600005],[-118.30024987599995,33.965497262000042],[-118.30248775899997,33.965482985000051],[-118.30248061999998,33.96458973600005],[-118.30466853499996,33.96458973600005],[-118.30466853499996,33.967302321000034],[-118.30464473999996,33.970906967000076],[-118.30139677599999,33.970914105000077],[-118.30063296899999,33.97094979700006],[-118.30031412099999,33.971014280000077]]],
&amp;nbsp; "spatialReference": {"wkid": 4326}
&amp;nbsp; };
&amp;nbsp; geometry = new Polyline(json);


&amp;nbsp; symbol = new SimpleLineSymbol().setWidth(8).setColor("#000000");
&amp;nbsp; graphic = new Graphic(geometry, symbol);
&amp;nbsp; routeLayer.add(graphic);


&amp;nbsp; symbol = new SimpleLineSymbol().setWidth(4).setColor("#0000FF");
&amp;nbsp; graphic = new Graphic(geometry, symbol);
&amp;nbsp; routeLayer.add(graphic);
&amp;nbsp; };


&amp;nbsp; function LoadMap(){
&amp;nbsp; map = new Map("mapDiv", {
&amp;nbsp; center: [-118.295,33.962],
&amp;nbsp; zoom: 15,
&amp;nbsp; basemap: "streets"
&amp;nbsp; });


&amp;nbsp; map.addLayers([routeLayer]);
&amp;nbsp; };
&amp;nbsp; })
&amp;nbsp; &amp;lt;/script&amp;gt;
&amp;lt;/html&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Environment:&lt;/P&gt;&lt;P&gt;ArcGIS API for Javascript 3.16&lt;/P&gt;&lt;P&gt;ArcGIS Desktop 10.4&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:39:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-offset-for-a-line-symbol/m-p/465320#M43063</guid>
      <dc:creator>LeoDeng</dc:creator>
      <dc:date>2021-12-11T20:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to set offset for a line symbol?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-offset-for-a-line-symbol/m-p/465321#M43064</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think you can only set offset for Point geometries by means of the graphic object definition.&lt;/P&gt;&lt;P&gt;For the Polyline graphic you could iterate through the line path and specify an offset for each coordinate:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var g = routeLayer.graphics[1];&amp;nbsp; // red line
var offset = 0.0001;&amp;nbsp; // decimal degrees
for (p in g.geometry.paths){
&amp;nbsp; var path = g.geometry.paths
;
&amp;nbsp; for (pnt in path){
&amp;nbsp;&amp;nbsp;&amp;nbsp; var xy = path[pnt];
&amp;nbsp;&amp;nbsp;&amp;nbsp; xy[0] += offset;
&amp;nbsp;&amp;nbsp;&amp;nbsp; xy[1] += offset;
&amp;nbsp; }
}
routeLayer.redraw();&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 20:39:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-offset-for-a-line-symbol/m-p/465321#M43064</guid>
      <dc:creator>FC_Basson</dc:creator>
      <dc:date>2021-12-11T20:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to set offset for a line symbol?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-offset-for-a-line-symbol/m-p/465322#M43065</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There is a possible solution at this thread &lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/thread/99067"&gt;How can I offset overlapping lines in Javascript API App?&lt;/A&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/migrated-users/55392"&gt;Brandon Flessner&lt;/A&gt;​ propose this &lt;A href="https://jsfiddle.net/41csdxww/2/" title="https://jsfiddle.net/41csdxww/2/"&gt;ArcGIS JavaScript Offset Lines - JSFiddle&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2016 06:31:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-offset-for-a-line-symbol/m-p/465322#M43065</guid>
      <dc:creator>PanagiotisPapadopoulos</dc:creator>
      <dc:date>2016-07-08T06:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to set offset for a line symbol?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-offset-for-a-line-symbol/m-p/465323#M43066</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;a version with out offset run at every time can be found here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://jsfiddle.net/41csdxww/3/" title="https://jsfiddle.net/41csdxww/3/"&gt;ArcGIS JavaScript Offset Lines - JSFiddle&lt;/A&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2016 08:10:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-set-offset-for-a-line-symbol/m-p/465323#M43066</guid>
      <dc:creator>PanagiotisPapadopoulos</dc:creator>
      <dc:date>2016-07-08T08:10:12Z</dc:date>
    </item>
  </channel>
</rss>

