Clousby — Löydä minkä tahansa kadun lähimmät palvelut

Kasperi Keski-Loppi - Published 25.1.2021 - updated 16.3.2021

  1. 2021-01-25-101932.871883clousbyfindnearestservices.png
  2. 2021-01-25-101932.943926clousbyresultsforyliopistonkatu1.png
  3. 2021-01-25-101933.001595clousbyservicesnearyliopistonkatu120100.png
  4. 2021-01-25-101933.051240clousbybestrestaurantsnearyliopistonkatu120100.png

When you travel or move to a new neighbourhood, finding the nearest services can be difficult and slow. Why not enter the address on Clousby and find the nearest services immediately?

DATASET 1 — ADDRESSES Addresses were read from the open dataset about Finnish buildings, addresses, postcodes and WGS84 coordinates. Localities had to be retrieved from Google's Geolocation API (https://developers.google.com/maps/documentation/geocoding/overview) since the open dataset didn't have it. This part is still Work in Progress.

DATASET 2 — SERVICES The services, i.e. points of interest, were read from the open datasource http://download.geofabrik.de/europe/finland.html that is an extract from the OpenStreetMap.org-database.

FILTERING Both datasets were filtered to obtain better data for the context. Filtering removed data such as (1) addresses that had no street or avenue, (2) points of interest that had no name, and (3) points of interest that were not meaningful to the application.

Filtering was done in two parts: (1) when the raw data was read into the database and (2) modifying the database. This solution felt natural since we could utilize "dummy" filtering on the former and more advanced filtering on the latter.

The original dataset 1 included about 3,6 million addresses from which little under 2 million were left into the database. The end product has 3 147 unique postal codes (the original amount was not checked).

TECHNICAL IMPLEMENTATION Every address got a unique slug field that includes street/avenue, housenumber, and a postal code (e.g. "yliopistonkatu-2-20100"). This slug field allowed creating a unique "homepage" for each address. The homepage includes the services that are near the given street (e.g. https://clousby.com/en/streets/yliopistonkatu-2-20100).

The services are constructed dynamically based on the coordinates of the addresses and the services. Simply said, the database is asked the following: "Give the services that are within 1000 meters of the coordinates of Yliopistonkatu 1 20100, and order them by distance, starting from the nearest". The result is then categorized by amenities, and shown on the address' homepage.

TOOLING - Docker 20.10.2 - Docker Compose 1.27.4 - Ruby 2.7.2 - Ruby on Rails 5.2.4.4 - PostgreSQL 11.2 - PostGIS 2.5.2


Used datasets