Automatic labeling of geological codes is an important part of automatic mapping of geological maps. A multi-factor optimization based automatic labeling method is proposed to address the issue of existing polygon feature label placement methods being unable to achieve multi-position placement in geological codes. Firstly, classify geological bodies based on whether they can accommodate geological codes within the area; Subsequently, sufficient candidate positions are obtained for the geological body and a candidate position evaluation method that integrates multiple factors is proposed; Finally, based on the candidate position evaluation method, sorting and particle swarm optimization algorithms are used to achieve single position labeling and multi-position labeling. The simulation experiment compares it with existing polygon feature placement methods from the perspectives of coverage, shape, and method. The method proposed in this paper can automatically placement non-conflicting geological codes for geological bodies of different shapes and areas, and has better performance than existing methods in complex geological bodies.