<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — How can I use OnlineMapsFindDirection -> waypoint]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=361&amp;type=atom" />
	<updated>2018-02-05T11:20:52Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=361</id>
		<entry>
			<title type="html"><![CDATA[Re: How can I use OnlineMapsFindDirection -> waypoint]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3329#p3329" />
			<content type="html"><![CDATA[<p>Just delete the last point from the waypoints.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-02-05T11:20:52Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3329#p3329</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How can I use OnlineMapsFindDirection -> waypoint]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3327#p3327" />
			<content type="html"><![CDATA[<p>One more problem</p><p>In the code I wrote. i want placeLatitude2GO and placeLongitude2GO to disapear and make the last waypoint given. The last waypoint should be where the route ended. But with this code it adds one more route to placeLatitude2GO and placeLongitude2GO.</p><p>How can i solve this?</p>]]></content>
			<author>
				<name><![CDATA[geral]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=620</uri>
			</author>
			<updated>2018-02-04T21:19:09Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3327#p3327</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How can I use OnlineMapsFindDirection -> waypoint]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3326#p3326" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>Alex Vertax wrote:</cite><blockquote><p>This is because you pass an array of dummy strings to waypoints.<br />In your case, you need to pass waypoints2.</p><p>In the example in post 2, I meant that you can pass an array or a list that contains the names of the locations (address) or coordinates.</p></blockquote></div><p>Yes that&#039;s it! <br />Sorry for not paying attetion to that detail! <img src="https://forum.infinity-code.com/img/smilies/smile.png" width="15" height="15" alt="smile" /></p>]]></content>
			<author>
				<name><![CDATA[geral]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=620</uri>
			</author>
			<updated>2018-02-04T20:18:55Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3326#p3326</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How can I use OnlineMapsFindDirection -> waypoint]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3323#p3323" />
			<content type="html"><![CDATA[<p>This is because you pass an array of dummy strings to waypoints.<br />In your case, you need to pass waypoints2.</p><p>In the example in post 2, I meant that you can pass an array or a list that contains the names of the locations (address) or coordinates.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-02-04T13:57:31Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3323#p3323</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How can I use OnlineMapsFindDirection -> waypoint]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3321#p3321" />
			<content type="html"><![CDATA[<p>Thanks for the reply, and your availability!</p><p>The coordinates for placeLatitude2GO and placeLongitude2GO are : 38.56486, -7.920602</p><p>I can generate a valid route between user location and final location. But when I add waypoints as you suggested in the code, the API&nbsp; gives zero results.</p>]]></content>
			<author>
				<name><![CDATA[geral]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=620</uri>
			</author>
			<updated>2018-02-04T11:23:10Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3321#p3321</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How can I use OnlineMapsFindDirection -> waypoint]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3320#p3320" />
			<content type="html"><![CDATA[<p>This means Google Directions API can not find this route.</p><p>First of all, try to find a route without waypoints.<br />If this works without waypoints, show me the coordinates that you use in placeLatitude2GO and placeLongitude2GO. I will check it.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-02-03T17:16:00Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3320#p3320</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How can I use OnlineMapsFindDirection -> waypoint]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3316#p3316" />
			<content type="html"><![CDATA[<p>Hi</p><p>I&#039;m testing the same, but with no sucess, it always gives me Zero results....</p><div class="codebox"><pre><code>    public float placeLatitude2GO, placeLongitude2GO;
    float placeLatitude1, placeLongitude1;



    string[] waypoints = { &quot;Waypoint 1&quot;, &quot;Waypoint 2&quot;, &quot;Waypoint 3&quot; };
    List&lt;Vector2&gt; waypoints2 = new List&lt;Vector2&gt;
{
    new Vector2(-7.911771f,38.555735f),
    new Vector2(-7.916875f,38.562577f),
    new Vector2(-7.902130f,38.565808f),

};



    public void MakeFeaturedRoutes()
    {
        //Remove todas as linhas que tinha antes para criar a nova route
        OnlineMaps.instance.RemoveAllDrawingElements();

        if (OnlineMapsLocationService.instance.IsLocationServiceRunning())
        {
            placeLatitude1 = OnlineMapsLocationService.instance.position.y;
            placeLongitude1 = OnlineMapsLocationService.instance.position.x;
            Debug.Log(&quot;[MakeFeaturedRoute.cs] Latitude: &quot; + placeLatitude1 + &quot; e Longitude: &quot; + placeLongitude1);



            OnlineMapsGoogleDirections query = OnlineMapsGoogleDirections.Find(new OnlineMapsGoogleDirections.Params(new Vector2(placeLongitude1, placeLatitude1), new Vector2(placeLongitude2GO, placeLatitude2GO))
            {
                //mode = OnlineMapsGoogleDirections.Mode.walking, //Mode de ir a pé

                waypoints = waypoints
            });

            // Specifies that search results must be sent to OnFindDirectionComplete.
            query.OnComplete += OnFindDirectionComplete;

        }
       
    }


    private void OnFindDirectionComplete(string response)
    {
        // Get the resut object.
        OnlineMapsGoogleDirectionsResult result = OnlineMapsGoogleDirections.GetResult(response);

        // Check that the result is not null, and the number of routes is not zero.
        if (result == null || result.routes.Length == 0)
        {
            Debug.Log(&quot;Find direction failed&quot;);
            Debug.Log(response);
            return;
        }

        // Showing the console instructions for each step.
        foreach (OnlineMapsGoogleDirectionsResult.Leg leg in result.routes[0].legs)
        {
            foreach (OnlineMapsGoogleDirectionsResult.Step step in leg.steps)
            {
                Debug.Log(step.string_instructions);
            }
        }

        // Create a line, on the basis of points of the route.
        OnlineMapsDrawingLine route = new OnlineMapsDrawingLine(result.routes[0].overview_polyline, Color.green);

        // Draw the line route on the map.
        OnlineMaps.instance.AddDrawingElement(route);

    }</code></pre></div><p>debugs &quot;Find Direction failed&quot;<br />and the xml:<br /></p><div class="codebox"><pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;DirectionsResponse&gt;
&lt;status&gt;ZERO_RESULTS&lt;/status&gt;
&lt;/DirectionsResponse&gt;</code></pre></div>]]></content>
			<author>
				<name><![CDATA[geral]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=620</uri>
			</author>
			<updated>2018-02-03T09:51:12Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3316#p3316</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: How can I use OnlineMapsFindDirection -> waypoint]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1591#p1591" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Waypoints can be an array or a list, where the values is string or Vector2.</p><p>Example:<br /></p><div class="codebox"><pre><code>string[] waypoints = {&quot;Waypoint 1&quot;, &quot;Waypoint 2&quot;, &quot;Waypoint 3&quot;};
List&lt;Vector2&gt; waypoints2 = new List&lt;Vector2&gt;
{
    new Vector2(lng1, lat1),
    new Vector2(lng2, lat2),
    new Vector2(lng3, lat3),
}; 

OnlineMapsGoogleDirections query = OnlineMapsGoogleDirections.Find(new OnlineMapsGoogleDirections.Params(origin, destination)
{
    waypoints = waypoints
});</code></pre></div><p>An example of how to draw a route:<br /><a href="http://infinity-code.com/atlas/online-maps/pages/FindDirectionExample.html">http://infinity-code.com/atlas/online-m … ample.html</a></p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2017-01-02T10:50:46Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1591#p1591</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[How can I use OnlineMapsFindDirection -> waypoint]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=1589#p1589" />
			<content type="html"><![CDATA[<p>Hi,<br />I recently I want to draw the line with route, in addition, I want to set the waypoint (via root).<br />But I don&#039;t know how to use it<br />can you help me?</p>]]></content>
			<author>
				<name><![CDATA[joonyboy]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=306</uri>
			</author>
			<updated>2017-01-02T09:26:48Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=1589#p1589</id>
		</entry>
</feed>
