I'm developing an app using osmdroid (3.0.8).
When I zoom using two fingers in and out, the zoom starts from the center of the map, not from the middle of the two fingers (using MapView.setMultiTouchControls(true);). I've tried to implement the pinch (pinch) but with bad results.
I've read other similar questions but without finding a good solution.
Note: I MUST use OSM, and not other solutions
Osmdroid 3.0.10 includes support for zooming at the location you pinched at.
The samples also include a two-finger rotation gesture overlay if that is something you are interested in trying.
Related
I'm currently using android-map-extensions to cluster markers on google map. However, sometimes two markers are clustered when they are really far, sometimes they have to be almost overlapping each other to be clustered together. I've been trying to wrap my head around this for a couple of days and haven't figured it out. Below is the examples (btw, sorry for the bad english and I don't have enough reputation to post images so imgur to the rescue):
should already clustered : http://imgur.com/MxyN9VI
should not clustered until zoom out far enough (1-2 more zoom level) : http://imgur.com/hVzMQfD
How can I fix this, changing the clusterSize as document does not really help
Android Maps Extensions uses grid based clustering and what you describe is part of how it works.
You have a couple of options:
writing your own clustering strategy for it (e.g. distance based)
finding a proper clusterSize for your case; this might work if all your markers have fixed and static positions; keep in mind choosing between 128 and 128.1 can make a big difference
trying out a different library, e.g. Clusterkraf or Android Maps Utils, which use distance based clusering
Disclosure: I'm a developer of Android Maps Extensions
Just to clearify....I dont think I can use google maps unless it will automatically scale custom Images I need to use when the map is zoomed.
Im trying to create my own custom view to use to display images of maps that will be zoomable and also allow the user to leave markers where they touch....maybe via longtouch with a single press or if I can manage it just via single touch.
How ever Im having a little trouble trying to figure where to start. So far I have a couple different implementations of zoom-able imageviews which work fine but I havent been able to come up with the math to allow the markers to move to their correct positions relative to the zoom level when a user pinches and zooms.
I have come across a similar solution to what I am trying to do on here before but of course now that Im looking for it, its no where to be found.
So my question is how would I go about mathematically figuring out where to draw my markers according to zoom level? Does any one know of any libraries or opensource projects that do such a thing already? Any help on the matter would be greatly appreciated.
Is it possible to handle simultaneous zoom and pan events using a MapView?
The Google Maps app for Android allows the map to be panned while a pinch-to-zoom gesture is already underway. This is helpful for making fine adjustments while you zoom in on a region of the map. The default MapView does not seem to support this.
I am prepared to implement this functionality myself, but I would prefer to use the built-in mechanisms.
I solved this problem using an Overlay. By overriding the overlay's onTouchEvent() and detecting when zoom and pan events happen, those events can be handled in parallel.
For anyone facing this problem, I have posted a sample project based on my solution.
EDIT:
The new Google Maps v2 library supports simultaneous zoom and pan. Unless there is a need to customize the event handling algorithm, I strongly recommend upgrading to the new library.
I am developing an application in Android in which I'm using google map using the Javascript V3 library with Phonegap. It works fine for me until I noticed that map is zooming in on touch event but couldn't able to zoom out when I tried for number of times.
I'll appreciate if someone suggest me how I can get the pinch zoom in and out without using the default zoom controls of Google Maps?
Unfortunately there is no built-in function for this (not yet anyway), so in order to make it work you will have to create your own custom control for this action. This means capturing the touch event and zooming according to the gesture.
To go into a little more details on this, have a control over the map canvas, and in it capture the touch events.
Your second option since you are building for Android native is to use google maps from android (however this is java not javascript). You can find a basic tutorial on this here: http://mobiforge.com/developing/story/using-google-maps-android
Hope this helps,
Vlad
I have to zoom in/zoom out and pan image using mutltitouch in android.I have followed motion event for two fingers but facing problem when multiple fingers came into play with screen.I don't know how to get decision in case of movement of 4 or five fingers that whether user want zoom or pan .i have found library from
How to perform zoom in/out ,rotation together in Android
I found a tutorial using this library but didn't found any help to download this android-multitouch-controller library so i can use it as in tutorial it gives errors since library is not there.
Kindly guide me if any one ever use this library or is there any other way to decide mode in case of multitouch.
Thanks
I recently wrote a blog on getting started with this library, if it still helps: http://paulbourke.blogspot.com/2011/10/writing-multitouch-applications-on.html