Select to view content in your preferred language

Showing Label OR TextSymbol in NA RouteResult

738
5
Jump to solution
02-08-2012 09:37 AM
GregoryMeyer
Emerging Contributor
We Currently have a Network Analyst routing application in ArcGIS Server 10 that will return a PictureMarkerSymbol for each barrier along a route. 

Is it possible to call a textsymbol or "label" displaying atop this PictureMarkerSymbol?  We would like to show the ID number (from a feature class) of each barrier in the routing result. 

It looks like it can only return graphics?  Any thoughts would be helpful. 

Thanks!
0 Kudos
1 Solution

Accepted Solutions
derekswingley1
Deactivated User
You would add a new symbol along with the other symbols you're adding. My point graphic performance demo has some code to create text symbols. Specifically:
symbols.text = new esri.symbol.TextSymbol("Text", font, new dojo.Color([128, 0, 0, 1])).setAngle(0).setOffset(0, 0);


The first parameter to the TextSymbol constructor is a string specifying the text to be displayed.

View solution in original post

0 Kudos
5 Replies
derekswingley1
Deactivated User
Is it possible to call a textsymbol or "label" displaying atop this PictureMarkerSymbol?  We would like to show the ID number (from a feature class) of each barrier in the routing result. 


If I understand correctly, you want to put some text above a picture marker symbol? You can use a TextSymbol to do this.

Also, you marked your post as an answer. I'm not sure why you're even allowed to do that (forum software, not your fault) but can you see if you can undo that?
0 Kudos
GregoryMeyer
Emerging Contributor
If I understand correctly, you want to put some text above a picture marker symbol? You can use a TextSymbol to do this.

Also, you marked your post as an answer. I'm not sure why you're even allowed to do that (forum software, not your fault) but can you see if you can undo that?


Thanks for your reply. That's exactly what I'm trying to do. I came across the TextSymbol class but wasn't exactly sure on how to impliment it in the routeresult.
Would it be placed in the esri.symbol.PictureMarkerSymbol code below? Could you provide an example? (new to javascript api).

Thanks again!


var overviewMapDijit = new esri.dijit.OverviewMap({
map: map,
visible: true
});
overviewMapDijit.startup();

routeTask = new esri.tasks.RouteTask(naURL);

//setup the route parameters
routeParams = new esri.tasks.RouteParameters();
routeParams.stops = new esri.tasks.FeatureSet();
routeParams.outSpatialReference = { "wkid": mapWKID };

dojo.connect(routeTask, "onSolveComplete", showRoute);
dojo.connect(routeTask, "onError", errorHandler);

startSymbol = new esri.symbol.PictureMarkerSymbol('images/marker_start.png', 20, 34)
startSymbol.setOffset(0, 14);

stopSymbol = new esri.symbol.PictureMarkerSymbol('images/marker_stop.png', 20, 34)
stopSymbol.setOffset(0, 14);

barrierSymbol = new esri.symbol.PictureMarkerSymbol('images/barrier.png', 30, 46)
barrierSymbol.setOffset(0, 0);

highlightSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 46, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color("#FF00FFFF"), 2), new dojo.Color([0, 255, 0, 0]))

routeSymbol = new esri.symbol.SimpleLineSymbol().setColor(new dojo.Color([0, 0, 255, 0.5])).setWidth(5);
0 Kudos
derekswingley1
Deactivated User
You would add a new symbol along with the other symbols you're adding. My point graphic performance demo has some code to create text symbols. Specifically:
symbols.text = new esri.symbol.TextSymbol("Text", font, new dojo.Color([128, 0, 0, 1])).setAngle(0).setOffset(0, 0);


The first parameter to the TextSymbol constructor is a string specifying the text to be displayed.
0 Kudos
GregoryMeyer
Emerging Contributor
You would add a new symbol along with the other symbols you're adding. My point graphic performance demo has some code to create text symbols. Specifically:
symbols.text = new esri.symbol.TextSymbol("Text", font, new dojo.Color([128, 0, 0, 1])).setAngle(0).setOffset(0, 0);


The first parameter to the TextSymbol constructor is a string specifying the text to be displayed.


Okay, I'll work with this.  Adding it seems to break the initialization of my dropdowns, but this is probably due to my inexperience with the JS api.  

Thanks again!
Greg
0 Kudos
derekswingley1
Deactivated User
Adding it seems to break the initialization of my dropdowns, but this is probably due to my inexperience with the JS api.  

Thanks again!
Greg


Cool, start another thread if you can't get it figured out.
0 Kudos