This invention provides a method, apparatus, electronic device, and storage medium for determining
GeoHash codes. First, the
minimum bounding rectangle of the region to be identified is determined. Next, the
GeoHash codes corresponding to the vertex grids containing any three vertices of the
minimum bounding rectangle are determined. Then, based on the
GeoHash codes of the three vertex grids, a preset character table is looked up multiple times to determine the GeoHash codes of all grids within the
minimum bounding rectangle. Finally, from the GeoHash codes of all grids, the GeoHash codes of each target grid that overlaps with the region to be identified are selected. In this invention, the preset character table includes 32 characters from a Base32 encoding table, and the positions of these 32 characters in the preset character table are determined based on the encoding principle of GeoHash codes. Therefore, the GeoHash codes of all grids within the minimum bounding rectangle can be determined by looking up the table. Compared to the multiple encoding conversions in existing technologies, this invention uses a table lookup method, reducing the computational load and improving the computational speed.