Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid google maps drawing roads performanse issue with 10.000+ overlay
    primarykey
    data
    text
    <p>I am working on a project which is aboot drawing roads and displaying some informations about the roads. The issue is that I am using so many geopoints( 5.000-10.000 +) and drawing line points to points and showing the roads with different colors, <strong>so the map is too slow.</strong> I did some configurations about my application but still too slow. Do you have any idea about solving my problem and being the performance better?</p> <p>Here is the my code.</p> <pre><code>for (int t = 0; t &lt; roads.size(); t++) { for (int i = 0; i &lt; roads.get(t).size() - 1; i++) { //bounds up-bottom-right-left to draw roads if (boundBox[0] &gt;= roads.get(t).get(i) .getLatitudeE6() &amp;&amp; boundBox[1] &gt;= roads.get(t).get(i) .getLongitudeE6() &amp;&amp; boundBox[2] &lt;= roads.get(t).get(i) .getLatitudeE6() &amp;&amp; boundBox[3] &lt;= roads.get(t).get(i) .getLongitudeE6()) { MyOverlay mOverlay = new MyOverlay(); mOverlay.setColor(Color.GREEN); mOverlay.setWidth(4); mOverlay.setPair(roads.get(t).get(i), roads.get(t).get(i + 1)); mapOverlays.add(mOverlay); } } } </code></pre> <hr> <pre><code> class MyOverlay extends Overlay { GeoPoint gp1 = new GeoPoint(0, 0); GeoPoint gp2 = new GeoPoint(0, 0); int colr=0,width=0; public MyOverlay() { } public void draw(Canvas canvas, MapView mapv, boolean shadow) { super.draw(canvas, mapv, false); Paint mPaint = new Paint(); mPaint.setDither(true); mPaint.setColor(colr); mPaint.setStyle(Paint.Style.FILL_AND_STROKE); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeWidth(width); Point p1 = new Point(); Point p2 = new Point(); Path path = new Path(); Projection projection = mapv.getProjection(); projection.toPixels(gp1, p1); projection.toPixels(gp2, p2); path.moveTo((float) p2.x, (float) p2.y); path.lineTo((float) p1.x, (float) p1.y); // canvas.drawBitmap(markerBitmap, point.x, point.y, null); canvas.drawPath(path, mPaint); //canvas.drawBitmap(bitmap, src, dst, paint); } public void setPair(GeoPoint gpone, GeoPoint gptwo) { gp1 = gpone; gp2 = gptwo; } public void setColor(int clr) { colr=clr; } public void setWidth(int w) { width=w; } } </code></pre> <p>Is there anyone to solve my issue ?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload