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.

Re: Add labels to map

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

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Add labels to map

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");

Re: Add labels to map

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.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Add labels to map

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?

Re: Add labels to 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.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Add labels to map

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.

Re: Add labels to map

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.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Add labels to map

Thanks for the feedback.