I am trying to have a fixed relationship between zoom level and camera pitch.
No matter how we zoom (by scroll, touch, flyTo() or fitBounds()), I would like to always have the same pitch at the same zoom level.
This would probably require disabling manual pitching, but this is fine.
Currently, I can only do this with the flyTo() method (which allows me to enter a value for the pitch.
map.flyTo({
center,
zoom,
speed: 1.2,
pitch: Scales.pitchScale(zoom),
easing(t) {
return t;
},
essential: true,
});
If I try to add the same call to my scale function
Scales.pitchScale(zoom),
on a zoom event, it makes zooming on mobile devices really slow.
Is there anything built into Mapbox?
Related
I'm trying to change the pitch of the mapbox camera while zooming. I know I can set a default/max pitch level and that the user is able to change the pitch of the camera by themselves, I'm however looking for a way to map a zoom level range to a pitch range. While scrolling/zooming I want the pitch to change according to this range.
I've tried the following:
function onMapboxZoom(e: MapboxEvent) {
const zoom = e.target.getZoom();
const pitch = mapRange(zoom, 6, 10, 0, 65);
e.target.setPitch(pitch);
}
The problem I'm having with this approach is that I think the zoom interpolation that mapbox uses to create a smooth zooming effect is cancelled by my manual pitch change. The result is that the smoothness of zooming is gone and that it requires a lot of scroll events to zoom in properly. Which makes sense I guess. I was wondering if anyone has tackled this problem before and if/how this can be achieved while maintaining a smooth zoom behavior.
Thanks!
I am trying to implement the Google Map SDK, and so far I have implemented a marker. I made the marker in a way that it follows as it is located in the center when I move the camera position.
The problem is that I can't zoom in and out while the marker's location is not changing. I would like to make the zooming experience like Uber in which the location does not change.. Thank you for your help.
You can use this line allowScrollGesturesDuringRotateOrZoom to your GMSMapview. It controls whether rotate and zoom gestures can be performed off-center and scrolled around. The default value of this is YES.
mapView.settings.allowScrollGesturesDuringRotateOrZoom = false // NO for obj-c and false for swift
So by setting it by NO/false, you can now perform zooming while the marker location is not moving. For more information, check this thread.
I'm using the UIImagePickerController to control the camera and overlay millimeter tick marks in preview for measuring closeup macro shots, and I'd like to be able to detect the current zoom level and scale it properly.
Is there any way to determine the current zoom level in camera preview?
Unfortunately no, since the UIImagePickerController API doesn't give you access to the camera zoom level, nor to any subviews or other properties that might have access to that information.
As Michael Dautermann points out, based on the answer to this question, you could use the cameraViewTransform property of UIImagePickerController to implement your own zoom by setting up the right CGAffineTransform and also the right pinch gesture to zoom in/out. Since you'd be controlling the zoom yourself, you'd always know the zoom level and be able to use it to adjust the tick marks.
I am using the v7.0 Ajax control from Bing Maps and I'm trying to get the following information while being in the bird's eye view mode on the map:
the viewing height (or altitude) -- this is the zoom level, right?
the pitch angle -- does this always has the same value, no matter of the viewing angle while being in the bird's eye view mode?
Thanks.
There is no such thing as the "altitude" at which a projected map image is created. There is a map scale and resolution (i.e. how many metres each screen pixel corresponds to) which varies according to the zoom level and the location on the earth's surface, but this does not correlate to the view you would get if you were looking down at the earth from x metres above it.
The angle at which Bird's eye imagery is shot varies in different scenes - you can observe this as you pan around the map - the imagery will clearly warp as you move from one scene to the next.
I have a UIScrollView with a content view that the user can zoom in/out. The min zoom level is less than 1, and the max zoom level is greater than 1.
It is easy for the user to zoom all the way in, or all the way out. What can I do to get the UIScrollView to snap to zoom level 1 as well? Not just when the the user lifts their fingers, but as the they are zooming in/out as well.
Write a method, that gets called every time the user stops zooming, which then checks to see if the current zoom scale is very close to 1.0 (like something between 0.8 and 1.2). If this returns true, the zoom scale is set exactly to 1.0 to snap.
The trick is to override or disable the pinch and add your own. When you start a pinch gesture, you DO NOT update the display and resize the image until the pinch is complete, then issue your zoomToRect.