문제

I stored the latitude and longitude from a lot of gasstations in a database. I also made a Google Maps. Now, I want to select the gasstations from my database where latitude and longitude are between the North East Latitude / Longitude and South West Latitude / Longitude from my Google Maps.

How can i calculate which gasstations I have to select?

도움이 되었습니까?

해결책

Simply modify your database query in the backend to only return locations between your points. Something like the first answer here.

Obviously the syntax will depend on the database that you are using.

Actually I would suggest using:

SELECT * FROM tilistings WHERE lat BETWEEN a AND c AND lng between b AND  d

Where a and b are you top left coordinates and c and d are your bottom right. I think BETWEEN is more performant.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top