Friday, 23 July 2010

Drawing on Maps with MonoTouch

iOS4 introduced new features like MKOverlay to help draw lines/routes and shapes/polygons on the MKMapView control, however it has always been possible to add these features to maps in iOS3.

Two (Objective-C) examples of displaying geometric shapes on MKMapView in iOS3 are:
...it is these examples that I've ported to MonoTouch (as a Universal app: iPhone and iPad). You can grab the code from github project MapStuff and see some screenshots below:

I put together a class diagram to try and explain how they work (the classes shown are from the 2nd example, which allows you to draw your own shape).

Please remember all the hard work here has been done by the original authors. All credit goes to them. Any bugs in the MonoTouch code are mine... let me know if you find any.

iOS4 examples to follow...

1 comment:

  1. hey mate,

    Just to let you know that I created DrawMap2.zip which is the SAME codebase but compiled under iOS4. Here's the new link

    http://www.gisnotes.com/wordpress/2010/08/iphone-devnote-14-drawing-a-point-line-polygon-on-top-of-mkmapview/

    Anyway, thanks for porting this to MonoTouch! :)

    cheers,
    rupert

    ReplyDelete

Note: only a member of this blog may post a comment.