Whether the longitude and latitude of the house are within the four corners of the default area? If not, calculate the distance between the house and the location based on the longitude and latitude, and then enlarge the default display area based on the distance
I happened to meet a similar requirement, here’s our approach for reference: 1. Initiate a request to pass the current user coordinates to the background. 2. Let the background sort the surrounding properties within a certain range (the background is adjustable) according to the user's location and return. 3. After the front-end requests the data, the nearest listing is the first in the array. At this time, the showAnnotations method of the map API is called to display the user's location and the pins of the nearest listings. (Amap)
1. Submit the current coordinates 2. The server first filters the listings according to the default visible range 3. If there are no listings or the number of listings is small, expand the viewing range and re-filter until enough listing information is filtered out 4. Return to client
Whether the longitude and latitude of the house are within the four corners of the default area? If not, calculate the distance between the house and the location based on the longitude and latitude, and then enlarge the default display area based on the distance
I happened to meet a similar requirement, here’s our approach for reference:
1. Initiate a request to pass the current user coordinates to the background.
2. Let the background sort the surrounding properties within a certain range (the background is adjustable) according to the user's location and return.
3. After the front-end requests the data, the nearest listing is the first in the array. At this time, the showAnnotations method of the map API is called to display the user's location and the pins of the nearest listings. (Amap)
1. Submit the current coordinates
2. The server first filters the listings according to the default visible range
3. If there are no listings or the number of listings is small, expand the viewing range and re-filter until enough listing information is filtered out
4. Return to client