Geocoding with Redis

Geocoding with Redis

𝐀𝐮𝐭𝐡𝐨𝐫’𝐬 𝐍𝐨𝐭𝐞\textbf{Author's Note}: This is a heavily truncated republication of my submission notes for the 2022 Redis Hackathon.


A geocoder is a service for matching addresses to geographic locations and the entities containing those addresses. Geocoders use both geospatial queries and full text search to resolve incomplete addresses to addresses and locations from a validated. This project builds a geocoder using Redis Search and PubSub to provide both synchronous and asynchronous geocoding services. I go into detail about the implementation of this application in this walk-through video.

𝐅𝐢𝐠𝐮𝐫𝐞 𝟏.𝟎: 𝐒𝐲𝐧𝐜𝐡𝐫𝐨𝐧𝐨𝐮𝐬 𝐆𝐞𝐨𝐜𝐨𝐝𝐢𝐧𝐠 𝐀𝐫𝐜𝐡𝐢𝐭𝐞𝐜𝐭𝐮𝐫𝐞\textbf{Figure 1.0: Synchronous Geocoding Architecture} — The synchronous geocoding API allows a user to submit a query address or location and receive a list of scored, potentially matching addresses.

curl -XPOST https://gc.dmw2151.com/geocode/ \
  -d '{
     "method": "FWD_FUZZY", 
     "max_results": 1, 
     "query_addr": "ATLANTIC AVE BROOKLYN"
   }' 

{
  "result": [
    {
      "address": {
        "id": "address:5185505" 
        "location": {
          "latitude": 40.676468, 
          "longitude": -73.909355
        },
      },
      "normed_confidence": 1,
      "full_addr": "211 ATLANTIC BROOKLYN 11233"
    }
  ]
}

𝐅𝐢𝐠𝐮𝐫𝐞 𝟏.𝟏: 𝐀𝐬𝐲𝐧𝐜𝐡𝐫𝐨𝐧𝐨𝐮𝐬 𝐆𝐞𝐨𝐜𝐨𝐝𝐢𝐧𝐠 𝐀𝐫𝐜𝐡𝐢𝐭𝐞𝐜𝐭𝐮𝐫𝐞\textbf{Figure 1.1: Asynchronous Geocoding Architecture} — The asynchronous API allows a user to submit a batch of addresses for geocoding. A request to this endpoint will kick-off a series of backend processes that asynchronously resolve all requested addresses.

The asynchronous geocoding API makes requests through Geocoder Edge and uses Redis Search to handle address resolution.