Topic: Add labels to map
Any inputs on the simplest way to add labels - not associated to markers - to a couple map coordinates? The labels should scale up/down according to the zoom levels.
You are not logged in. Please login or register.
Infinity Code Forum → Online Maps Help → Add labels to map
Any inputs on the simplest way to add labels - not associated to markers - to a couple map coordinates? The labels should scale up/down according to the zoom levels.
Hello.
You have several ways:
1. Make your labels as 2D or 3D markers that will contain your text as an image.
2. Use TextMeshPro to display text.
In this case, you must use 3D markers, or position these GameObjects manually.
http://infinity-code.com/doxygen/online … 953048d3d6
3. Use UI to display text.
How to position UI elements:
http://infinity-code.com/atlas/online-m … ample.html
For option #3, in the script from the suggested page, could you specify the source for the values of (1, 1) and (2, 2) in the following two lines:
OnlineMapsMarkerManager.CreateItem(new Vector2(1, 1), "Marker 2");
OnlineMapsMarkerManager.CreateItem(new Vector2(2, 1), "Marker 3");
Unfortunately, I did not understand your question.
Initially, you mentioned that labels are not associated to markers, but here you create markers.
Please rephrase this in more detail.
We thought the code from the link for option #3 was for adding the labels. Would there be a sample script for adding labels to the map?
I already gave you a link to an example in post 2.
In this case, you are interested in lines 47-52, which show how to convert geographic coordinates to a local position on canvas.
Thanks. Please could you confirm if these are the lines (47-52) that position the label on top of the map, so when panning/zooming the map the label changes position/size accordingly.
These lines will update the label position when changing location and zoom if you will use them in the right places.
What do I mean by “right place”:
Inside the method that will be called on certain events.
For example (one of):
OnlineMaps.OnMapUpdated, OnlineMaps.OnUpdateLate, OnlineMaps.OnChangePosition + OnlineMaps.OnChangeZoom, MonoBehaviour.Update, MonoBehaviour.LateUpdate.
The example above uses OnlineMaps.OnUpdateLate.
Thanks for the feedback.
Infinity Code Forum → Online Maps Help → Add labels to map
Powered by PunBB, supported by Informer Technologies, Inc.