<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Infinity Code Forum — Online Maps Polygon Performance Issue]]></title>
	<link rel="self" href="https://forum.infinity-code.com/extern.php?action=feed&amp;tid=972&amp;type=atom" />
	<updated>2018-11-27T21:52:09Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.infinity-code.com/viewtopic.php?id=972</id>
		<entry>
			<title type="html"><![CDATA[Re: Online Maps Polygon Performance Issue]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4308#p4308" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-11-27T21:52:09Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4308#p4308</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Online Maps Polygon Performance Issue]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4307#p4307" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[bartosz.wolski]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=736</uri>
			</author>
			<updated>2018-11-27T13:10:13Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4307#p4307</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: Online Maps Polygon Performance Issue]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4306#p4306" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[Alex Vertax]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=2</uri>
			</author>
			<updated>2018-11-27T12:53:24Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4306#p4306</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Online Maps Polygon Performance Issue]]></title>
			<link rel="alternate" href="https://forum.infinity-code.com/viewtopic.php?pid=4305#p4305" />
			<content type="html"><![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>]]></content>
			<author>
				<name><![CDATA[bartosz.wolski]]></name>
				<uri>https://forum.infinity-code.com/profile.php?id=736</uri>
			</author>
			<updated>2018-11-27T12:08:35Z</updated>
			<id>https://forum.infinity-code.com/viewtopic.php?pid=4305#p4305</id>
		</entry>
</feed>
