Iphone maps direction question - iphone

In the iPhone maps application under directions, if I try to search for directions with current location and the destination being a place ex:Shell gas station, sometimes it returns the result of the Shell station closest to my location. At other times this returns the address in some other state in the US. This happens randomly.
Any clues why this happens or any way to get around it ?

Searching for a point of interest (POI) in the Maps application tries to use the region defined by the visible map area to search. If that is too large an area, it uses your last known location. If you'd like it to search for shell gas stations near you, touch the 'current location' button and then do the search.

Related

Geo fencing for iOS

I just wanted to enable only particular height-lighted country from entire google map to let the user select any location just like Android.
I referred so many link but the only shape I could monitor is circular not country shape.
I have a string of lat longs of whole country.
I referred so many link but the only shape I could monitor is circular not country shape.
Unfortunately, iOS currently only lets you monitor circular regions, which means that you'll need to do some more work to monitor arbitrary-shaped regions. You'll want to do something like:
Create a circular region that's tangent to the nearest border and start monitoring it.
When you get a notification that the user has moved outside the region, check to see whether they've crossed the border. If not, remove the current region and go to step 1.

Is It Possible To "Transpose" The User's Location?

What I would like to do is specify a location (for instance, a street corner in Paris) and have an MKMapView treat that as the user's current position. As the user moves away from his/her true position the deltas are reflected as changes to that "transposed" location. In other words: can I fool an MKMapView into "believing" that I am standing wherever I choose in the world and have it track my movements as though I were actually there?
Edit:
Actually, the real question is: Can I fool Core Location and thereby fool an MKMapView? The application wherein I would be displaying the transposed MKMapView would be interacting with Core Location.

How to show single annotation pin for a region when i have multiple coordinates for that region?

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

draw route on static image map iphone

I'm developing a campus navigation app.
I have an image which displays building on the campus.
I want draw a route from the user location to destination building the use wants to go.
Wondering how to draw a route on static custom image.
Been searching on internet but cannot find any clue how to develop.
All documentation on internet are about drawing route on Google map.
any hint will be much much appreciated.
You'll have to manually collect latitude and longitude information for each of your map image's four corners. You'll also have to manually specify, in terms of co-ordinates on the image, the position of every possible turning point in the building's corridors, stairs etc. Then you can get the device's current latitude and longitude (see the Location Awareness Programming Guide), translate it into a position on your image, and overlay a transparent view with a red line on it stopping at each of your manually collected waypoints. There remains the graph theory problem of finding the shortest route through the network of waypoints. I suggest the A* algorithm.

How to show directions to neares places from current location using MKMapView

I am new to using MapKit on iPhone.
On Google Maps, I have a current location and push pins to indicate nearest places around current location. (The co-ordinates of all are hard-coded as on now).
Now, How to do the following:
1. Display a green arrow (right/left arrow) pointing to the nearest push pin location from current location?
2. How to play a voice saying "Take right for 1 mile" etc to reach nearest location from current location?
I don't have a definite solution but some ideas which might help you.
You can probably use a custom MKAnnotationView whose image will be the green arrow. You can then place this annotation (arrow) on top of your current location. Then you can find the closest pin (by checking its distance to the current location) and find the angle between the pin and the current location. With that angle you can rotate your arrow image so that it points towards the nearest pin.
You can get the user's current location and heading and you can get the distance from the current location to the nearest pin. With this information you can figure out how far and in what direction the user needs to travel. I'm not sure if you want to synthesize the voice or if you have audio files ready. You'll probably have to play back short clips back to back (eg "take" + "right" + "for" + "1" + "mile"). Have a look at Apple's audio programming guide. As far as I know, you can't get street-specific directions in the current mapkit (eg. turn right on Main street).
Good luck.