R script to analyze the OSM data (PostGIS)