Select to view content in your preferred language

Arrow heads on lines

16172
16
09-24-2012 11:31 AM
FredHejazi
Occasional Contributor
Does anyone know how to create arrow heads on lines.  More specifically, a line with intermittent arrows.  This is a line that is output from a route.  So, the arrows would help the person determine the direction of travel for the route. 

Someone else posted the same question, then apparently figured it out.  But there is no additional information. 

Thanks
16 Replies
NickCameron2
Regular Contributor

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.

Thanks,

Nick

MihkelMänna
Frequent Contributor

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.

Mihkel

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Mihkel,

   Custom graphic types are not supported by the esri print task.

0 Kudos
MihkelMänna
Frequent Contributor

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

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Mihkel,

   Graphics are converted to json when they are sent to the print service and the print service attempts to draw these graphics on the map server side so all the graphics have to be in some format that the server understands (i.e standard graphics). Using a custom graphics type like Nick's will cause an error as the server does not know how to handle it. You would have to sent all standard graphics like a simple line with a point graphic for the arrow head using the lines beginning point as the geometry and assign the proper rotation to the point using math calculations for the line angle. I believe that a comment was made on the other thread you are following and some code provided that should work.

0 Kudos
NickCameron2
Regular Contributor

Hi Mihkel,

I never tested it with the print widget...I'm not surprised it doesn't work actually.

Will take a look, it's something I may need soon as well - won't be able to for a couple of weeks though unfortunately.

If you raise an issue on the github page describing the problem, that would be helpful...mainly as a reminder to take a look :).

Thanks,

Nick

0 Kudos
NickCameron2
Regular Contributor

Hi Mikhel,

Have updated the github repo. It should be working ok now. Just refactored to use standard SimpleMarkerSymbols for the directional symbols with custom paths. Alternatively you can pass in you're own SimpleMarkerSymbol or PictureMarkerSymbol as part of the constructor options.

Had to override some toJson methods to keep the print task happy as well.

Thanks,

Nick