How to get picture of any location in iOS - iphone

I want to get image of any location and use this image for showing a view. I will look like a MKMapView but it's faster (I think so)
For Google Map, there is api to do : https://developers.google.com/maps/documentation/staticmaps/
But what about map of iOS? Can you help me?
--UPDATE--
Solution: MKMapSnapshotter

Under iOS7 you can use MKMapSnapshotter to asynchronously generate MKMapSnapshot objects which you can ask for their UIImage representation.
Otherwise your best option is to use a MKMapView and to set userInteractionEnabled to NO.
Alternatively Google Maps provides a static maps API.

Related

MapKit with custom Maps

For my next project I have an image of a small village and I have to turn this into a map.
In this map I have to be able to add MKAnnotationView like the "normal" MapKit Map. The user can also zoom the map. I'm just trying to figure out how to implement this custom map: The only possible way is to create a UIImageView as subviews to which I add the "reproductions" of MKAnnotationView?
Any suggestions on how I can create this type of map?
Also have a look at MapBox. There are two options:
MapBox iOS SDK - works like MapKit, but is an open source alternative that lets you do completely custom maps (iOS 5+).
MBXMapKit - built on MapKit, but allows custom map tiles (iOS 7+).
I don't think using a UIImageView will work particularly well. If the suggested source code doesn't work for you, look at the documentation and sample code for CATiledLayer.

How to drop a pin on the map on a particular place And draw route from user current location to that praticular place?

IN my project I need to draw a route between two pins. Can anyone tell me what are the methods used. And give me the example code for that.
Try these posts.. It will help you i think
http://navarra.ca/?p=786
http://spitzkoff.com/craig/?p=108
This will automatically use Google Direction API and will fetch the points in between the locations i guess..
Anyhow see this blog http://laurilarjo.wordpress.com/2010/10/23/using-google-directions-api-and-drawing-routes-in-iphone-mkmapview/
You can use MKPolyLineView - it allows you to draw a line (or polyline, if you need several segments) as an overlay on top of the MKMapView. Apple even has example code using this here.
Note that this method uses an MKOverlayView which was added in iOS 4, so it only works in iOS 4+. If you need to target iOS 3 devices, then you can use the MKAnnotationView hack that others have linked to (originating as far as I can tell from that spitzkoff blog post). I used to do it that way, but did away with it when iOS 4 had matured enough - I'd wholeheartedly recommend doing it the new way if you don't need iOS 3 support.
As for pins, use MKPinAnnotationView
Go to google maps. "Get directions". Make a screenshot. Then use UIImageView. This is what I would do.

How to Display offline map in iphone using Mapkit

How to Display offline map in iphone using mapkit?
if i use static image then how do i get current location and pin drop on it?
anyone has idea please suggest some solution.
Thank you.
Try this post Force MapKit use cached map tiles only/disable network programmatically
It tells about open source map OSM , helps offline map browsing.
Source from here http://developers.cloudmade.com/projects/show/iphone-sdk.
Hope this helps , or r u looking for some thing else.
Similar to What SDKs can be used for creating offline maps application for iPad/iPhone?
In iOS4+, you can use an image MKOverlay to overlay whatever you want on top of a MapKit map. You can provide a semi-transperant base map of your own providing to display when the underlying Google Map can not be loaded. But you can not control what MapKit is doing under the hood caching Google maps.

Any recommendation to customize an iPhone MapView?

I want to you iPhone LocationManager and display the position using a custom map, different from the one used by MapView. Is there any way to customize the MapView or should I rebuild my own MapView from scratch ?
Do you think MapView will be open to achieve this kind of customization in a future release of the SDK ?
Do you have any recommendation to rebuild a MapView from scratch. I will have to divided my map in level and each level in tiles. But should I associate a tile with an UIImage or should I build/manage dynamically an UIImage composed of tiles currently displayed ?
Please make sure you file a bug with Apple, asking for this feature (I already have). In the meantime, I think your best bet is to take a look at the route-me library. It emulates the built-in Google Maps application, but uses either OpenStreetMap, Microsoft VirtualEarth or CloudMade as a data source for tiles. You could add support for loading tiles from your own custom service.

iPhone Map Rendering

I'm with building a map application for iPhone, and I wanted to ask what the best way is for bringing maps from a website onto the iPhone.
I want to fetch small images of size 80x80 and show them. This kind of activity might be achieved by using UIKit or OpenGL ES.
Also if you can bring to my notice some kind of achievement and guides for this thing, I would be really very thankful.
EDIT:
I need to get the custom maps for some other vendor..
Besides that i know how to get the images its the rendering part and displaying part that what my problem man.
For small static maps, you could use Google's static map API
You can construct a URL to get your image like this:
NSString* urlString = [NSString stringWithFormat:#"http://maps.google.com/staticmap?center=%f,%f&zoom=%d&size=%1.0fx%1.0f&key=%s&sensor=true",
aLocation.coordinate.latitude, aLocation.coordinate.longitude, // aLocation is set to the center of the map
kCardBackGoogleMapsZoomLevelDefault,
80, 80, // your map size
kAIGoogleMapAPIKey]; // your google maps API key
All the other maps suppliers support static tiles - Microsoft, Yahoo and CloudMade.
Take a look at this topic: http://discussions.apple.com/message.jspa?messageID=8157498. It's nearly the same as what you're asking for.
As far as displaying the scrolling map is concerned, CATiledLayer would be the way to go. It's a slightly complex class to use, but you can find some examples if you google it.
Would you be able to use iPhone SDK 3's MapKit API, or do you need to use custom maps?
If you have a set of custom tiles you want to load, you may want to look at mapping engines put together by companies like MapNinja that let you use your own tilesets.
Otherwise it's a lot of coding to do something like a tiled map engine yourself.
If you're looking to just embed a single, non scrollable map, then have a look at the Google Static Maps API, which will generate map images for you on the fly, depending on your request parameters.
If you want to implement a slippy map, then either try route-me, which works with OS 2.2.1, and supports custom tile servers. Or have a look at MapKit/Google Maps in OS 3.0.
You could also use the Route-Me project
http://code.google.com/p/route-me/
BSD Licensed - perfect if you need to render your own tiles