How to use the maps visualization?

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?

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/

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

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.

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

@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

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.

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

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.

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

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

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:)

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.

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

Just found a way for Google Maps to work in Metabase.

When you open the Admin Panel > Maps

Changing the “lyrs” argument to any of these letters will give you the following types of map view

  • h = roads only
  • m = standard roadmap
  • p = terrain
  • r = somehow altered roadmap
  • s = satellite only
  • t = terrain only
  • y = hybrid

Make sure you use the “Pin Map” view in Metabase.

Read more here: https://stackoverflow.com/questions/23017766/google-maps-tile-url-for-hybrid-maptype-tiles

(running latest from git, 100 row dataset)

I followed gidi9's advice and maps work with the sample dataset.

I get this error when I try to make maps for my data.

I've checked the lat/lon field types and they look good.

Any tips on where to look next?

Thanks,
+m

@morganhankins You’re likely seeing this issue - go and upvote by clicking :+1: on the first post:
https://github.com/metabase/metabase/issues/7361

Ahh, missed that issue. Easy workaround, thanks, +m

Bonjour,

Just discovered an easy workaround : creating a new custom question with the editor from sql query (very simple custom question just like a select * query). It works fine.
Don’t believe to put a filter if you have more than 1K lines in your result data set.