Postgis : How to make only one query with 2 queries

Traces db : A trace is an hiking path create_table “traces”, force: :cascade do |t| t.string “name” t.geometry “path”, limit: {:srid=>4326, :type=>”line_string”} end Pois db : A Poi is a Point of Interest (city, castel…) create_table “pois”, force: :cascade do |t| t.string “address” t.string “address2” t.integer “zip_code” t.string “city” t.string “department” t.string “region” t.float “latitude”…