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
Related
I want to create a customize map using by openlayer.But I am unable to use openlayer. I want to create map without using google map in iphone so I want to use other way in which I can fill own data in map. i think it possible by open layer , but how I dont know.So please help me.
OpenLayers is a javascript library. As a client-based map viewing utility it allows to "display map tiles, vector data and markers loaded from any source". It is similar to Leaflet.
Both of them are only helpful if you want to render on the web (in which case you would need to grab map tiles or a map image from somewhere (OpenStreetMap for instance), or set up your own map server).
If what you want is to render a map natively on iOS, then you'll probably need a toolkit to fetch and render the map tiles or image. Here're a few that could be helpful:
WhirlyGlobe-Maply;
tangram-es;
GLMap;
Mapzen iOS SDK;
Nutiteq SDK;
Mapbox iOS SDK
QuartzMaps;
you can use this by help of phonegap.
if you dont want to use phonegap then you can simply use UIWebView for that.you can load your data in it.
load HTML files in UIWebView. html file including javascript and css and image files without any problem.
NSString *fullPath = [NSBundle pathForResource:#"filename" ofType:#"html" inDirectory:path];
[yourWebView loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:fullPath]]];
for more info on openLayers
It sounds like you are simply interested in providing custom maps in an iOS app. If that is so then MapBox-iOS-SDK will allow you to use many different map sources without the need for a web view. If you look at the MapBox projects on github they also have tools to help you create the maps that the SDK can use.
How can an image overlay be applied to a MKMapView? Basically, when you zoom in a specific location, I want an image to appear on top of the map that gives a more detailed view of the location.
I've had a look around and found different types of methods to use. I had a working example for an older SDK using the DrawMapRect function but this no longer seems to work on 4.2.
This is a good place to start...
http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MKOverlayView_class/Reference/Reference.html
I was looking for polygon sample code though.
#omniscian: If you have solved it you should post something helpful for others. This page has a high google rank.
I already have a tile source set up for use with the Google Maps JavaScript API. I am trying to translate this for use with the iPhone MapKit. I have correctly implemented the javascript zooming levels into mapkit. Whenever - (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated is called, I snap the region to the nearest zoom level based on the same center point.
Is it possible to implement a solution possibly with CATiledLayer to implement a tiling solution. Does the iPhone use the standard 256x256 tiles like google maps does natively? Any direction or help on this would be greatly appreciated. I would rather not waste a couple weeks trying to implement this if it's not possible.
FWIW, I spent quite a bit of time looking for a decent solution… before diving into a CATiledLayer example, I noticed MKOverlay and MKOverlayView — which are new in iOS 4 and plug right into a MKMapView.
Couldn’t find a good example implementation of using MKOverlays that pull arbitrary image data (say, UIImages from a remote tile server), but I tinkered around with the API enough until I got it working.
Built a simple example implementation of it in case anyone (like me) wants a reference:
http://github.com/mtigas/iOS-MapLayerDemo
Hope this helps someone out in the future.
MapKit doesn't provide much in the way of custom tile sources (in fact, it provides absolutely nothing to customize sources: you either use Google Maps or you don't). I've been working with a similar problem myself, though, and I've found RouteMe to be a pretty good solution for custom maps: http://code.google.com/p/route-me/
Built-in support exists for OpenStreetMaps, OpenAerialMaps (which is currently offline), Virtual Earth, and Yahoo Maps, but the framework makes it pretty easy to plug in your own tile source, too.
Yes, since iOS 7, MKTileOverlay will do:
https://developer.apple.com/library/ios/documentation/MapKit/Reference/MKTileOverlay_class/Reference/Reference.html
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.
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.