The steps for this are as follows:
- We will use latitude 40.709677 and longitude -74.00365 for the Brooklyn Bridge in the following SQL statement:
SELECT atm."BankName", atm."Address"
FROM "ATM coordinates" atm
ORDER BY geog <-> ST_SetSRID(ST_MakePoint(-74.00365, 40.709677), 4326);
The result of the preceding query is shown in the following screenshot:
Figure 5.21 – The ATM machines ordered by proximity to the Brooklyn Bridge
- You can change the location from the Brooklyn Bridge to any other location to test your SELECT query; for instance, you could use New York City Hall (the latitude and longitude coordinates are 40.712772, -74.006058), the Rockefeller Center (latitude 40.758740, longitude -73.978674), and the Metropolitan Museum of Art (latitude 40.778965, longitude -73.962311).