Aviv Dinitz February 2016

Adding a label to a Point on map in ArcGIS

I have static points on a map. I use this code to draw them:

point = GeometryEngine.project(longitude, latitude, mapSR); 
pointGraphic = new Graphic(point, symbol);
graphicsLayer.addGraphic(pointGraphic);

The point is drawed on the map.

Now I want to add a label to it - show under the drawn point it's longitude and latitude. I can do it using text adding, but then when I resize the map, the text placement changes. I want to put it like a label - let's say on the bottom right from the point. I want it to be sensitive for zooming, and binded to the Point.

I read about dinamic labels, but it seems very complex for such a simple request.

How can I do this?

Thanks.

Answers


Gary S. February 2016

Individual graphics don't have labels, but you can create two graphics with the same geometry. Use your current symbol for one of them. For the other graphic, use a TextSymbol, calling setOffsetX(float) and setOffsetY(float) to place it the way you want.

Post Status

Asked in February 2016
Viewed 1,253 times
Voted 14
Answered 1 times

Search




Leave an answer