<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Infinity Code Forum — Online Maps Polygon Performance Issue]]></title>
		<link>https://forum.infinity-code.com/viewtopic.php?id=972</link>
		<atom:link href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=972&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Online Maps Polygon Performance Issue.]]></description>
		<lastBuildDate>Tue, 27 Nov 2018 21:52:09 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Online Maps Polygon Performance Issue]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=4308#p4308</link>
			<description><![CDATA[<p>Using Drawing API for a large number of points is very expensive, because it has a lot of complicated calculations.<br />Map need a little help from you.</p><p>How to do it:<br />Way 1: Reduce the number of points at low zoom to increase performance when there are many points in the map view.<br />For a larger zoom, most of the points are outside the map view, and they are clipped. It works fast.</p><p>Way 2: Draw complex lines in some other way, for example, LineRenderer or GL.<br />This way can be combined with the first way.</p><p>Examples are attached.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Tue, 27 Nov 2018 21:52:09 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=4308#p4308</guid>
		</item>
		<item>
			<title><![CDATA[Re: Online Maps Polygon Performance Issue]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=4307#p4307</link>
			<description><![CDATA[<p>I download the JSON (had to go to page source and copy the data from there actually) that generates this map ( for example ) : <br /><a href="http://umap.openstreetmap.fr/en/map/les-lieux-de-la-transition-numerique-en-bourgogne-_179564#8/47.025/4.839">http://umap.openstreetmap.fr/en/map/les … .025/4.839</a></p><p>and the borders of the region sums up to 17k verticles (the border of the &quot;region&quot;).</p><p>All other elements aren&#039;t problematic ( I am just creating them as markers with different texture with parsing the JSON i got from the website).</p><p>Here it is how it looks with the border generated from 17k verticles, which is great until I touch/move the map, the fps is around 5-10 (thats what it feels like).<br /><span class="postimg"><img src="https://i.ibb.co/Y4SrS8z/tttteeestt.png&quot;" alt="PunBB bbcode test" /></span></p><p>Thanks in advance now I hope you know what I wanted to achive and why I use 17k verticles.</p>]]></description>
			<author><![CDATA[null@example.com (bartosz.wolski)]]></author>
			<pubDate>Tue, 27 Nov 2018 13:10:13 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=4307#p4307</guid>
		</item>
		<item>
			<title><![CDATA[Re: Online Maps Polygon Performance Issue]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=4306#p4306</link>
			<description><![CDATA[<p>Hello.</p><p>You started to explain the problem from the wrong side.<br />I do not know what and how you are doing and why you have a polygon with 17k vertices.</p><p>Please, first explain what you want to do and show your code that you are using.<br />I&#039;m 99% sure that if you have a polygon with 17k vertices, you are moving in the wrong direction.</p>]]></description>
			<author><![CDATA[null@example.com (Alex Vertax)]]></author>
			<pubDate>Tue, 27 Nov 2018 12:53:24 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=4306#p4306</guid>
		</item>
		<item>
			<title><![CDATA[Online Maps Polygon Performance Issue]]></title>
			<link>https://forum.infinity-code.com/viewtopic.php?pid=4305#p4305</link>
			<description><![CDATA[<p>Like you suggested in : <a href="http://forum.infinity-code.com/viewtopic.php?id=971">http://forum.infinity-code.com/viewtopic.php?id=971</a></p><p>I am using onlineMapsDrawing api to draw elements, now I am drawing the border of the map as polygon (16821 verticles), which is quite a lot.</p><p>I did notice in case of using tileSet (which I am) there is this code :</p><div class="codebox"><pre><code>public override void UpdateControl()
    {
        base.UpdateControl();

        if (OnlineMapsTile.tiles == null) return;

        UpdateMapMesh();

        if (OnlineMapsDrawingElementManager.CountItems &gt; 0)
        {
            if (drawingMode == OnlineMapsTilesetDrawingMode.meshes)
            {
                if (drawingsGameObject == null) InitDrawingsMesh();
                int index = 0;
                foreach (OnlineMapsDrawingElement drawingElement in OnlineMapsDrawingElementManager.instance)
                {
                    drawingElement.DrawOnTileset(this, index++);
                }
            }
        }

        if (OnDrawMarkers != null) OnDrawMarkers();
    </code></pre></div><p>Which in my guess is source of my performance issues on mobile device.</p><p>I did tried to override the &#039;OnlineMapsDrawingElement&#039; create my own etc, but wasn&#039;t able to properly move it with movment of the map (added &#039;OnChangePosition&#039;, and &#039;OnChangeZoom&#039; listeners, then tried .GetWorldPosition etc, but I didn&#039;t had reference point since you recreate polygons each time the map need to be updated).</p><p>My question is, Is there any reason why You are not creating polygon just once and then move it with the map and scale it properly ? In my opinion this would greatly increase performance?</p><p>Or am I mistaken and I am missing something ?</p><p>While I am able to create polygon on my own (later on I might write my own code to actually make png out of all verticles since its not dynamicaly loaded data anyway and move it on the map) I am still unable to detect how should I move the poly or by how much should I scale it to have correct behavior.</p>]]></description>
			<author><![CDATA[null@example.com (bartosz.wolski)]]></author>
			<pubDate>Tue, 27 Nov 2018 12:08:35 +0000</pubDate>
			<guid>https://forum.infinity-code.com/viewtopic.php?pid=4305#p4305</guid>
		</item>
	</channel>
</rss>
