How To Attach Custom Map On MapView? [Android]

811 Views Asked by At

I have a question about Mapview. I have an image which is a map of small area (ex: http://goo.gl/tKQM6).

Can i use this image in mapview? if it is possible can i use overlays and other mapview actions on it? I can add different images for different zoom levels.

If there is no way to do this with Google Maps, are there any other way to do this?

Thanks.

1

There are 1 best solutions below

1
On

I have successfully drawn a circule on map. I override the on draw method of ItemizedOverlay for this and perform some canvas and paint operations in it. Like that:

public class DepartureItemizdOverlay extends ItemizedOverlay { 
.......
......


public boolean draw(Canvas canvas, MapView mapView, boolean shadow,
long when) {  

    Paint paint;      
    paint = new Paint();
    paint.setColor(Color.BLUE);
    paint.setAntiAlias(true);
    float strockWidth = Departure.gpsAccuracy / ACCURACY_width_constant;
        if(strockWidth >= MAX_STROCK_WIDTH)
            strockWidth = MAX_STROCK_WIDTH;
    Projection projection = mapView.getProjection();
    Point point = new Point();
    projection.toPixels(mOverlays.get(GPS_DETECTED_GP_INDEX).getPoint(), point);
    float circleRadius = (float)         (projection.metersToEquatorPixels
    (Departure.MAX_DISTANCE_gps_dep) * (1/
    Math.cos(Math.toRadians(mOverlays.
    get(GPS_DETECTED_GP_INDEX).getPoint().
    getLatitudeE6()/1E6))));

    paint.setStyle(Style.FILL);
    paint.setAlpha(30);
    canvas.drawCircle(point.x, point.y, circleRadius, paint);

    paint.setStyle(Style.STROKE);
    paint.setStrokeWidth(MAX_STROCK_WIDTH);
        paint.setAlpha(100);
    canvas.drawCircle(point.x, point.y, circleRadius, paint);


    mapView.postInvalidate();


    return super.draw(canvas, mapView, shadow, when);  
}

.....

}