Dynamically change the zoom level

Put your problem here if it does not fit any of the other categories.

Dynamically change the zoom level

Postby s.semeria » Tue Mar 25, 2008 7:07 pm

Hello,

I am trying to implement an application similar to your friend finder, but I would like the zoom level to be adjusted dynamically. I am trying to change the zoom level based on the distance of the point from the midpoint (i.e. if the max squared distance from the midpoint is over an upper threshold zoom out, if it is below a lower threshold zoom in) but I got some jerky effects on the screen... Does anybody have any suggestion?

More important, does anyone know how to make the user unable to zoom (with the zoom dialog) and pan (by dragging the map) I tried disabling focus and click events on the MapView but with no luck.

Thanks in advance for your help.

Regards

s.semeria
s.semeria
Junior Developer
Junior Developer
 
Posts: 23
Joined: Mon Jan 28, 2008 10:18 am
Location: Italy

Top

Postby plusminus » Tue Mar 25, 2008 7:27 pm

Hello s.semeria,

my time is short, so only a half answer now:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. void com.google.android.maps.MapController.zoomToSpan(int latSpanE6, int lonSpanE6)
Parsed in 0.031 seconds, using GeSHi 1.0.8.4


If you also center the map to your own position, you'll need to zoom out one level afterwards.

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

Postby s.semeria » Tue Mar 25, 2008 9:42 pm

Hi plusminus,

thanks a lot for your quick answer. Yeah, this API seems to be what I was looking for.
I am also centering the map, but what you mean with zoom just one level? Do you mean that centering the map also affects the zoom level in some way???

Again, thanks a lot

Regards,

s.semeria
s.semeria
Junior Developer
Junior Developer
 
Posts: 23
Joined: Mon Jan 28, 2008 10:18 am
Location: Italy

Postby plusminus » Tue Mar 25, 2008 10:15 pm

Hello s.semeria,

sorry, what I meant was. What you use [font=Lucida Console]zoomToSpan[/font] it can happen, that it zoomes in so close, that both point(you calculated the span from) lie very close to the edges of the screen.
If you then center your map on one of the points, the other one is off-screen.

You can work against this, by zooming out on "level".

Regards,
plusminus
Image
Image | Android Development Community / Tutorials
User avatar
plusminus
Site Admin
Site Admin
 
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany

How to block panning and zooming on a mapview

Postby s.semeria » Wed Mar 26, 2008 11:50 pm

Hi plusminus,

thanks for your explanation and help.
Just one more question: do you know how should I make the user unable to pan and zoom my mapview?

Thanks a lot for your great help

Regards,

s.semeria
s.semeria
Junior Developer
Junior Developer
 
Posts: 23
Joined: Mon Jan 28, 2008 10:18 am
Location: Italy

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 16 guests