Getting Oriented with MapKit

  • 5,279 views
Uploaded on

Slides of a presentation I did at 360iDev in Denver in September 2009. Sample code is available at E-String.com …

Slides of a presentation I did at 360iDev in Denver in September 2009. Sample code is available at E-String.com
Let me know if you have any questions.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
5,279
On Slideshare
0
From Embeds
0
Number of Embeds
11

Actions

Shares
Downloads
0
Comments
0
Likes
6

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Getting Oriented with MapKit Julio Barros Julio@E-String.com
  • 2. Why Maps? • iPhone is a mobile / pocket computer • Where am I? • How do I get somewhere? • What’s near me? Julio Barros E-String.com
  • 3. Dark ages (pre 3.0) • Static map images • Web view with Javascript shenanigans • Exit out to google maps Julio Barros E-String.com
  • 4. MapKit • New in iPhone 3.x • Embed map in your app • Uses Google map tiles • Familiar map UI Julio Barros E-String.com
  • 5. Important Classes MKMapView MKAnnotation (protocol) MKAnnotationView Julio Barros E-String.com
  • 6. Important Classes MKMapView MKMapViewDelegate MKAnnotation (protocol) MKAnnotationView MKPinAnnotationView Julio Barros E-String.com
  • 7. Simplest Example • MKMapView ... just a view • Or use Interface Builder • Don’t forget to add mapkit framework Julio Barros E-String.com
  • 8. That was easy Julio Barros E-String.com
  • 9. Show User Location Julio Barros E-String.com
  • 10. Showing a particular area on the map Latitude Span Center “best fit” not exactly what you set Longitude Span Julio Barros E-String.com
  • 11. Regions • MKCoordinateRegion Julio Barros E-String.com
  • 12. Denver, Colorado Julio Barros E-String.com
  • 13. Demo data plist of Brewery information: name, address, latitude, longitude Julio Barros E-String.com
  • 14. Loading Demo Data Julio Barros E-String.com
  • 15. Local area Julio Barros E-String.com
  • 16. MKAnnotation Julio Barros E-String.com
  • 17. MyAnnotation Class Julio Barros E-String.com
  • 18. Adding Annotations Julio Barros E-String.com
  • 19. Default Pins at annotations Julio Barros E-String.com
  • 20. Customizing pins • MKPinAnnotationView • MKMapViewDelegate - set a delegate Julio Barros E-String.com
  • 21. Our purple pins Julio Barros E-String.com
  • 22. Custom markers • MKAnnotationView Julio Barros E-String.com
  • 23. Customizing the view Julio Barros E-String.com
  • 24. Customizing the Callout Julio Barros E-String.com
  • 25. Tapping the call out view Julio Barros E-String.com
  • 26. Reverse Geocoding • Geocoding : address to coordinates • geocoder.us other services • Reverse geocoding : coordinates to address Julio Barros E-String.com
  • 27. MKReverseGeocoder Julio Barros E-String.com
  • 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 Julio Barros E-String.com
  • 29. Number of pins • Try to limit annotations to ~100(?) • Implement region change delegate methods • Create and manage your own clusters Julio Barros E-String.com
  • 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 Julio Barros E-String.com
  • 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 Julio Barros E-String.com
  • 32. Possible Options • OpenStreetMap.org (OSM) - map/tile data • Route-Me - OSS map view • Cloudemade.com - services around OSM • geocoder.us (among others) Julio Barros E-String.com
  • 33. Resources • MapKit Framework Reference - Apple • Using Map Kit with Bill Dudney - PragProg • Using Map Kit ... Bill Dudney - Wednesday Julio Barros E-String.com
  • 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 Julio Barros E-String.com