Sunday, December 5, 2010

[android-developers] Re: JPEG Image has a map

I used the Overlay class for this purpose.
Here is the main part of the MyOverlay::Draw() method:
// convert bitmap's bounding box into pixels
Point top_left = new Point();
mapView.getProjection().toPixels(min, top_left);
Point bottom_right = new Point();
mapView.getProjection().toPixels(max, bottom_right);
// Prepare two rectangles (pixels)
Rect src = new Rect( 0,0,bmp.getWidth() - 1, bmp.getHeight() -
1 );
Rect dst = new Rect( top_left.x, bottom_right.y,
bottom_right.x,top_left.y );
// draw bitmap
canvas.drawBitmap( bmp, src, dst, null);
Since it uses current mapView then zooming and panning are supported
automatically.
Obviously you need to know left top (GeoPoint min in the code above)
and right bottom (GeoPoint max) coordinates for your picture (I used
Google Earth for this purpose).
Good luck.
Igor

On Dec 5, 6:36 am, suhail ahmed <suhailb...@gmail.com> wrote:
> Hi,
>
> I have JPEG, PDF of sketch of my apartment, i want to make it as a google
> map so that i can use Google API's (geocoding, reverse geocoding) on that.
>
> may i know the solution for the problem
>
> regards
> Sal

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment