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
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
Mihkel,
Custom graphic types are not supported by the esri print task.
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,
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.
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
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