- Create a marker that contains the required text. The following lines of code demonstrates it
How can I display text and a legend on a web map
4 次查看(过去 30 天)
显示 更早的评论
I use webmap to display logged vehicle data on a map, sometimes color-coded to visualize a third dimension, such as speed or fuel consumption or track inclination. I really would like to display descriptive text and a legend explaining the color.
Question 1: Is there a way to place text right on the webmap?
I know that I can add information to both a wmline and a wmmarker but that required the user to click on the entity in order to display the text.
Question 2: Is there a way to force the wmline/wmmarker to always display the description balloon from the get-go, i.e. without the user first having to click at the right place? Perhaps the marker can be addressed through some Java voodoo?
0 个评论
回答(1 个)
Kiran Felix Robert
2020-10-8
Hi Reno,
The following workarounds can be used, but each have its own limitations:
wm = webmap('World Imagery');
A = 255*ones(64,128,1,'uint8'); % Or use your current marker You can also use geographic coordinates
RGB = insertText(A,[1,20],'<Text-to-be-Added>','TextColor','black','BoxColor','white','Font','LucidaSansDemiBold');
imwrite(RGB,'testfile.png');
wmmarker(42,-73,'Icon','testfile.png','IconScale',2)
Or
2. Write the webmap to a file using ‘wmprint’, read the image file and then add text. The downside of this approach is that you will lose all the interaction of webmap.
Kiran Felix Robert
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!