How to use the maps visualization?

#1

Hello all,

I have gone through the documentation and I still don’t understand how the maps feature works. I am running version 0.31.2

The documentation says to use an API from Google in order to use latitude and longitude:

I get this message:

and I have no idea how to set this up - there are not inputs for a Google Maps API key:

This is my dataset:

Can someone help me out please?

#2

If your table has a latitude and longitude column and you select the Map visualization, it should work automatically. You can try it with the People table in the Sample Dataset to see how it should work.

If your dataset is the result of a SQL query, you might be running into this bug: https://github.com/metabase/metabase/issues/9346

The bit on that doc page about configuring a google maps api key I believe is wrong/out of date. I’ll fix that.

EDIT: Actually, the documentation you’ve shown in your screenshot I believe is from an old version. Please double check you’re referring to the latest version of the docs: https://metabase.com/docs/latest/

#3

@maz thanks for the quick reply. I am still struggling in understanding with this issue. that is asking me for a region map.

#4

Ok so I got to this point. But I still don’t get it. I do have longitude an latitude data but is not recognizing it.

#5

Is there a tutorial on how to get a map working?

#6

@rviteri
Are you getting your dataset from a Custom Query or Native Query (SQL)?
What is the “Field Type” of Latitud 1 and Longitud 1?
Admin Settings > Data Model > (database) > (table) > (column) :gear:
There’s a handful of various fixes to maps in 0.32.x

#7

Native Query:

select V.id, V.fecha,
CONCAT( A.apellidos, " ", A.Nombre) as Doctor,
B.nombre_padre as Direccion,
B.latitud as Latitud_1,
B.longitud as Longitud_1,
(SELECT CONCAT( C.apellidos, ’ ', C.nombre )
FROM adm_user C
WHERE C.id = V.id_visitador
) as Visitador,
T.detalle as Tipo_Comentario,
V.detalle as Comentario
from visitas_doctor V
inner join tipos_comentarios T on T.id = V.id_tipo_comentario
inner join adm_user A on A.id = V.id_doctor
INNER JOIN adm_user_doctor B ON B.id = A.id
order by V.id desc

The fields are set to latitude and longitude respectively:

Updated to the latest version 0.32.8

Result:


I am only able to select the ID field for both latitude and longitude.

#8

I think you’re seeing one of these issues:
https://github.com/metabase/metabase/issues/5196
https://github.com/metabase/metabase/issues/8551

#9

I think this is the issue that I am facing.

What is the data type the field must have in order for the maps to work?

Thx.

#10

@rviteri
I can create the Pin Map from the Sample Dataset.

#11

what is the data type that must be set in order for metabase to recognize the field?

I have mine set up like this using the CAST and DECIMAL functions:

The other issue is that after the second decimal place it becomes rounded

#12

My first guess would be FLOAT.
Remember that the Table formats numbers to 2 decimals - but that’s just formatting (you can change that in :gear:)

#13

Thanks. I am not trying anymore at the moment - there is very little documentation with regards to this. Will look for a different tool for this job.

Actually, I just found out that the points will not render if the table is larger than 1000 rows.

#14

That’s a known issue:
https://github.com/metabase/metabase/issues/4394