Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I want to mark a point in map and place text near it. I used QgsVertexMarker to mark point .As far as now i am using tool-tip to show text. but i need clean code to show my text on map.

Following code is used to set marker at point A.

QgsVertexMarker * marker = new QgsVertexMarker(mPlugin->iface()->mapCanvas());
marker->setColor(Qt::black);
marker->setIconType(2);
marker->setCenter(A);

I need to display a text near that point . how to do by c++ code?

share|improve this question
    
What did you try at your end? Did you use Google for this? –  Sunil Oct 21 '13 at 10:43
    
Hello Bavani, from your edit, I have now realized that you want to do it by coding. You should edit your question to make clear that you are doing it using Python or C++, and the piece of code that you are using. –  Alexandre Neto Oct 22 '13 at 8:35
    
i want to do by c++ coding. –  Bavani Oct 23 '13 at 4:29
add comment

2 Answers

up vote 1 down vote accepted

If all you want is to add one single placemark at a known place, you can use text Annotations.

enter image description here

Best regards,

Alexandre Neto

share|improve this answer
    
Please see my edit. I want to add point with text dynamically so i cant use text annotation. –  Bavani Oct 22 '13 at 5:39
    
again see my answer only use dynamic text through easy lable creator –  Gerald Oct 22 '13 at 16:29
    
Please see my edit. –  Bavani Oct 23 '13 at 4:31
add comment

I would suggest placing a point at the said co-ordinates by creating a new point layer. then placing a point on the screen (anywhere). Then using "Numerical Vertex Edit" (whilst in edit mode), highligh the point, and enter your coords.

The create label. You will have to have given your layer some attribute in order to create the lable.

share|improve this answer
    
Please see my edit. –  Bavani Oct 23 '13 at 4:32
    
Why re-invent the wheel? Use any of the lable feautres. –  Gerald Oct 23 '13 at 7:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.