I've just found this for doing this on the Android but has anyone got this to work on the iPhone?
What I'm looking for is a method that will zoom the map to show all pins that are showing...
Thanks
I'm not sure if there's a built in method, but the usual way is to loop through your annotations, looking at their coordinates, and find the maximum and minimum latitudes and longitudes. You'll end up with 4 numbers, you can create a region from them and set the map to that region.
Here is the solution! :)
http://sdhillon.com/find-the-center-and-span-of-a-set-of-points-android-and-iphone-example/
Related
I am displaying bing maps in a metro app. I am drawing both pushpins and polylines on the map but they get drawn on opposite sides of the map which looks very weird. Please look at the following image:
The line and image is being drawn at opposite sides of the map.
Could someone please suggest a solution of this problem.
Can I somehow restrict my view to display each country only once?
So I think one of my other answer might help you out here.
How to show the full map and prevent scrolling in Bing Maps API
You can constrain the map to a certain zoomlevel range and lat/long range, so that you don't see the same coordinates twice. Let me know if you need any further details on how to do this.
I have a offline map tiles, i display it and also zoom in zoom out functionality in that and it's working very well, but now i want to drop multiple pins on offline map tiles and also want to get lat-long of that drop pin how it's possible ? please help me.
you will get definitely solution form this link Offline Maps iPhone
I have check and get lat and long when i click on map. so on click event u will drop a pin.
in this link u will see the answer which is given by Ruben Esposito.
MAy be it help.
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 am making an iPhone app for a local college. I am currently trying to take a drawn map of the campus and put pin annotations on it. I also want to be able to show the users current location on this map image. Right now I just have a UIImageView inside of a UIScrollView. It can currently scroll and zoom in/out. How would I go about accomplishing this? I have searched everywhere for an answer and can't seem to find a solution (or have overlooked it). Am I going in the right direction? Thanks for your help.
You would have to come up with a function to translate latitude and longitude into pixel offsets in the image. Assuming the campus is relatively small compared to the Earth (so you can ignore the planet's curvature), this should be a simple matter of determining the coordinates of the four corners of the image and interpolating.
Really hope someone can help me as I'm a bit stuck :S
I have a custom map of an event using the CATiledLayer so users can zoom in and scroll around the map. What I would like to do now is add the functionality to let the user know where they currently are on the map. I know it can be done as I've seen an app do this before. I'm not sure how to go about doing it though, maybe I need to convert lat/lon into pixels but I'm not sure if thats possible (depending on how big the image is, etc).
On another site it was mentioned to find out the boundaries of the map and then I can add pins to the map, but I'm not sure how to go about doing this? Will I need to find every coordinate (lat/lon) within the boundary so I can add the pin of where the user is currently?
If anyone can give me with any advice or pointers, I'd much appreciate it
You can use the route-me library by adding your own map source class. A good article that explains how to do it is here http://mobilegeo.wordpress.com/2010/07/07/route-me-native-iphone-mapping-framework/
I'm facing a challenge right now in trying to map GPS coords to a map that's an artist's rendition. In particular this is for a ski mountain, so the artist's rendition is a "trail map". The trail map is not accurate in that the whole mountain has been squeezed onto the one view, yet the actual topology of the mountain doesn't conform to the drawing.
I've tried several approaches:
1) Triangulation using known GPS coordinates of the lift stations. This is fairly simple to implement, yet this is not accurate enough and the algorithm fails if the rendition differs enough from the GPS map.
2) Creating a uniform grid for both the GPS map and the Trailmap, then doing a mapping from cells in the GPS map to the Trailmap. The downside to this is it can be a lot of busy work with no easy UI for doing it.
3) Calculating the vectors of each lift (being a straight line), find the closet lift station to a given GPS point, and calculate the estimated Trailmap location using this vector.
I'm considering #2, which is essentially the simplest solution. But if you've found a better way, I'd love to hear it.