<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Elevation data caching]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=672&amp;type=atom" />
	<updated>2020-04-01T09:20:09Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=672</id>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=6115#p6115" />
			<content type="html"><![CDATA[<p>The problem is that GetUnscaledElevation requires a position in the scene, relative to the top-left corner of the map.<br /><a href="http://infinity-code.com/doxygen/online-maps/classOnlineMapsElevationManagerBase.html#ae05a9c810f7ff98ab82d3ec87e6b8540">http://infinity-code.com/doxygen/online … c87e6b8540</a><br />You pass geographic coordinates.<br />You need to first convert the coordinates to a position in the scene.<br /><a href="http://infinity-code.com/doxygen/online-maps/classOnlineMapsControlBase.html#ae07c16d776478eda7a9b41369ba44098">http://infinity-code.com/doxygen/online … 369ba44098</a></p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2020-04-01T09:20:09Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=6115#p6115</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=6113#p6113" />
			<content type="html"><![CDATA[<p>Im sorry, let me explain.</p><p>I want to know the real elevation for my markers on the map. Is it possible to read elevation from tiles for a position on map by just providing latitude, longitude and zoom?</p><p>I try the following code:</p><p>Vector2 center = marker.position;<br />float unscaledElevation = OnlineMapsElevationManagerBase.GetUnscaledElevation(center.x, center.y); // real elevation value</p><p>But the problem is each zoom gives different elevation for my markers. Requesting elevations from tiles would be better?</p>]]></content>
			<author>
				<name><![CDATA[savvas_6]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1113</uri>
			</author>
			<updated>2020-03-31T10:44:39Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=6113#p6113</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=6112#p6112" />
			<content type="html"><![CDATA[<p>CacheMapboxElevation only saves and reads elevation data for the tile from the cache.<br />What is the point of this function if you can get elevation data using OnlineMapsMapboxElevationManager?!</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2020-03-30T19:42:47Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=6112#p6112</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=6111#p6111" />
			<content type="html"><![CDATA[<p>Is it possible to add a function in the CacheMapboxElevation (Online Maps v3) for requesting real world elevation for specific coordinates(Lon, Lat) at specific zoom? <br />Thank you!</p>]]></content>
			<author>
				<name><![CDATA[savvas_6]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=1113</uri>
			</author>
			<updated>2020-03-29T12:24:09Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=6111#p6111</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5280#p5280" />
			<content type="html"><![CDATA[<p><a href="http://forum.infinity-code.com/viewtopic.php?pid=5279#p5279">http://forum.infinity-code.com/viewtopi … 5279#p5279</a></p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2019-07-09T21:35:11Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5280#p5280</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5276#p5276" />
			<content type="html"><![CDATA[<p>yes i think i need your help if possible .I still do not master the horizon scripts so it&#039;s a little&nbsp; complicated.<br />Thank you any way</p>]]></content>
			<author>
				<name><![CDATA[Amen]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=994</uri>
			</author>
			<updated>2019-07-09T14:11:20Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5276#p5276</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5271#p5271" />
			<content type="html"><![CDATA[<p>Yes it is possible.<br />But this will not work with Horizon, which you asked for in another thread.<br />Horizon already has everything to implement caching.<br />You just need to add a save array to the file, check for the existence of the file, and read the array from the file.</p><p>It is so easy that I believe that you can do it.<br />If you still have problems implementing this, write again and I will do it for you.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2019-07-05T18:24:20Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5271#p5271</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=5270#p5270" />
			<content type="html"><![CDATA[<p>it&#039;s possible to have elevation data caching for ArcGIS.<br />THANK YOUU</p>]]></content>
			<author>
				<name><![CDATA[Amen]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=994</uri>
			</author>
			<updated>2019-07-05T09:00:32Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=5270#p5270</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4963#p4963" />
			<content type="html"><![CDATA[<p>This is a script for Online Maps v2.<br />In Online Maps v3, this is much easier:<br /></p><div class="codebox"><pre><code>using System.IO;
using UnityEngine;

public class CacheMapboxElevation: MonoBehaviour
{
    private string GetTilePath(OnlineMapsTiledElevationManager&lt;OnlineMapsMapboxElevationManager&gt;.Tile tile)
    {
        return Application.persistentDataPath + &quot;/Elevation Cache/&quot; + tile.zoom + &quot;/&quot; + tile.x + &quot;/&quot; + tile.y + &quot;.png&quot;;
    }

    private void OnDownload(OnlineMapsTiledElevationManager&lt;OnlineMapsMapboxElevationManager&gt;.Tile tile)
    {
        string path = GetTilePath(tile);
        if (!File.Exists(path))
        {
            OnlineMapsMapboxElevationManager.instance.StartDownloadElevationTile(tile);
            return;
        }

        Texture2D texture = new Texture2D(256, 256);
        texture.LoadImage(File.ReadAllBytes(path));
        OnlineMapsMapboxElevationManager.instance.SetElevationTexture(tile, texture);
        OnlineMapsUtils.Destroy(texture);

        Debug.Log(&quot;Loaded from cache: &quot; + path);
    }

    private void OnDownloadSuccess(OnlineMapsTiledElevationManager&lt;OnlineMapsMapboxElevationManager&gt;.Tile tile, OnlineMapsWWW www)
    {
        string path = GetTilePath(tile);
        FileInfo info = new FileInfo(path);
        if (!info.Directory.Exists) info.Directory.Create();
        File.WriteAllBytes(path, www.bytes);

        Debug.Log(&quot;Elevation saved: &quot; + path);
    }

    private void Start()
    {
        OnlineMapsMapboxElevationManager.instance.OnDownload += OnDownload;
        OnlineMapsMapboxElevationManager.instance.OnDownloadSuccess += OnDownloadSuccess;
    }
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2019-05-16T17:00:28Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4963#p4963</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4959#p4959" />
			<content type="html"><![CDATA[<p>Hi ,<br />I&#039;have this error using this script</p>]]></content>
			<author>
				<name><![CDATA[Amen]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=994</uri>
			</author>
			<updated>2019-05-16T14:36:17Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4959#p4959</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3818#p3818" />
			<content type="html"><![CDATA[<p>Hello.</p><p>Please attach a stack trace of the error.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-08-24T16:03:38Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3818#p3818</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3815#p3815" />
			<content type="html"><![CDATA[<p>I&#039;m trying to use this script to achieve the same thing but it doesn&#039;t seem to work, i attached the script to the map object and then supplied the mapbox key but i get an error &quot;Array index out of range&quot;.</p>]]></content>
			<author>
				<name><![CDATA[matlaray]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=730</uri>
			</author>
			<updated>2018-08-24T11:37:00Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3815#p3815</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3709#p3709" />
			<content type="html"><![CDATA[<p>Yes, you must add the script to the map (or any other) GameObject and enter your Mapbox Access Token.</p>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-07-17T19:35:45Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3709#p3709</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3706#p3706" />
			<content type="html"><![CDATA[<p>Would you pleased to describe how you using the codes?Should I attach a script which contains the codes to the map?</p>]]></content>
			<author>
				<name><![CDATA[Greenwhich]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=771</uri>
			</author>
			<updated>2018-07-17T11:18:31Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3706#p3706</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Elevation data caching]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=3705#p3705" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>leviniarened wrote:</cite><blockquote><p>Now works perfectly.&nbsp; A big thank you to Alex.</p></blockquote></div><p>Would you pleased to describe how you using the codes?Should I attach a script which contains the codes to the map?</p>]]></content>
			<author>
				<name><![CDATA[Greenwhich]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=771</uri>
			</author>
			<updated>2018-07-17T06:46:42Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=3705#p3705</id>
		</entry>
</feed>
