The invention provides a longitude and latitude ranging method based on privacy protection and machine load balance, which comprises the following steps of: firstly, two coordinates of longitude and latitude are represented by using a character string in geohash; in some cases, the indexes cannot be applied on two columns at the same time, and the indexes only need to be applied on one column by utilizing geohash, so that resources and cost consumption are saved. Secondly, the geohash represents a rectangular area instead of a point; and it can be indicated that the user is located near a certain area, the accurate coordinate of the user is not exposed, and privacy protection is facilitated. Third, the encoded prefix may represent a larger region. The characteristic can be used for nearby location search. Firstly, geohash is calculated according to current coordinates of a user, then prefixes of the geohash are taken for query, and all nearby places can be queried. The geohash is more efficient than the calculation (semi-versine formula) directly using longitude and latitude. The method effectively solves the problems of privacy protection and machine load balance.