Topic: How to retrieve stored xml data for the markers at any given time

Hey Peeps

What we have done is a map with markers and custom xml data which are currently populated. What want to know is, can the xml be accessed at any point to retrieve a list of all the existing markers data?

sorry for being a complete noob but if anyone can provide a little bit of code sample that would really help me out.

Thank you for your time.

Kind regards

Re: How to retrieve stored xml data for the markers at any given time

Hello.

Unfortunately, I did not understand your question.
Please rephrase it.

Kind Regards,
Infinity Code Team.

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

3 (edited by luke.carelsen 2016-04-24 09:26:56)

Re: How to retrieve stored xml data for the markers at any given time

Alex Vertax wrote:

Hello.

Unfortunately, I did not understand your question.
Please rephrase it.

let me rephrase.

So we are creating a marker with customXML data. We query a AWS DB and the markers are created when the data is returned. So we are assuming that all the data is stored in an xml.

Had a look at the documentation and we believe that the OnlineMapsXMLList Class can be used to retrieve a list of all the entries that exist in the XML.
Looking into using "Create wrapper for XmlNodeList." all the example show that you need to provide the location of the XML file.

I do not know how to access the xml data on all the markers populated on the map.

Please can you assist with an example as to how we can retrieve the data?

Kind Regards

Re: How to retrieve stored xml data for the markers at any given time

Hello.

Example:

// Creating markers.
for (int i = 0; i < 10; i++)
{
    OnlineMapsMarker marker = OnlineMaps.instance.AddMarker(0, 0);
    OnlineMapsXML node = new OnlineMapsXML("Data");
    node.Create("Field", i);
    marker.customData = node;
}

// Combines customData.
OnlineMapsXML markersXML = new OnlineMapsXML("Total");
foreach (OnlineMapsMarker marker in OnlineMaps.instance.markers)
{
    OnlineMapsXML node = marker.customData as OnlineMapsXML;
    if (node != null)
    {
        XmlElement newNode = node.element;
        if (node.document != markersXML.document) newNode = markersXML.document.ImportNode(newNode, true) as XmlElement;
        markersXML.AppendChild(newNode);
    }
}

Debug.Log(markersXML.outerXml);

A little explanation: When you add a node, it must be of the same owned document.
Starting from Online Maps v2.4.0.32 (when it will be available), you will not need to control this.
Verification will occur automatically.

Kind Regards,
Infinity Code Team.

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

Re: How to retrieve stored xml data for the markers at any given time

ohhhhh thats how you do it. Thanks a million!!!!

Rock on!

Re: How to retrieve stored xml data for the markers at any given time

Yo Peeps!

So we are so close to finishing our project, I'm just stuck on something. I'm trying to grab a random marker for the purpose of then zooming to the correct place, or pulling certain info from it. If i look in the inspector i can see that online maps script as markers in 2d marker section. So i have no idea how i can get a random marker from the onlinmaps script or from the xml.

Please if anyone can provide a solution to this issue it would be much appreciated.

thank you for taking the time to read this.

Rock on!

Re: How to retrieve stored xml data for the markers at any given time

Hello.

OnlineMapsMarker randomMarker = OnlineMaps.instance.markers[Random.Range(0, OnlineMaps.instance.markers.Length)];
Kind Regards,
Infinity Code Team.

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

Re: How to retrieve stored xml data for the markers at any given time

Alex Vertax wrote:

Hello.

OnlineMapsMarker randomMarker = OnlineMaps.instance.markers[Random.Range(0, OnlineMaps.instance.markers.Length)];

Yo! Thank you so so much. That works 100%

You have really helped us with everything related with maps in our project. Will send you link soon as it's available to download.

Rock on!