Latest 1.1.0
Homepage https://github.com/keisukeYamagishi/GMSDirection
License MIT
Platforms ios 8.0
Authors

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

install this code

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

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

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

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){

        [GMSDirection 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.

Latest podspec

{
    "name": "GMSDirection",
    "version": "1.1.0",
    "summary": "You can easily search the route..",
    "homepage": "https://github.com/keisukeYamagishi/GMSDirection",
    "license": "MIT",
    "authors": {
        "keisuke": "[email protected]"
    },
    "social_media_url": "https://twitter.com/O_Linker_Error",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/keisukeYamagishi/GMSDirection.git",
        "tag": "1.1.0"
    },
    "source_files": [
        "GMSDirection",
        "GMSDirection/*.{h,m}"
    ]
}

Pin It on Pinterest

Share This