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

2010-12-09 Thread sal
Thanks Igor, it was very useful

On Dec 9, 2:35 am, ip332 iprile...@gmail.com wrote:
 Here is the actual code to show an image on top of the Google map.
 Regards
 Igor
 ===
 package com.map.overlay;

 import java.util.List;

 import com.google.android.maps.GeoPoint;
 import com.google.android.maps.MapActivity;
 import com.google.android.maps.MapController;
 import com.google.android.maps.MapView;
 import com.google.android.maps.Overlay;

 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Canvas;
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.os.Bundle;

 public class MyOverlay extends MapActivity {
         Bitmap          bmp;    // loaded bitmap in memory
         GeoPoint        min;    // top left corner (lat/long)
         GeoPoint        max;    // right bottom corner (lat/long)

         @Override
         public void onCreate(Bundle savedInstanceState) {
                 super.onCreate(savedInstanceState);
                 setContentView(R.layout.main);

                 bmp = BitmapFactory.decodeFile(/sdcard/test.bmp);   // load 
 bitmap
 (can use JPG,PNG,etc.)
                 min = new GeoPoint(37374000,-121913000);                // 
 bounding rectangle
                 max = new GeoPoint(37375000,-121912000);

                 MapView mapView = (MapView) findViewById(R.id.mapView);
                 mapView.setSatellite(true);                             // 
 switch to the satellite
 view
                 MapController ctrl = mapView.getController();
                 int x = (min.getLongitudeE6() + max.getLongitudeE6())/ 2;     
   // select
 map center
                 int y = (min.getLatitudeE6() + max.getLatitudeE6())/ 2;
                 ctrl.setCenter(new GeoPoint(y,x));
                 ctrl.setZoom(21);                                       // 
 set scale
                 mapView.setBuiltInZoomControls(true);                   // 
 enable zoom controls

                 MapOverlay mapOverlay = new MapOverlay();
                 ListOverlay listOfOverlays = mapView.getOverlays();
                 listOfOverlays.clear();
                 listOfOverlays.add(mapOverlay);

                 mapView.invalidate();
         }

         class MapOverlay extends Overlay
         {
                 @Override
                 public boolean draw(Canvas canvas, MapView mapView, boolean 
 shadow,
 long when)
                 {
                         // 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);
                         return true;
                 }
         }

         @Override
         protected boolean isRouteDisplayed() {
                 // TODO Auto-generated method stub
                 return false;
         }

 }

 On Dec 8, 12:32 am, sal suhailb...@gmail.com wrote:







  Thank guys for your suggestion

  @Frank

  What do you mean Mobile CAD, i want just a mark up on the JPEG image
  based on predefined locations , thats it.
  i thot Google Map API would provide me better support of doing markup
  if i am able to convert JPEG image into google map
  do u have any good pointer or reference to application which does mark
  up on image.

  @Igor
  Buddy, i have developed an application to draw a image on MapView ,
  logic wise i know its right
  somewhere i am messing with certain objects which leads to exception .
  so i requested for  sample code  so that i can cross verify

  regards
  Sal

  On Dec 8, 6:04 am, ip332 iprile...@gmail.com wrote:

   Sol,
   No offense, but ability to debug the application (especially when you
   have source code and debugging tools) is one of the most basic things
   any programmer must have.
   Yes, Android make programming looks like a pretty simple and easy
   activity however when you don't understand what are you doing and
   cannot debug the problem - you won't get anything good out of it.
   They say There is no replacement for a displacement about a car
   engine. Same here - you can't ask for a ready-to-use code to get more
   or less acceptable result unless you spent certain amount of time,
   nerves, coffee, etc.
   Nobody get it from the first time. Google it, ask questions but do not
   expect someone to solve your problem.

   Anyway I will try to create a sample app but don't know when I'll have
   time (my current 

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

2010-12-08 Thread sal
Thank guys for your suggestion

@Frank

What do you mean Mobile CAD, i want just a mark up on the JPEG image
based on predefined locations , thats it.
i thot Google Map API would provide me better support of doing markup
if i am able to convert JPEG image into google map
do u have any good pointer or reference to application which does mark
up on image.

@Igor
Buddy, i have developed an application to draw a image on MapView ,
logic wise i know its right
somewhere i am messing with certain objects which leads to exception .
so i requested for  sample code  so that i can cross verify

regards
Sal

On Dec 8, 6:04 am, ip332 iprile...@gmail.com wrote:
 Sol,
 No offense, but ability to debug the application (especially when you
 have source code and debugging tools) is one of the most basic things
 any programmer must have.
 Yes, Android make programming looks like a pretty simple and easy
 activity however when you don't understand what are you doing and
 cannot debug the problem - you won't get anything good out of it.
 They say There is no replacement for a displacement about a car
 engine. Same here - you can't ask for a ready-to-use code to get more
 or less acceptable result unless you spent certain amount of time,
 nerves, coffee, etc.
 Nobody get it from the first time. Google it, ask questions but do not
 expect someone to solve your problem.

 Anyway I will try to create a sample app but don't know when I'll have
 time (my current program belongs to the company)

 On Dec 6, 11:54 pm, sal suhailb...@gmail.com wrote:







  thanks for ur concerns,

  @Frank
  I have JPEG sketch of my apartment, getting just geocode of my
  apartment doesnt serve my purpose.
  i want to do location markup on that JPEG image,  i have stored
  location information which i want to mark on the image using android
  API's
  so i want to convert my image as a google map then use android API's
  to mark location on that. let me know if u need more information.

  @Igor
  As i am new to android
  can u give me simple example with main activity illustrating on  how
  to draw JPEG image on MapView with overlays to mark on the co-ordinate
  of the image
  i tried doing it but i am getting NULL exception while using overlays

  rgds
  Sal

  On Dec 6, 6:46 am, ip332 iprile...@gmail.com wrote:

   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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


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

2010-12-08 Thread ip332
Here is the actual code to show an image on top of the Google map.
Regards
Igor
===
package com.map.overlay;

import java.util.List;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Point;
import android.graphics.Rect;
import android.os.Bundle;

public class MyOverlay extends MapActivity {
Bitmap  bmp;// loaded bitmap in memory
GeoPointmin;// top left corner (lat/long)
GeoPointmax;// right bottom corner (lat/long)

@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

bmp = BitmapFactory.decodeFile(/sdcard/test.bmp); // load 
bitmap
(can use JPG,PNG,etc.)
min = new GeoPoint(37374000,-121913000);// 
bounding rectangle
max = new GeoPoint(37375000,-121912000);

MapView mapView = (MapView) findViewById(R.id.mapView);
mapView.setSatellite(true); // 
switch to the satellite
view
MapController ctrl = mapView.getController();
int x = (min.getLongitudeE6() + max.getLongitudeE6())/ 2;   
// select
map center
int y = (min.getLatitudeE6() + max.getLatitudeE6())/ 2;
ctrl.setCenter(new GeoPoint(y,x));
ctrl.setZoom(21);   // set 
scale
mapView.setBuiltInZoomControls(true);   // 
enable zoom controls

MapOverlay mapOverlay = new MapOverlay();
ListOverlay listOfOverlays = mapView.getOverlays();
listOfOverlays.clear();
listOfOverlays.add(mapOverlay);

mapView.invalidate();
}

class MapOverlay extends Overlay
{
@Override
public boolean draw(Canvas canvas, MapView mapView, boolean 
shadow,
long when)
{
// 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);
return true;
}
}

@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}

}

On Dec 8, 12:32 am, sal suhailb...@gmail.com wrote:
 Thank guys for your suggestion

 @Frank

 What do you mean Mobile CAD, i want just a mark up on the JPEG image
 based on predefined locations , thats it.
 i thot Google Map API would provide me better support of doing markup
 if i am able to convert JPEG image into google map
 do u have any good pointer or reference to application which does mark
 up on image.

 @Igor
 Buddy, i have developed an application to draw a image on MapView ,
 logic wise i know its right
 somewhere i am messing with certain objects which leads to exception .
 so i requested for  sample code  so that i can cross verify

 regards
 Sal

 On Dec 8, 6:04 am, ip332 iprile...@gmail.com wrote:







  Sol,
  No offense, but ability to debug the application (especially when you
  have source code and debugging tools) is one of the most basic things
  any programmer must have.
  Yes, Android make programming looks like a pretty simple and easy
  activity however when you don't understand what are you doing and
  cannot debug the problem - you won't get anything good out of it.
  They say There is no replacement for a displacement about a car
  engine. Same here - you can't ask for a ready-to-use code to get more
  or less acceptable result unless you spent certain amount of time,
  nerves, coffee, etc.
  Nobody get it from the first time. Google it, ask questions but do not
  expect someone to solve your problem.

  Anyway I will try to create a sample app but don't know when I'll have
  time (my current program belongs to the company)

  On Dec 6, 11:54 pm, sal suhailb...@gmail.com wrote:

   thanks for ur concerns,

   @Frank
   I have JPEG sketch of my apartment, getting just geocode of my
   

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

2010-12-07 Thread Frank Weiss
It just doesn't seem like a good idea to use Android Google map to display a
plan view of an apartment and call out POIs within it. On my Droid, at full
zoom-in, my apartment takes up about 1/12 of the screen. Also, if you placed
markers for POIs within your apartment, when you zoom out, they just overlap
and become useless. Is there really a compelling reason to mashup your
floorplan with all the features and layers of Google maps? Is is just a
specifc feature of GM you are interested in? What is that feature?

I suggest you use a different approach, like simply displaying the floorplan
as an image view, displaying markers on that, and providing whatever
detailed callouts you want. Chances are people are working on mobile CAD
apps like this.

-- 
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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

2010-12-07 Thread ip332
Sol,
No offense, but ability to debug the application (especially when you
have source code and debugging tools) is one of the most basic things
any programmer must have.
Yes, Android make programming looks like a pretty simple and easy
activity however when you don't understand what are you doing and
cannot debug the problem - you won't get anything good out of it.
They say There is no replacement for a displacement about a car
engine. Same here - you can't ask for a ready-to-use code to get more
or less acceptable result unless you spent certain amount of time,
nerves, coffee, etc.
Nobody get it from the first time. Google it, ask questions but do not
expect someone to solve your problem.

Anyway I will try to create a sample app but don't know when I'll have
time (my current program belongs to the company)


On Dec 6, 11:54 pm, sal suhailb...@gmail.com wrote:
 thanks for ur concerns,

 @Frank
 I have JPEG sketch of my apartment, getting just geocode of my
 apartment doesnt serve my purpose.
 i want to do location markup on that JPEG image,  i have stored
 location information which i want to mark on the image using android
 API's
 so i want to convert my image as a google map then use android API's
 to mark location on that. let me know if u need more information.

 @Igor
 As i am new to android
 can u give me simple example with main activity illustrating on  how
 to draw JPEG image on MapView with overlays to mark on the co-ordinate
 of the image
 i tried doing it but i am getting NULL exception while using overlays

 rgds
 Sal

 On Dec 6, 6:46 am, ip332 iprile...@gmail.com wrote:







  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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


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

2010-12-06 Thread sal
thanks for ur concerns,


@Frank
I have JPEG sketch of my apartment, getting just geocode of my
apartment doesnt serve my purpose.
i want to do location markup on that JPEG image,  i have stored
location information which i want to mark on the image using android
API's
so i want to convert my image as a google map then use android API's
to mark location on that. let me know if u need more information.

@Igor
As i am new to android
can u give me simple example with main activity illustrating on  how
to draw JPEG image on MapView with overlays to mark on the co-ordinate
of the image
i tried doing it but i am getting NULL exception while using overlays

rgds
Sal

On Dec 6, 6:46 am, ip332 iprile...@gmail.com wrote:
 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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


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

2010-12-05 Thread ip332
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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en