<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
> <channel><title>Eric Binnion</title> <atom:link href="http://www.ericbinnion.com/feed/" rel="self" type="application/rss+xml" /><link>http://www.ericbinnion.com</link> <description>Exploring Web Design and Development</description> <lastBuildDate>Thu, 10 May 2012 01:33:02 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>Gravity Forms Review</title><link>http://www.ericbinnion.com/gravity-forms-review/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=gravity-forms-review</link> <comments>http://www.ericbinnion.com/gravity-forms-review/#comments</comments> <pubDate>Tue, 01 May 2012 03:04:26 +0000</pubDate> <dc:creator>Eric Binnion</dc:creator> <category><![CDATA[Web Development]]></category> <guid
isPermaLink="false">http://www.ericbinnion.com/?p=146</guid> <description><![CDATA[Gravity Forms is form building plugin that simplifies the task of building attractive interactive forms for your WordPress websites. Sure, if you&#8217;re just looking for some basic contact form functionality, then there are several great contact form plugins out there for $0. But, if you&#8217;re looking for a contact form plugin that has extra features, [...]]]></description> <content:encoded><![CDATA[<p></p><p>Gravity Forms is form building plugin that simplifies the task of building attractive interactive forms for your WordPress websites. Sure, if you&#8217;re just looking for some basic contact form functionality, then there are several great contact form plugins out there for $0. But, if you&#8217;re looking for a contact form plugin that has extra features, such as:</p><ul><li>Submissions stored and viewable on WordPress Backend</li><li>Multi-page forms</li><li>Post Field</li><li>Advanced fields for Name, Email, Address, etc.</li><li>Drag-and-Drop form creation</li><li>Create dynamic notifications using merge tags</li><li>Ability to add custom logic through hooks</li><li>Conditional logic to hide or show fields</li><li>and MUCH MORE!</li></ul><p>I can imagine and have seen or personally used Gravity forms to create:</p><ul><li>A quiz that would send a custom notification to the user based on the answers that were given.</li><li>A multi-page application form that lets the user know how far they are in to the application process.</li><li>A small e-commerce store that sells products, collects payment, and then delivers product</li></ul><p>Now that you&#8217;re acquainted with some of the features of Gravity Forms, let me run you through the backend so you can see for yourself how easy and intuitive it is to create your own custom forms. This plugin really is a time-saving beast!</p><div
id="attachment_185" class="wp-caption aligncenter" style="width: 500px"> <img
class="size-large wp-image-185" title="gravity-forms-builder" src="http://www.ericbinnion.com/wp-content/uploads/2012/04/gravity-forms-builder1-500x312.jpg" alt="Gravity Forms form builder" width="500" height="312" /><p
class="wp-caption-text">Gravity Forms form builder</p></div><p>Above is a picture of the form builder within gravity forms. This is one of gravity forms biggest selling points, and why I recommend it so highly in this review. If you manage multiple websites or multiple forms on one website, then this is going to be a killer time-saving feature. You can simply click each box, the box will slide down with some extra options, and then you can choose between these options which include things such as custom logic, required field, or values.</p><div
id="attachment_184" class="wp-caption aligncenter" style="width: 500px"> <img
class="size-large wp-image-184" title="gravity-forms-notifications" src="http://www.ericbinnion.com/wp-content/uploads/2012/04/gravity-forms-notifications-500x312.jpg" alt="Gravity Forms Notifications" width="500" height="312" /><p
class="wp-caption-text">Gravity Forms Notifications</p></div><p>Above is a screenshot of the gravity forms notifications builder. The notification builder allows you to create custom emails that are sent to either the website admin (or other appropriate persons) or the person who submitted the form. By customizing a submission notification we were able to create a quiz with a dynamic email that depended on what the user submitted in his questionnaire. Try doing that with a free plugin&#8230;</p><p>On top of some of these obvious features, gravity forms also allows you to advanced logic through accessing hooks and filters. An example of this would be to access the pre_submission hook in order to compute some response based on the user&#8217;s input. Another example would be writing some custom code to interface gravity forms with a 3rd-party service. This really expands gravity form&#8217;s functionality by essentially allowing you the ability to manipulate the submitted data however you need.</p><h3>Bottom Line</h3><p>It took a while for me to bite the bullet and drop the $199 for a developer&#8217;s license of Gravity Forms. But looking back, I am glad that I did. In the past few months alone I have used Gravity Forms on several websites, and have saved tons of time over having to write custom code from scratch. If you run any serious WordPress website, I highly recommend you get Gravity Forms.</p> ]]></content:encoded> <wfw:commentRss>http://www.ericbinnion.com/gravity-forms-review/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>How to Add a Google Map to your Website with Geocoding</title><link>http://www.ericbinnion.com/google-map-geocoding/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=google-map-geocoding</link> <comments>http://www.ericbinnion.com/google-map-geocoding/#comments</comments> <pubDate>Sat, 17 Mar 2012 09:29:31 +0000</pubDate> <dc:creator>Eric Binnion</dc:creator> <category><![CDATA[Web Development]]></category> <guid
isPermaLink="false">http://ericbinnion.com/?p=113</guid> <description><![CDATA[Inserting Google Maps into a website is CRAZY easy! Usually what I would advise someone to do is to: Go to Google Maps Search for the address that you want to show on your map Grab the embed code Insert embed code in your website Could it get any easier? Well, that really depends on [...]]]></description> <content:encoded><![CDATA[<p></p><p>Inserting Google Maps into a website is CRAZY easy! Usually what I would advise someone to do is to:</p><ol><li>Go to Google Maps</li><li>Search for the address that you want to show on your map</li><li>Grab the embed code</li><li>Insert embed code in your website</li></ol><p>Could it get any easier? Well, that really depends on what your development needs are. I recently completed a project for a client that owned a mobile BBQ restaurant. This client wanted a map on his website that he could easily update with the location of his mobile smoking pit. I didn&#8217;t think it made much sense to make the client do the 4 steps above just to update his map&#8230; So I decided to look into Geocoding a google map. This way, all my client had to do to update his map was to login and change the address.</p><p>For those that do not know, geocoding is essentially the process of taking an address and turning that into latitude and longitude coordinates. Google maps has geocoding baked in &#8211; FOR FREE!</p><p>Without further ado, below is some code on using geocoding with Google Maps.</p><p>This code goes in the head.</p><pre>&lt;script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript"&gt;&lt;/script&gt;</pre><p>This code can go anywhere in the body.</p><pre>&lt;div id="map" style="width: 413px; height: 300px;"&gt;&lt;/div&gt;
&lt;script type="text/javascript"&gt;
   var mapOptions = {
       zoom: 16,
      center: new google.maps.LatLng(54.00, -3.00),
      mapTypeId: google.maps.MapTypeId.ROADMAP
   };
   var geocoder = new google.maps.Geocoder();
   var address = '3410 Taft Blvd  Wichita Falls, TX 76308';
  geocoder.geocode( { 'address': address}, function(results, status) {
      if (status == google.maps.GeocoderStatus.OK) {
        map.setCenter(results[0].geometry.location);
        var marker = new google.maps.Marker({
            map: map,
            position: results[0].geometry.location
        });
      } else {
        alert("Geocode was not successful for the following reason: " + status);
      }
    });
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
   &lt;/script&gt;</pre><p>You can update the size of the map by changing the width and height values of the #map div. To change the starting zoom level, change zoom. You can change the type of map by changing mapTypeId. And most importantly, you can change the address by changing the value in var address.</p><p>You should be able to plug this code in to your website and be good to go. This code will take the address in var address, Geocode it using Google, and then center the map with a marker at the address specified.</p><p>This is a fairly simple example of Geocoding, but you could take this code and make a map that will dynamically update with user input. In a future post, I will discuss how to integrate Geocoding into WordPress so that you can easily create and edit maps without having to get latitude and longitude coordinates.</p> ]]></content:encoded> <wfw:commentRss>http://www.ericbinnion.com/google-map-geocoding/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Youtube UIWebView with Storyboards</title><link>http://www.ericbinnion.com/youtube-uiwebview-storyboards/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=youtube-uiwebview-storyboards</link> <comments>http://www.ericbinnion.com/youtube-uiwebview-storyboards/#comments</comments> <pubDate>Sun, 11 Mar 2012 22:29:29 +0000</pubDate> <dc:creator>Eric Binnion</dc:creator> <category><![CDATA[ios]]></category> <guid
isPermaLink="false">http://ericbinnion.com/?p=105</guid> <description><![CDATA[While working on the iMustangs project, we decided that it would be a good idea to include the school fight song. I&#8217;m sure we could have found a way to play a .mp3 file, but we decided that it would be best to create a video so that we could display our university logo. What [...]]]></description> <content:encoded><![CDATA[<p></p><p>While working on the iMustangs project, we decided that it would be a good idea to include the school fight song. I&#8217;m sure we could have found a way to play a .mp3 file, but we decided that it would be best to create a video so that we could display our university logo. What follows is the result of our work in using UIWebView on iOS.</p><h3>First Attempt</h3><p>Our first attempt was very light on code and pretty simple. I&#8217;d like to show this to you by running through a test project. In Xcode, go ahead and start a new single-view application.</p><p>Navigate to the Storyboard in your project. Once you are here, add a web view on top of the current view. Go ahead and stretch the web view to fill the view below. Now, let&#8217;s go ahead and connect the web view.</p><p>I like to use the assistant editor when I connect UIWebViews and other objects to outlets and actions. Click the assistant editor button near the top right of Xcode (I am currently using 4.3.1). The assistant editor will show the storyboard <strong>beside</strong> your class, so that you can easily connect an object to a specific line of code in your .h file.</p><p>Once you&#8217;re in assistant editor mode, click the UIWebView and drag it to just below @interface. Let go.</p><p>At this point another dialog should&#8217;ve popped that is asking you to name your UIWebView. Go ahead and name it webView (be sure to use correct case).</p><div
id="attachment_106" class="wp-caption aligncenter" style="width: 300px"> <a
href="http://ericbinnion.com/wp-content/uploads/2012/03/uiWebViewScreenShot.jpg" rel="lightbox[105]"><img
class="size-medium wp-image-106" title="uiWebViewScreenShot" src="http://ericbinnion.com/wp-content/uploads/2012/03/uiWebViewScreenShot-300x187.jpg" alt="uiWebViewScreenShot" width="300" height="187" /></a><p
class="wp-caption-text">Screenshot of naming the UIWebView</p></div><p>Now, navigate to your ViewController.m file and paste the following code within the viewDidLoad function. You may replace the url with one of your own.</p><pre>[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"<a href="http://www.youtube.com/embed/XeIKnBDN4To">http://www.youtube.com/embed/XeIKnBDN4To</a>"]]];</pre><p>At this point, you should be able to run this project in a simulator and see an MSU youtube video, or whatever URL you substituted. This worked fine for us, until we put it on an actual iPhone&#8230;<span
id="more-105"></span>When loading the youtube video through the cellular data plan, and not wifi, we noticed that there would be blank white screen with no activity indicator for 10-40 seconds. I found this very annoying and began to look at other ways to load a UIWebView.</p><h3>Second Attempt</h3><p>For the second attempt, my group and I decided that we needed some sort of activity indicator. What follows is a short tutorial on how to load a UIWebView with an activity indicator that will spin while the UIWebView is loading.</p><p>From earlier, we still have a UIWebView connected to our ViewController class. To add an activity indicator to our UIWebView, we need to add some more code. Edit your ViewController.h file so that it looks like the code below.</p><pre>#import &lt;UIKit/UIKit.h&gt;
@interface ViewController : UIViewController
{
    IBOutlet UIActivityIndicatorView *activityIndicator;
    IBOutlet UIWebView *webSite;
    NSTimer *timer;
}
@property (retain, nonatomic) IBOutlet UIWebView *webView;
@end</pre><p>Now, jump over to the storyboard. At this point add an Activity Indicator View. I would suggest centering, but it is your project.</p><p>We need to connect the UIWebView and the UIActivityIndicatorView now. So, go ahead and open up your assistant editor. Once you have this open, connect the UIWebView and the UIActivityIndicator to the header file.</p><p>Now, let&#8217;s jump over to the ViewController.m file and add the following code above viewDidUnload.</p><pre>- (void)viewDidLoad
{
    [webSite addSubview:activityIndicator];
    [webSite loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"https://docs.google.com/spreadsheet/embeddedform?formkey=dG5qR3F5LW5EWFBnamtqUjBQZ1dHS0E6MQ"]]];
    timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(loading) userInfo:nil repeats:YES];
    [super viewDidLoad];
}
-(void)loading
{
    if(!webSite.loading)
        [activityIndicator stopAnimating];
    else {
        [activityIndicator startAnimating];
    }
}</pre><p>Now, you should be able to run this project and get something that looks like the image at the top of this post. Below are my complete ViewController.h and ViewController.m files.</p><pre>// This is the ViewController.h
#import
@interface ViewController : UIViewController
{
    IBOutlet UIActivityIndicatorView *activityIndicator;
    IBOutlet UIWebView *webSite;
    NSTimer *timer;
}
@property (retain, nonatomic) IBOutlet UIWebView *webView;
@end</pre><pre>//This is the ViewController.m file
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize webView;
- (void)viewDidLoad
{
    [webSite addSubview:activityIndicator];
    [webSite loadRequest:[NSURLRequest requestWithURL: [NSURL URLWithString:@"http://www.youtube.com/embed/XeIKnBDN4To"]]];
    timer = [NSTimer scheduledTimerWithTimeInterval:(1.0/2.0) target:self selector:@selector(loading) userInfo:nil repeats:YES];
    [super viewDidLoad];
}
-(void)loading
{
    if(!webSite.loading)
        [activityIndicator stopAnimating];
    else {
        [activityIndicator startAnimating];
    }
}
- (void)viewDidUnload
{
    [self setWebView:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
        return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
    } else {
        return YES;
    }
}
- (void)dealloc {
    [webView release];
    [super dealloc];
}
@end</pre><p>I hope this helps you set up your UIWebView with an activity indicator. Please let me know if you have any questions or if I have messed up anything in this tutorial. It happens <img
src='http://www.ericbinnion.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /></p> ]]></content:encoded> <wfw:commentRss>http://www.ericbinnion.com/youtube-uiwebview-storyboards/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Adding Custom Overlays to iOS MapKit Framework</title><link>http://www.ericbinnion.com/adding-custom-overlays-to-ios-mapkit-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=adding-custom-overlays-to-ios-mapkit-framework</link> <comments>http://www.ericbinnion.com/adding-custom-overlays-to-ios-mapkit-framework/#comments</comments> <pubDate>Mon, 06 Feb 2012 20:26:53 +0000</pubDate> <dc:creator>Eric Binnion</dc:creator> <category><![CDATA[ios]]></category> <guid
isPermaLink="false">http://ericbinnion.com/?p=75</guid> <description><![CDATA[Series This is part 2 of a 2-part series on how to create custom overlays for the MapKit framework on iOS. View part 1 of this series here. Creating Custom Overlay in iOS Everything we have done up to this point has been to create the tiles we will use in our project. Now that [...]]]></description> <content:encoded><![CDATA[<p></p><h3>Series</h3><p>This is part 2 of a 2-part series on how to create custom overlays for the MapKit framework on iOS. View part 1 of this series <a
title="Creating Custom Overlays for iOS MapKit Framework" href="http://ericbinnion.com/creating-custom-overlays-for-ios-mapkit-framework/">here</a>.</p><h3>Creating Custom Overlay in iOS</h3><p>Everything we have done up to this point has been to create the tiles we will use in our project. Now that we have created those tiles, we need to add them to our project.</p><p>For this, we will use a sample project from Apple called Tile Map. I have a working iOS project that uses custom overlay at <a
href="https://github.com/ebinnion/iMustangs-Map-Custom-Overlay" target="_blank">Github</a>. We are going to copy a few classes from this project, so go ahead and grab the zip-ball and open it in Xcode.</p><p>You will need to copy the following files into your own project:</p><ul><li>TileOverlay.h</li><li>TileOverlay.m</li><li>TileOverlayView.h</li><li>TileOVerlayView.m</li></ul><p
style="text-align: center;"><a
href="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-05-at-11.39.49-PM.png" rel="lightbox[75]"><img
class="aligncenter" title="TileMap Project Screenshot" src="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-05-at-11.39.49-PM-300x192.png" alt="TileMap Project Screenshot" width="300" height="192" /></a></p><p>Be sure to select the box to &#8220;Copy items into destination group&#8217;s folder.&#8221; At this point I am going to assume that you have already created a View Controller for your map. If not, go ahead and create one. In the .m (implementation) file of your map View Controller, we are going to import the TileOverlay.h and TileOverlayView.h files. Your map View Controller should now look something like this:</p><p><span
id="more-75"></span></p><pre>#import "mapViewController.h"
#import "TileOverlay.h"
#import "TileOverlayView.h"
@implementation mapViewController
- (void)viewDidLoad
{
    NSString *tileDirectory = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Tiles"];
    TileOverlay *overlay = [[TileOverlay alloc] initWithTileDirectory:tileDirectory];
    [map addOverlay:overlay];
    map.mapType = MKMapTypeSatellite;
    MKCoordinateRegion CSC;
    // Defines the center point of the map
    CSC.center.latitude = 33.874809;
    CSC.center.longitude = -98.521129;
    // Defines the view,able area of the map. Lower numbers zoom in!
    CSC.span.latitudeDelta = .003;
    CSC.span.longitudeDelta = .003;
    [map setRegion:CSC animated:YES];
}
- (MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id )overlay
{
    TileOverlayView *view = [[TileOverlayView alloc] initWithOverlay:overlay];
    view.tileAlpha = 0.6;
    return [view autorelease];
}</pre><p>The only other change that we have to make at this point is to add some code to our app delegate file. In the delegate header file you will need to add some code (highlighted below):</p><pre>#import
@class mapViewController;
@interface msuAppDelegate : NSObject {
    UIWindow *window;
    mapViewController *viewController;
}
@property (strong, nonatomic) UIWindow *window;
@property (strong,nonatomic) mapViewController *viewController;
@end</pre><p>We still don&#8217;t have tiles in our project at this point, so go ahead and create a directory on your Desktop named &#8220;Tiles&#8221;. Copy all of the tile sub-directories and the tilemapresource.xml into the &#8220;Tiles&#8221; folder that you created on the desktop. Now, drag the &#8220;Tiles&#8221; folder into your iOS project. Be sure to select &#8220;Copy items into destinations group&#8217;s folder&#8221; and &#8220;Create folder references for any added folders.&#8221;</p><div
id="attachment_81" class="wp-caption aligncenter" style="width: 300px"> <a
href="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-06-at-6.08.55-PM-e1328573379892.png" rel="lightbox[75]"><img
class="size-medium wp-image-81" title="Copying Tiles folder into iOS Project" src="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-06-at-6.08.55-PM-300x187.png" alt="Copying Tiles folder into iOS Project" width="300" height="187" /></a><p
class="wp-caption-text">Copying Tiles folder into iOS Project</p></div><p>The last step is to connect your Mk Map View in storyboard to delegate. Once we do that, the Custom Overlay for MapKit should be working. Click the Mk Map View in storyboard, use control + click, then drag, to the Map View Controller Icon. View the screenshots below.</p><div
id="attachment_76" class="wp-caption aligncenter" style="width: 300px"> <a
href="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-06-at-2.18.18-PM-e1328559602446.png" rel="lightbox[75]"><img
class="size-medium wp-image-76" title="Mk Map View Screenshot" src="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-06-at-2.18.18-PM-300x187.png" alt="Mk Map View Screenshot" width="300" height="187" /></a><p
class="wp-caption-text">Mk Map View Screenshot</p></div><div
id="attachment_77" class="wp-caption aligncenter" style="width: 300px"> <a
href="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-06-at-2.18.24-PM-e1328559615977.png" rel="lightbox[75]"><img
class="size-medium wp-image-77" title="Connect Mk Map View Screenshot" src="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-06-at-2.18.24-PM-300x187.png" alt="Connect Mk Map View Screenshot" width="300" height="187" /></a><p
class="wp-caption-text">Connect Mk Map View Screenshot</p></div><div
id="attachment_78" class="wp-caption aligncenter" style="width: 300px"> <a
href="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-06-at-2.18.26-PM-e1328559626810.png" rel="lightbox[75]"><img
class="size-medium wp-image-78" title="Map View Controller Delegate" src="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-06-at-2.18.26-PM-300x187.png" alt="Map View Controller Delegate" width="300" height="187" /></a><p
class="wp-caption-text">Map View Controller Delegate</p></div><p>At this point go ahead and run your program to see if everything is working. If you have any problems, please leave me a comment below, and I will modify this tutorial. You can reference the <a
href="https://github.com/ebinnion/MSU-iMustangs">iMustangs project  on Github</a> for an example of integrating custom overlays into an iOS project.</p> ]]></content:encoded> <wfw:commentRss>http://www.ericbinnion.com/adding-custom-overlays-to-ios-mapkit-framework/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Creating Custom Overlays for iOS MapKit Framework</title><link>http://www.ericbinnion.com/creating-custom-overlays-for-ios-mapkit-framework/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=creating-custom-overlays-for-ios-mapkit-framework</link> <comments>http://www.ericbinnion.com/creating-custom-overlays-for-ios-mapkit-framework/#comments</comments> <pubDate>Mon, 06 Feb 2012 05:49:46 +0000</pubDate> <dc:creator>Eric Binnion</dc:creator> <category><![CDATA[ios]]></category> <guid
isPermaLink="false">http://ericbinnion.com/?p=69</guid> <description><![CDATA[I am part of a team developing an iPhone app for Midwestern State University. I am particularly responsible for developing the map that we are going to use for the app. Because I had a lot of detail I wanted to show on our map &#8211; Faculty/Commuter/Resident Parking Lots,  labels for different buildings, key points [...]]]></description> <content:encoded><![CDATA[<p></p><p>I am part of a team developing an iPhone app for Midwestern State University. I am particularly responsible for developing the map that we are going to use for the app. Because I had a lot of detail I wanted to show on our map &#8211; Faculty/Commuter/Resident Parking Lots,  labels for different buildings, key points of interest on campus &#8211; I began to look into using custom overlays, a large image laid of top of the Google map tiles.</p><p>One of the issues I ran into was a lack of good information on how to integrate custom overlays into an <strong>existing</strong> iOS project. What follows is the process used to create and integrate custom overlays into an existing iOS app.</p><h3>Create Overlay Image</h3><p>I knew from the beginning that I would need some graphic of Midwestern State University to serve as a foundation for me to build my overlay image. To get the background image, I:</p><ul><li>Went go Google Maps</li><li>Grabbed the embed code for the location I wanted</li><li>Created a quick HTML document with the embed code in it</li><li>I changed the size of the iframe to about 4,000 px by 4,000 px</li><li>I used a plugin for Google Chrome browser that took a screenshot of the <strong>entire</strong> page</li></ul><p>This gave me a background image that I could put into Photoshop and then build upon. I used 300 PPI and set my image size to about 3,000 px by 4,000 px. With a smaller image size or lower resolution I noticed that I had very jagged edges. You can tweak these image settings to your project.</p><p>Start building your overlay on top of this background image. When you have an overlay image that you are happy with, hide the background, and export your image. I exported my image as a PNG-24 since I had large amounts of blank area on the image.</p><h3>Find the Corner Coordinates</h3><p>The best way I found to match the corner pixels of the image to coordinates is to:<br
/> <span
id="more-69"></span></p><ul><li>Create a copy of your overlay image, this time with a red border</li><li>Add your overlay image to Google Earth<p><div
id="attachment_72" class="wp-caption aligncenter" style="width: 300px"> <a
href="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-05-at-11.24.36-PM-e1328506220778.png" rel="lightbox[69]"><img
class="size-medium wp-image-72" title="Custom overlay with red border added" src="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-05-at-11.24.36-PM-300x187.png" alt="Custom overlay with red border added" width="300" height="187" /></a><p
class="wp-caption-text">Custom overlay with red border added</p></div></li><li>Stretch/move your image so that it lines up. Below is the result that I had.<p><div
id="attachment_71" class="wp-caption aligncenter" style="width: 300px"> <a
href="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-05-at-11.25.04-PM-e1328506233237.png" rel="lightbox[69]"><img
class=" wp-image-71" title="Close up of overlay image" src="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-05-at-11.25.04-PM-300x187.png" alt="Close up of overlay image" width="300" height="187" /></a><p
class="wp-caption-text">Close up of overlay image</p></div></li><li>Drop a pin on each corner of your image. Be sure to zoom in as close as possible, and get the pin as close to the corner as possible<p><div
id="attachment_73" class="wp-caption aligncenter" style="width: 300px"> <a
href="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-05-at-11.24.53-PM-e1328506205691.png" rel="lightbox[69]"><img
class="size-medium wp-image-73" title="Close up of pin" src="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-05-at-11.24.53-PM-300x187.png" alt="Close up of pin" width="300" height="187" /></a><p
class="wp-caption-text">Close up of pin</p></div></li><li>Right click on each pin in the left toolbar, and select &#8220;Directions from here&#8221;</li></ul><div>Selecting &#8220;directions from here&#8221; will put the coordinates for the pin in the search form. Copy these down.</div><h3>Create Custom Overlay Tiles</h3><p>MapKit, and Google Maps, works by using map tiles. These are square images that only load if they are viewable in the zoom level that you are looking at. Thankfully, there is a tool called GDAL that will take our overlay image and cut it up into all of the tiles that we need. Take a minute and go download and install GDAL. If you&#8217;re on a Mac, I would suggest using <a
href="http://www.kyngchaos.com/software/frameworks" target="_blank">Kyng Chaos</a>. I will be giving the Mac commands below, but I assume that they are similar on a PC.</p><p>Because we are referencing each corner pixel of our overlay image to a coordinate, we need to know how many pixels wide and tall our image is. To do this, we are going to use the gdalinfo command. Before we can use gdalinfo though, we need to get in the directory of our image/project. Go ahead and navigate to the directory of your project, then use the gdalinfo command followed by your image name. Your commands should look something similar to this:</p><pre>cd /Users/ericbinnion/Desktop/imgDirectory-Here
gdalinfo imgName.png</pre><p>This should give us some information that looks like the image below:</p><div
id="attachment_70" class="wp-caption aligncenter" style="width: 300px"> <a
href="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-05-at-8.52.39-PM.png" rel="lightbox[69]"><img
class="size-medium wp-image-70" title="gdalinfo screenshot" src="http://ericbinnion.com/wp-content/uploads/2012/02/Screen-Shot-2012-02-05-at-8.52.39-PM-300x216.png" alt="gdalinfo screenshot" width="300" height="216" /></a><p
class="wp-caption-text">A screenshot of the gdalinfo command on Mac.</p></div><p>Next, we will create our VRT file which will reference the coordinates to the corner pixels. To do this, use the following command:</p><pre>gdal_translate -of VRT -a_srs EPSG:4326 -gcp 0 0 -98.526518119 33.8812011706 -gcp 1055 0 -98.5158112852 33.8811992984 -gcp 1055 1584 -98.5158116258 33.8679003639 -gcp 0 1584 -98.5265176807 33.8679047769  msuMap.png msuMap.vrt</pre><p>You will of course replace the coordinate points, the image name, and the vrt name that you want create to fit your project. The last step of the project is to actually create the tiles. To do this, we will use the following command.</p><pre>python gdal2tiles.py -z 14-21  msuMap.vrt</pre><p>This will create tiles for zoom levels 14-21 using the msuMap.vrt file that we created in the last step. At this point you should see some html files in your project. These will give you a preview of how your custom overlay will look on MapKit for iOS.</p><h3>Series</h3><p>This is part 1 of a 2-part series in &#8220;How to Create Custom Overlay Tiles for iOS MapKit Framework.&#8221; View part 2 <a
title="Adding Custom Overlays to iOS MapKit Framework" href="http://ericbinnion.com/adding-custom-overlays-to-ios-mapkit-framework/">here</a>.</p> ]]></content:encoded> <wfw:commentRss>http://www.ericbinnion.com/creating-custom-overlays-for-ios-mapkit-framework/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> </channel> </rss>
