Topic: Markers
Hello Alex,
I work with markers.I want to get the position of marker and compare it with coordinates of world map.How can I do that so to display marker's label?
Thanks in advandance
John
You are not logged in. Please login or register.
Infinity Code Forum → Online Maps Help → Markers
Hello Alex,
I work with markers.I want to get the position of marker and compare it with coordinates of world map.How can I do that so to display marker's label?
Thanks in advandance
John
Hello.
Use marker.position or marker.GetPosition.
https://infinity-code.com/doxygen/onlin … 20d4968b61
Use OnlineMaps.InMapView.
https://infinity-code.com/doxygen/onlin … 3637fbe9cd
Hello Alex,
I use this to display label but it doesn't work.Where am I wrong? I have placed the script to gameObject.
void Update()
{
if (OnlineMapsControlBase.instance.GetCoords(transform.position) == marker.position)
{
Debug.Log(marker.label);
}
}
1. OnlineMapsControlBase.GetCoords converts screen position to coordinates. If you want to convert world position to coordinates you need to use OnlineMapsTileSetControl.GetCoordsByWorldPosition.
https://infinity-code.com/doxygen/onlin … 1b58011257
2. This condition will never be true.
Both sides must have exactly the same coordinates for this to work, which is nearly impossible.
Please explain in detail what you want to do and I will try to explain how you can achieve it.
I have a player(airplane) which moves on world map. I have placed markers in each capital of countries with label which gives information about countries. I want when player pass above the marker to display label with country information.
Calculate the distance from the airplane to the marker.
If the distance is less than some threshold, you have reached the marker and need to show information.
https://infinity-code.com/atlas/online- … ample.html
How can I do that?I don't understand I'm new in programming.Sorry
Check out the example I sent you the link to.
Line 35 shows how to do this.
OK I read it again and I understand what you mean.I think I have it. Something else how can I do it for all markers?
Thanks in advantage
Unfortunately, I didn't understand your question.
Please rephrase this in more detail.
I want to do it for all markers that I placed in map.This display only one marker.How can I display for multiple markers?
Iterate over all the markers and perform a distance check on each one.
How to iterate over all the markers (line 103):
https://infinity-code.com/atlas/online- … ample.html
Do I need JSON FILE on this example?
No. I pointed you to a specific line that you need to look at in order to understand how to iterate over all the markers.
Infinity Code Forum → Online Maps Help → Markers
Powered by PunBB, supported by Informer Technologies, Inc.