I am using the geocoder gem to translate addresses to coordinates in my Ruby on Rails app. For no apparent reason, some addresses are not found, even though they are structured exactly the same way. Does anyone know the cause of this?
f.e. This address works:
irb(main):001:0> first_activity = Activity.create(address: "Carrer de la Bisbal, 31, 43371 Margalef, Tarragona, Spanien", name: "test", crag: Crag.first, user: User.first)
Crag Load (0.5ms) SELECT "crags".* FROM "crags" ORDER BY "crags"."id" ASC LIMIT $1 [["LIMIT", 1]]
User Load (0.6ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT $1 [["LIMIT", 1]]
TRANSACTION (0.3ms) BEGIN
Activity Create (1.6ms) INSERT INTO "activities" ("name", "user_id", "description", "created_at", "updated_at", "crag_id", "address", "latitude", "longitude") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id" [["name", "test"], ["user_id", 183], ["description", nil], ["created_at", "2022-10-11 13:58:36.299172"], ["updated_at", "2022-10-11 13:58:36.299172"], ["crag_id", 287], ["address", "Carrer de la Bisbal, 31, 43371 Margalef, Tarragona, Spanien"], **["latitude", 41.285139], ["longitude", 0.7525548]**]
TRANSACTION (2.2ms) COMMIT
=>
#<Activity:0x00007fe3e4d6f9c8
This one doesn't:
irb(main):002:0> second_activity = Activity.create(address: "Carrer Anselm Clavé, 10, 43371 Margalef, Tarragona, Spanien", name: "test", crag: Crag.first, user: User.first)
Crag Load (0.7ms) SELECT "crags".* FROM "crags" ORDER BY "crags"."id" ASC LIMIT $1 [["LIMIT", 1]]
User Load (0.3ms) SELECT "users".* FROM "users" ORDER BY "users"."id" ASC LIMIT $1 [["LIMIT", 1]]
TRANSACTION (0.3ms) BEGIN
Activity Create (0.6ms) INSERT INTO "activities" ("name", "user_id", "description", "created_at", "updated_at", "crag_id", "address", "latitude", "longitude") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9) RETURNING "id" [["name", "test"], ["user_id", 183], ["description", nil], ["created_at", "2022-10-11 14:01:41.745486"], ["updated_at", "2022-10-11 14:01:41.745486"], ["crag_id", 287], ["address", "Carrer Anselm Clavé, 10, 43371 Margalef, Tarragona, Spanien"], **["latitude", nil], ["longitude", nil]**]
TRANSACTION (2.0ms) COMMIT
=>
#<Activity:0x00007fe3e57de850