The present invention discloses a method and system for generating sole glue-spraying track automatically based on linear structure light sensor. Obtaining upper underside three-dimensional coordinates data using linear laser, vidicon, mobile platform and computer, and generating glue-spraying track automatically. The linear laser scans upper underside continuously, and the vidicon collects laser scanning image at the same time, then distilling laser beam center in the image and transforming to three-dimensional coordinates through image processing, thus obtaining point-cloud data of upper underside, generating glue-spraying track according to the point-cloud data. Compared with the method by machine, the generating method of the present invention has the advantage of high orientation precision, simple operation method, strong adaptability, high efficiency etc., and has great superiority.