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.
Related
google_maps_flutter, how not to start image from bottom?
By default, the marker appears directly above the coordinates,(LatLng) so it seems like Google has made it this way, but I am currently making a custom marker and I want this position to be in the center, not directly above the coordinates. It's probably related to the render object key, but I want to edit it myself. On which page can I edit it?
Does anybody knows this issue??
(If that coordinate is a point. Make sure the dot is in the middle of the marker, not the bottom of the marker.)
I think this is the similar issue
How to center the camera so that marker is at the bottom of screen? (Google map api V2 Android)
Fairly new to Mapbox and getting there (slowly).
I have a map initially loaded at zoom level 1 for use in a web browser. When a user clicks on a marker, it'll center and zoom to level 10.
When that marker loses focus, I'd like to zoom back out to level 1.
This page discussing web applications does it (link below), but there doesn't seem to be (that I can find - sorry!) any documentation on how to achieve this.
https://docs.mapbox.com/help/getting-started/web-apps/
Any and all help appreciated!
For the first event, to zoom in when clicking a marker, you could adapt this example to zoom in addition to panning when calling flyTo
https://docs.mapbox.com/mapbox-gl-js/example/center-on-feature/
For the second part, you'd need to add a listener for another event depending on what you have in mind by "losing focus".
https://docs.mapbox.com/mapbox-gl-js/api/map/#map-events
I would like to maintain the current zoom level when a location change is triggered.
Currently, I display the location as follows:
_mapController.camera
.lookAtPointWithDistance(coordinates, distanceInMetersFromPosition);
The problem is that the user can zoom in or out and then move and as soon as the position changes, the piece of code is triggered again. So my question is:
Is there a callback for changing the distanceInMetersFromPosition or can I somehow get the current distanceInMetersFromPosition or zoom? I didn't find any documentation about this so far.
I’m using the "HERE SDK for Flutter (explore Edition) - Version 4.3.2.0".
The camera contains information about the current state. You can call the following:
double distanceInMetersFromPosition =
_mapController.camera.state.distanceToTargetInMeters;
Alternatively, you can use lookAtPoint(coordinates) when you just want to update the location without changing the zoom. If you are interested in callbacks, you can attach an observer to the camera with addObserver(MapCameraObserver observer). This will notify you whenever the user has zoomed or panned the map.
I am using CLLocationManager to retrieve current location in my app and display using MapView, i want to slide the map so that the current location should also change to the new location where the map slides and it should annotate to the new location, how to do it? Please give your suggestions with sample code.
You probably don't mean "the current" since that means where the phone actually is, unless you want to transport the phone to another place when using this app which would be quite a feat. So, how about drawing a layer over the top of your map that keeps a pin drawn at the centre so it looks as if the pin is moving over the map, but really the map is moving under the pin.
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.