Select to view content in your preferred language

SimpleMarkerSymbol and text symbol at same geometry.

4089
13
Jump to solution
08-15-2018 05:59 AM
ADITYAKUMAR1
Frequent Contributor

Hi Developers,

  I want to have a Circle marker followed by a value geometry location. Right now I am using the below code. But its giving me either of the functionality. Not both at the same time.

var CircleSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CICRLE, 10,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 2),
 new Color([0, 255, 0, 0.25]));
textSymbol = new TextSymbol(stop.attributes.OBJECTID);
textSymbol.setFont(font);
textSymbol.setColor(new Color([255, 255, 255]));

stop.setSymbol(CircleSymbol);
stop.setSymbol(textSymbol);

While I am looking for a style like below.

In case you have any suggestion or solution please share.

Thanks in advance.

Kumar

0 Kudos
13 Replies
ADITYAKUMAR1
Frequent Contributor

Hi Robert, We are using Routetask. To my surprise the code is working perfectly now.

Thanks

Aditya Kumar

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Don't forget to mark this question as answered by clicking on the "Mark Correct" link on the reply that answered your question.

ADITYAKUMAR1
Frequent Contributor

Hi Robert,

 

This the routing result i am getting. Once I grad the 2 stops out of the map extent and bring them back, you can see the text symbol changes its position.

i am using the route task here,

function showRoute(evt) {

routes = [];
if (evt.result && evt.result.routeResults) {

//**//*** To plot the route with route symbol **//
array.forEach(evt.result.routeResults, function (routeResult, i) {

routes.push(graphics.add(routeResult.route.setSymbol(routeSymbol)));
//routes.push(graphics.add(routeResult.stops.setSymbol(circle)));
if (routeResult.stops) {
for (var i = 1; i <= stops.length; i++) {
array.forEach(stops, function (stop) {
if (stop.attributes.OBJECTID == i) {
var symbol = new PictureMarkerSymbol(xxxxx+ "Images/marker/inspection-map-markers-no-status.png", 20, 20).setOffset(0, 0);
var newGraphic = new Graphic(stop.toJson());
newGraphic.setSymbol(symbol);
graphics.add(newGraphic);

textSymbol = new TextSymbol(stop.attributes.OBJECTID);
textSymbol.setFont(font);
textSymbol.setColor(new Color([255, 0, 0]));
//textSymbol.setAlign(TextSymbol.ALIGN_START);
// textSymbol.setAngle(360);
textSymbol.setOffset(5, 5)
stop.setSymbol(textSymbol);

}
});
}
}

Any suggestion why its performing in this way.Please share.

Thanks

Aditya Kumar 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Aditya,

  Same thing I said before. Right now you are adding the circles then setting the stops symbol as the text. Instead add the circle as the stop symbol and then add the text after.