MapKit
     Julio Barros
Julio@E-String.com
Why Maps?

• iPhone is a mobile / pocket computer
• Where am I?
• What’s near me?
• How do I get somewhere?
Dark ages (pre 3.0)
• Static map images
• Web view with Javascript shenanigans
• Exit out to google maps
MapKit
• New in iPhone 3.x
• Embed map in your app
• Uses Google map tiles
• Familiar map UI
Important Classes
MKMapView


MKAnnotation (protocol)


MKAnnotationView
Important Classes
MKMapView
   MKMapViewDelegate
MKAnnotation (protocol)


MKAnnotationView
   MKPinAnnotationView
Simplest Example
• MKMapView ... just a view



• Don’t forget to add mapkit framework
• Or use Interface Builder
That was
  easy
Show User
 Location
Showing a
particular area on
     the map
               Latitude Span
     Center



“best fit” not exactly
    what you s...
Regions
• MKCoordinateRegion
Denver,
Colorado
Demo data
plist of Brewery information: name, address,
latitude, longitude
Loading Demo Data
Local area
MKAnnotation
MyAnnotation Class
Adding Annotations
Default Pins at
 annotations
Customizing pins
• MKPinAnnotationView
• MKMapViewDelegate - set a delegate
Our purple
  pins
Custom markers
• MKAnnotationView
Customizing
 the view
Customizing the
    Callout
Tapping the call out
       view
Reverse Geocoding

• Geocoding : address to coordinates
 • geocoder.us other services
• Reverse geocoding : coordinates to...
MKReverseGeocoder
MKPlacemark
• Address info including, country code,
  country, postal code, administrative area,
  sub administrative area...
Number of pins
• Try to limit
  annotations to ~100(?)
• Implement region
  change delegate
  methods
• Create and manage
...
Challenges
• Anchoring an object to a location on the
  map and having it scale.
• Shapes - neighborhoods
• Lines - routes...
Legal limitations
I’m not a lawyer but think carefully before
using this for:
   vehicle/fleet tracking
   routing
   cache...
Possible Options

• OpenStreetMap.org (OSM) - map/tile data
• Route-Me - OSS map view
• Cloudemade.com - services around O...
Resources

• MapKit Framework Reference - Apple
• Using Map Kit with Bill Dudney - PragProg
• Using Map Kit ... Bill Dudne...
Thank You
Julio Barros
Julio@E-String.com
http://www.E-String.com
http://twitter.com/JulioBarros
Also on Face book and Lin...
Upcoming SlideShare
Loading in...5
×

Getting Oriented with MapKit: Everything you need to get started with the new mapping framework.

13,496

Published on

New in 3.0 Map Kit works with the Google Mobile Maps Service and features panning and zooming, custom annotations, current location and geocoding. This new framework opens up many new possibilities programs not previously possible. Come learn everything you need to know to get started as well as some tips and tricks to speed your programming along.

Published in: Technology, News & Politics
1 Comment
6 Likes
Statistics
Notes
  • Best article I could find using Google on MapKit
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
13,496
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
192
Comments
1
Likes
6
Embeds 0
No embeds

No notes for slide

Getting Oriented with MapKit: Everything you need to get started with the new mapping framework.

  1. 1. MapKit Julio Barros Julio@E-String.com
  2. 2. Why Maps? • iPhone is a mobile / pocket computer • Where am I? • What’s near me? • How do I get somewhere?
  3. 3. Dark ages (pre 3.0) • Static map images • Web view with Javascript shenanigans • Exit out to google maps
  4. 4. MapKit • New in iPhone 3.x • Embed map in your app • Uses Google map tiles • Familiar map UI
  5. 5. Important Classes MKMapView MKAnnotation (protocol) MKAnnotationView
  6. 6. Important Classes MKMapView MKMapViewDelegate MKAnnotation (protocol) MKAnnotationView MKPinAnnotationView
  7. 7. Simplest Example • MKMapView ... just a view • Don’t forget to add mapkit framework • Or use Interface Builder
  8. 8. That was easy
  9. 9. Show User Location
  10. 10. Showing a particular area on the map Latitude Span Center “best fit” not exactly what you set Longitude Span
  11. 11. Regions • MKCoordinateRegion
  12. 12. Denver, Colorado
  13. 13. Demo data plist of Brewery information: name, address, latitude, longitude
  14. 14. Loading Demo Data
  15. 15. Local area
  16. 16. MKAnnotation
  17. 17. MyAnnotation Class
  18. 18. Adding Annotations
  19. 19. Default Pins at annotations
  20. 20. Customizing pins • MKPinAnnotationView • MKMapViewDelegate - set a delegate
  21. 21. Our purple pins
  22. 22. Custom markers • MKAnnotationView
  23. 23. Customizing the view
  24. 24. Customizing the Callout
  25. 25. Tapping the call out view
  26. 26. Reverse Geocoding • Geocoding : address to coordinates • geocoder.us other services • Reverse geocoding : coordinates to address
  27. 27. MKReverseGeocoder
  28. 28. MKPlacemark • Address info including, country code, country, postal code, administrative area, sub administrative area, locality, sub locality, thoroughfare, sub thoroughfare • Conforms to MKAnnotation • Has address dictionary with Address Book keys
  29. 29. Number of pins • Try to limit annotations to ~100(?) • Implement region change delegate methods • Create and manage your own clusters
  30. 30. Challenges • Anchoring an object to a location on the map and having it scale. • Shapes - neighborhoods • Lines - routes / paths • View space to Geo Space - (CGPoint)convertCoordinate:(CLLocationCoordinate2D) coordinate toPointToView:(UIView *)view - (CLLocationCoordinate2D)convertPoint:(CGPoint)point toCoordinateFromView:(UIView *)view
  31. 31. Legal limitations I’m not a lawyer but think carefully before using this for: vehicle/fleet tracking routing cacheing tiles geocoding / mass reverse geocoding Read the TOS http://code.google.com/apis/maps/iphone/ terms.html
  32. 32. Possible Options • OpenStreetMap.org (OSM) - map/tile data • Route-Me - OSS map view • Cloudemade.com - services around OSM • geocoder.us (among others)
  33. 33. Resources • MapKit Framework Reference - Apple • Using Map Kit with Bill Dudney - PragProg • Using Map Kit ... Bill Dudney - Wednesday
  34. 34. Thank You Julio Barros Julio@E-String.com http://www.E-String.com http://twitter.com/JulioBarros Also on Face book and Linked In
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×