Is There A Way To Get Street View Coordinates After Gesture? - ios

I'm displaying a Street View (GMSPanoramaView) via Google Maps SDK for iOS in an iPhone/iPad app and I need to get the final position of a Street View after the user has navigated around in it using gestures, so that I can restore it to the exact position the user moved it to. This is extremely important to be able to do since the Street View is not accurate and often places an address hundreds of yards away from the actual one requested, forcing the user to tap and zoom to move the Street View in front of it. I don't see any delegate methods or API's to get updated coordinates. I can easily track the heading, pitch, zoom, and FOV via the GMSPanoramaViewDelegate didMoveCamera method, but that does not give me updated coordinates. Thus when I restore the Street View using the last heading, pitch, zoom, and FOV values, the Street View displays at the original location but with the heading, pitch, zoom, and FOV applied, which doesn't display the same position as the user expects. Does anyone know how to get (or track) these coordinates? Thanks!

Implement the panoramaView:(GMSPanoramaView*)view didMoveToPanorama:(GMSPanaorama*)panorama on the delegate.
On the GMSPanorama there's a CLLocationCoordinate2d called coordinate - voila.
EDIT
It also appears that at any point in time to can just get the panorama property from the GMSPanoramaView and get the coordinate from there.

Related

How to rotate Apple map in driving direction in ios?

I want to rotate apple map based on user's driving direction,
Any idea or solution to rotate map like that way?
I can collect array of last 5-10 moved location, but based on it, Can I calculate heading or anything else to rotate map?

How to determine if user is on same road as GPS coordinates

I have an GPS based iPhone application that uses Google Maps. The app simply displayes the users current location on the map and will alert users when they come to within a certain radius of a marked Point on their journey.
For legal reasons I am unable to use turn-by-turn navigation in the app so the app will never know the route the user is taking to get from A to B. All the app does is constantly check current location agains a database of GPS Point coordinates. If the users current location is within e.g. 50 meters of a Point, the user will get a message regarding that Point.
My issue is this:
Each Point has a radius of say 50 meters around it as marked by the large blue circle on the image below.
The user is indicated by small blue dot and the direction of travel is marked by the red arrow. In the image the user has entered the radius of the Point but is not actually on the same road as the Point. The user should only get messages should they be on the same road as the Point and within the radius of the Point.
Is there a way I can determine if the user is on the same road as thePoint when entering that Points radius?
Side Note: The app is working in its current state and I can get messages when entering the radius of a Point.
I have been implementing gps based track and trace apps for a while. The easiest way I see is when you get the event that the point is entering the 50 m radius you do a geolookup meaning you ask the system the address of the long/lat. You compare this (street) with the geolookup of your ref point.
This requires a geolookup service and the user being online.
Instead of using a circle, you should use a rectangle defined when creating each point. Or use both: test rectangle of the street once inside the circle if your rectangle is too approximate. You can find out approximate edges of the rectangle by testing geolookup different point of the circles at the beginning.

North of Map to point north pole always : programatically ios

The case is the replicate the north pole indicator into a button and perform the rotation.I know this can be done by rotating the map view entirely.Is there any other neat way where the annotation stays normal to the ipad orientation even after rotation
EDIT
as #AlexWain says
mapView.userTrackingMode = MKUserTrackingModeFollowWithHeading
is an excellent solution ...but only possible when the user location displayed on map while rotating it
I need just to show a region and point the map towards north on the button click and sadly it is not the users current location,and is not in visible at that time
Apple has introduced that feature:
Use mapView.userTrackingMode = MKUserTrackingModeFollowWithHeading
This turns the map in the direction you are looking or moving.
In that case north on the map matches the direction of north.
Update:
If the location is outside of the view, there is NO neat way to do it.
You have to rotate the view, and apply the inverse rotation to all elements which should not be rotated (e.g annotations, pins, copyright label)

Can a map overlay be moved?

I'm displaying several user's locations on a map simultaneously as circles of different colors.
I can do this using an annotation and then when the user's location updates use UIView:animateWithDuration: to move to their new location.
However there is a requirement that the size of the circles reflects the accuracy of the location i.e. very accurate equals a circle of size 10 meters, rough accuracy is represented as a circle of size 500 meters etc.
However there are two problems using annotations for this - the first is how to transform meters into a CGRect on the correct size to draw on the map. And the second is the annotations need to be resized if the user zooms the map.
So I was looking at using an overlay instead as that already has a radius and automatic resizing during zooming built in so it handles those two problems.
However it looks like overlays are meant to be static and their coordinate property is read only.
Is there some way I can make the overlays move as the user's location moves? (other than completely remove it and re-add it?)
[THis is for iOS 7 only]

MKMapView - Is there a way to use MKUserTrackingModeFollow with a modified center/focus?

I have a MapView that takes up the full screen and a few elements toward the top of the screen that overlay the map. These top elements potentially cover the blue location marker.
The map is currently tracking fine with MKUserTrackingModeFollow, but I'd like to move the tracking focus down about an inch (obviously the metric will vary by zoom level) to ensure the marker isn't covered. Is there a way to do this with MKUserTrackingModeFollow?
I've considered moving the map with the top elements, but due to design constraints this isn't an option.
Instead of using the userTrackingMode of the MKMapView object to follow the user's location, you could set up a delegate of CLLocationManager to receive location tracking events, and with each location update event you receive, set the center coordinate of the map view, with your vertical offset added to the coordinate value.
You can use the various Map Kit functions and MKMapView methods to convert your offset from some fraction of the map view's bounds.height to a MKMapPoint or CLLocationDistance value.

Resources