GoogleMapDirection 1.2.1

GoogleMapDirection 1.2.1

Maintained by Keisuke Yamagishi.



SHIDirection

Direction for Google Map for iOS SDK

How to use

tap the window

make marker

one more tap

make two marker

It appears a line connecting the two markers

Direction !!!

You can change the the search method press the WALKINGH button

Use it

Via SSH: For those who plan on regularly making direct commits, cloning over SSH may provide a better experience (which requires uploading SSH keys to GitHub):

$ git clone [email protected]:keisukeYamagishi/SHIDirection.git

Via https: For those checking out sources as read-only, HTTPS works best:

$ git clone https://github.com/keisukeYamagishi/SHIDirection.git`

if click download button !!! right now!!!

Installation

Cocoapods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate GMSDirection into your Xcode project using CocoaPods, specify it in your Podfile:

vi ./Podfile 
target 'Target Name' do
  pod 'GMSDirection'
end

Then, run the following command:

$ pod setup
$ pod install

Easy start

default map line width 0.6f default map color #4682b4

get route!!!!

    GMSDirection* direction = [[GMSDirection alloc]initWithStart:latlng destinationLoc:desLang];
    
    direction.directionType = GMSDirectionTypeWalking;
    
    [direction directionsCompletionHandler:^(GMSRouteDto* routeData){
        
        [THisClass addOverLay:routeData map:_mapview];
        
    }failureHandler:^(GMSError* error){
        
    }];

There is also this kind of use

    GMSDirection* direction = [[GMSDirection alloc]initWithStart:_latLngArray[0] goal:_latLngArray[1]];
    
    direction.directionType = GMSDirectionTypeWalking;
    
    [direction directionsCompletionHandler:^(GMSRouteDto* routeData){
        
        [THisClass addOverLay:routeData map:_mapview withLineColor:SHIDodgerBlueColor];
                
    }failureHandler:^(GMSError* error){
        NSLog(@"Error : %@" ,error.userInfo[GMSErrorDescriptionKey]);
    }];

+ (GMSPolyline*)convertPolyLine:(NSString*)route{
    GMSPath *path = [GMSPath pathFromEncodedPath:route];
    return [GMSPolyline polylineWithPath:path];
}

+(void)addOverLay:(GMSRouteDto*)route map:(GMSMapView *)map withLineColor:(NSString *)color{
    for( NSString* line in route.routePattern ){
        if(line!=nil){
            [THisClass addRouteToMap:[THisClass convertPolyLine:line] withMap:map withColor:color];
        }
    }
}

+(void)addOverLay:(GMSRouteDto*)route map:(GMSMapView *)map{
    for( NSString* polyline in route.routePattern ){
        if(polyline!=nil){
            [THisClass addRouteToMap:[ViewController convertPolyLine:polyline] withMap:map withColor:SHICyanColor];
        }
    }
}

+(void)addRouteToMap:(GMSPolyline *)line withMap:(GMSMapView *)map withColor:(NSString *)color{
    if(color==nil
       || color.length <= 0){
        color = SHIDodgerBlueColor;
    }
    line.strokeColor=[SHColorSixteen colorCovertSixteen:color alpha:0.9];
    line.strokeWidth=6.0f;
    line.map=map;
}


too easy!!

Please pass the first position and the goal of the position as parameter

get route

LICENCE

SHIDirection is licensed under the MIT license.