Comment find la longueur du path Google Maps

J'utilise le SDK Google Maps pour iOS et j'ai créé un itinéraire à l'aide de l'object GMSMutablePath . Dans la documentation de l' API , il dit qu'il a une fonction appelée lengthOfKind qui calcule la longueur du path, mais il nécessite un object de type GMSLengthKind .

 (CLLocationDistance) lengthOfKind: (GMSLengthKind) kind Returns the length of the path, according to kind. See GMSLengthKind. 

Cependant, il n'y a nulle part dans la documentation qui mentionne un GMSLengthKind et je n'arrive pas à find quelque chose qui aurait du sens pour l'input. Est-ce que quelqu'un sait ce que l'inout devrait être ou s'il y a une autre façon de calculer la longueur du path?

C'est le lien que j'ai consulté

GMSLengthKind est défini dans GMSPath.h:

 /** * kGMSEquatorProjectedMeter may be useful when specifying lengths for segment in "projected" units. * The value of kGMSEquatorProjectedMeter, 1/(pi * EarthRadius), represents the length of one meter * at the equator in projected units. For example to specify a projected length that corresponds * to 100km at the equator use 100000 * kGMSEquatorProjectedMeter. * See [GMSPath segmentsForLength:kind:], [GMSPath lengthOfKind:] and kGMSLengthProjected. */ extern const double kGMSEquatorProjectedMeter; /** * GMSLengthKind indicates the type of a length value, which can be geodesic (in meters), rhumb * length (in meters) and projected length (in GMSMapPoint units). */ typedef enum { /* * Geodesic length, in meters, along geodesic segments. May be useful, for example, to specify * lengths along the the trajectory of airplanes or ships. */ kGMSLengthGeodesic, /* * Rhumb length, in meters, along rhumb (straight line) segments. May be useful, for example, to * draw a scale bar on a map. The visual size of a segment of a given length depens on the * latitude. */ kGMSLengthRhumb, /* * Length in projected space, along rhumb segments. Projected length uses the same units as * GMSMapPoint - the Earth equator circumference has length 2. It is possible to specify projected * length in units corresponding to 1 meter at the equator by multiplying with * kGMSEquatorProjectedMeter, equal to 1/(pi * EarthRadius). * * Projected length may be useful, for example, to specify segments with the same visual length * regardless of latitude. */ kGMSLengthProjected } GMSLengthKind; 

// coord est un tableau de coordonnées

GMSMutablePath path = [[GMSMutablePath alloc] init];

 for (NSSsortingng * row in coord) { NSArray *array = [row componentsSeparatedBySsortingng:@"|"]; double lat = [[array objectAtIndex: 0] doubleValue]; double lon = [[array objectAtIndex: 1] doubleValue]; [path addCoordinate:CLLocationCoordinate2DMake(lat, lon)]; } // Geodesic length, in meters, along geodesic segments NSLog(@"Lenght Length Projected=%f",[path lengthOfKind:kGMSLengthProjected]); // Rhumb length, in meters, along rhumb (straight line) segments NSLog(@"Lenght Length Rhumb=%f",[path lengthOfKind:kGMSLengthRhumb]); // Length in projected space, along rhumb segments. NSLog(@"Lenght Length Geodesic=%f",[path lengthOfKind:kGMSLengthGeodesic]);