code: public function format(Polyline $polyline): string
      {
          $points = [];
  
          foreach ($polyline->getPoints() as $point) {
              $points[] = [$point->getLng(), $point->getLat()];
          }
  
          return json_encode(
              [
                  'type'        => 'LineString',
                  'coordinates' => $points,
              ]
          );
      }
docs: @param Polyline $polyline
  
  @return string