<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Check if GPS location reports within map boundaries]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=1423&amp;type=atom" />
	<updated>2020-01-13T00:24:22Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=1423</id>
		<entry>
			<title type="html"><![CDATA[Re: Check if GPS location reports within map boundaries]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5856#p5856" />
			<content type="html"><![CDATA[<p>Thanks. The solution works very well.</p>]]></content>
			<author>
				<name><![CDATA[vgi]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1195</uri>
			</author>
			<updated>2020-01-13T00:24:22Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5856#p5856</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Check if GPS location reports within map boundaries]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5855#p5855" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Something like that:<br /></p><div class="codebox"><pre><code>using UnityEngine;

public class LocationInMapView:MonoBehaviour
{
    private bool InMapView(double longitude, double latitude)
    {
        double tlx, tly, brx, bry;
        OnlineMaps.instance.GetCorners(out tlx, out tly, out brx, out bry);
        if (latitude &gt; tly || latitude &lt; bry) return false;

        if (tlx &gt; brx)
        {
            brx += 360;
            if (longitude &lt; tlx) longitude += 360;
        }

        return tlx &lt;= longitude &amp;&amp; brx &gt;= longitude;
    }

    private void OnLocationChanged(Vector2 location)
    {
        bool inMapView = InMapView(location.x, location.y);
        Debug.Log(inMapView? &quot;In Map View&quot;: &quot;Outside Map View&quot;);
    }

    private void Start()
    {
        OnlineMapsLocationService.instance.OnLocationChanged += OnLocationChanged;
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2020-01-12T12:08:38Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5855#p5855</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Check if GPS location reports within map boundaries]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5854#p5854" />
			<content type="html"><![CDATA[<p>We are working on a project that requires to detect if the user GPS location is within the map boundaries. Any suggestions?</p>]]></content>
			<author>
				<name><![CDATA[vgi]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1195</uri>
			</author>
			<updated>2020-01-11T22:23:08Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5854#p5854</id>
		</entry>
</feed>
