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.
Related
I have a map that has a search box. A user types an address, and presses enter. The map then zooms out, pans to wherever the target is, then zooms in again. I understand from documentation that this is default behavior and that it's commonly referred to as "Fly To".
The question is... How do you disable this? I don't need fancy animation, I just want it to quickly draw a new map at the Lat/Long chosen and set the zoom level I specify.
Can this be done?
I assume you're using Mapbox-GL-Geocoder.
Just use setFlyTo:
geocoder.setFlyTo(false);
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 working on the map application and as per requirement i need to show a single pin for a single region even if it has multiple user coordinates when its completely zoomed out but when its zoomed in to the map then i should display all the pins as per its coordinates.
I have given example below to explain my problem.
I have city New York on this city I have 100 pins on my mapview when I am zooming out of my map it should show me only one annotation pin on the place of 100 pins but when I am zooming in then it should show again 100 pin on map.
Does any one knows about this. I need suggestion. Please note that I am getting all the locations from web services except my current location. This should not be affecting application so that application shouldn't become slow.
Please suggest some solution.
The Apple WWDC 2011 video, "Visualizing information geographically with MapKit", https://developer.apple.com/videos/wwdc/2011/
shows how to cluster map annotations - it's exactly what you need.
Of course there is a control for that...
Take a look at OpenClusterMapView, it should be exactly what you need.
There is no API for this.
You will need to manage the pins yourself. As a user zooms in on the map, you will need to decide at what point to remove the aggregated pin and add the individual pins. Inversely, as a user zooms out you will need to remove the individual pins and replace with the aggregated pin.
Might be a good idea to use a custom pin for the aggregated pin to suggest that it represents multiple pins.
I think this link might help you know the current zoom level:
Zoom and Region
Link to a similar question:
Pin Overlap
I'm creating an iPhone application that gets the user to drop a pin where ever they want. After they drop the pin the user then clicks on it and i want it to show the location of the pin in the call out as the subtitle.
I have the mapview set up as well as the call out working and also the user is able to drop the pin where ever they want to on the map.
I know there is a tutorial for dragging and dropping a pin and they do cover something of this sort. But i'm actually really confused and was wondering if someone could point me in the right direction.
I've a good tutorial regarding the draggable pin.
The source code is available: http://github.com/digdog/MapKitDragAndDrop
Does anyone know what triggers the blue marble animation. I know that it happens when the location gets updated but how do i trigger that event with whatever is in that property. I have an app that i would like to show the user's location when the map appears, but then clear the map of all annotations (including the user location)when the map disappears. This works fine. The problem comes in that when i try to go back into the map after removing the user location, the blue marble does not pop back in. Does anyone know how to set this animation going again?
thanks in advance.
If you set your MKMapView to show the user's location by setting its property showsUserLocation to YES, then the map will automatically show the user's location unless his/her coordinates are outside the map. You can check this by inspecting the userLocationVisible property.
Now, if you remove the user's location (the property userLocation which is an annotation), then the map can not show the user' location even if you have showsUserLocation set to yes.
Simply restore the userLocation again by updating it using the CoreLocation framework and it will appear automatically on the map again.
EDIT: To trigger the animation, update the user's location, setup again the region to be shown (may be the center and/or span have changed) and then call
[map setRegion:newRegion animated:YES];
If the region didn't change simply reuse it.