Hi,
I could somehow add arrows to the lines. But when I zoom in zoom out, the arrow positions keep changing. How to handle this?
Jason,
You need to use the unicode representation: '\u25BC'
Thanks for the reply, Robert!
So does this mean that all the graphics that I want to print had to be disguised as some type of ESRI symbols? Would it make sense to convert the SVG paths to PNG data URIs and then to ESRI's PictureMarkerSymbols? Are there any other possible workarounds?
Thanks,
Mihkel
Mihkel,
Custom graphic types are not supported by the esri print task.
Hi Nick,
Thank you so much for sharing your code on directional line symbols! I've been using your approach for some custom graphics of my own and it's been working super good for me.
But when using the graphics in an Web AppBuilder app, I discovered that I can't print the graphics with the Print widget. It either ends up throwing an error (for your DirectionalLine grahics) or just prints the basemap (for my graphics). I guess it has something to do with the way the additional paths are added to the map/graphicslayers.
Do you have any idea what might be causing this issue and how to resolve it? I'd be really thankful.
Hi guys,
I know this is super old - I've been using A R's solution for a while, which works great, thanks! Eventually needed some more flexibility and wanted to create symbols with direction in a single class - so created a custom line symbol to handle this. On github here:
nickcam/DirectionalLineSymbol · GitHub
It may help.
Nick
//text symbol// var arrow = function(pt1,pt2){ return new esri.symbol.TextSymbol({ text : "�?�", angle: setAngle(pt1, pt2), type: "esriTS", color: new dojo.Color([0,0,255,0.5]), font: { size: 13, style: 'normal', type: 'font', variant: "normal", weight: "normal", family: "Lucida Grande Console" } }); };
//grab points// //loop over the points on your line// for(var x in "[linename]".geometry.paths[0]){ var pt1 = "[linename]".geometry.paths[0]; var pt2 = "[linename]".geometry.paths[0][x-1]; var point = new esri.geometry.Point(pt1); var arrowGraphic = new esri.Graphic(point, arrow(pt1,pt2));
//angle function// var setAngle = function (p1, p2){ var rise = p2[1] - p1[1]; var run = p2[0] - p1[0]; var angle = ((180/Math.PI) * Math.atan2(run, rise)) return angle-180; }
I was hopping for something simple that I might have overlooked. Like an arrow line style.
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.