<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Getting Speed Limit]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1681&amp;type=atom" />
	<updated>2021-01-20T00:19:01Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=1681</id>
		<entry>
			<title type="html"><![CDATA[Re: Getting Speed Limit]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7076#p7076" />
			<content type="html"><![CDATA[<p>Alex, Thanks Again!</p><p>Pointed me in the direction I needed!</p>]]></content>
			<author>
				<name><![CDATA[AppFreak]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=708</uri>
			</author>
			<updated>2021-01-20T00:19:01Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7076#p7076</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Getting Speed Limit]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7075#p7075" />
			<content type="html"><![CDATA[<p>Hello.</p><p>GetSpeedLimitResults returns an array of results objects from the response string.<br /></p><div class="codebox"><pre><code>OnlineMapsGoogleRoads.SpeedLimitResult[] results = OnlineMapsGoogleRoads.GetSpeedLimitResults(response);</code></pre></div><p>Full example:<br /></p><div class="codebox"><pre><code>using System;
using UnityEngine;

public class SpeedLimitsExample : MonoBehaviour
{
    private void Start()
    {
        OnlineMapsGoogleRoads request = OnlineMapsGoogleRoads.SpeedLimits(
            OnlineMapsKeyManager.GoogleMaps(), // Key From KeyManager

            // IEnumerable values can be float, double, Vector2 or string.&lt;br/&gt;
            // If values is string, it must contain placeId.&lt;br/&gt;
            // If values is float, double or Vector2, it must contain coordinates.
            new[]
            {
                &quot;ChIJX12duJAwGQ0Ra0d4Oi4jOGE&quot;,
                &quot;ChIJLQcticc0GQ0RoiNZJVa5GxU&quot;
            } 
        );
        request.OnComplete += OnRoadsAPIComplete;
    }

    private void OnRoadsAPIComplete(string response)
    {
        try
        {
            OnlineMapsGoogleRoads.SpeedLimitResult[] speedLimits = OnlineMapsGoogleRoads.GetSpeedLimitResults(response);
            foreach (OnlineMapsGoogleRoads.SpeedLimitResult limit in speedLimits)
            {
                Debug.Log(limit.speedLimit);
            }
        }
        catch (Exception e)
        {
            Debug.LogError(response);
        }

    }
}</code></pre></div><p>P.S. This example has not been tested because I do not have a Google Maps Platform Premium Plan and do not have access to Speed limits.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2021-01-19T09:55:49Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7075#p7075</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Getting Speed Limit]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=7074#p7074" />
			<content type="html"><![CDATA[<p>I&#039;m trying to get the current speed limit using the OnlineMapsGoogleRoads module with the code below and the API shows that the GetSpeedLimitResults needs a string response but it is giving me a &quot;Invalid Expression Term &#039;String&#039; &quot; error for my response variable. Couldn&#039;t find any examples so do I have this correct?</p><p>private OnlineMapsGoogleRoads.SpeedLimitResult speedLR;</p><br /><p>public void ShowSpeedLimit() {<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; speedLR.speedLimit = OnlineMapsGoogleRoads.GetSpeedLimitResults(string resp);<br />&nbsp; &nbsp; <br />&nbsp; &nbsp; Debug.Log(&quot;ShowSpeedLimit - Speed Limit: &quot; + speedLR.speedLimit.ToString());<br />&nbsp; &nbsp; Debug.Log(&quot;ShowSpeedLimit - Speed Limit Type: &quot; + speedLR.units.ToString());</p><p>&nbsp; &nbsp; speedLimitData.GetComponent&lt;TMPro.TextMeshProUGUI&gt;().text = speedLR.speedLimit.ToString();</p><p>}</p>]]></content>
			<author>
				<name><![CDATA[AppFreak]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=708</uri>
			</author>
			<updated>2021-01-18T19:53:35Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=7074#p7074</id>
		</entry>
</feed>
