Map Graphs on Argentina

When I'm trying to create querys with lonlat on Argentina, there is no Map display. Is there a way that I can import a base Map with Argentina's coordinates so that I can create map querys.

Thanks

Hi @Vallistruqui
Metabase has two types of maps. Pin Map, which uses OpenStreetMap, and uses any latitude/longitude to place a pin. And Region Map, which load a GeoJSON file that you reference.
I don't know what you're trying to do, but post a screenshot.
And "Diagnostic Info" from Admin > Troubleshooting.

I attach 3 images showing the step by step. As soon as I try to assign a latitude or longitude value to the graph it resets.

1st Step:
Captura%20de%20pantalla%202021-12-07%20124238

2nd Step:

3rd Step:


Reset to first image

Here is my code:

select
worker_ubications.travel_id,
worker_ubications.worker_id,
ST_X(worker_ubications.lonlat::geometry) as lon,
ST_Y(worker_ubications.lonlat::geometry) as lat

from worker_ubications

where {{Dia}}
[[and worker_ubications.travel_id = {{Travel_ID}}]]

My Metabase info:

{
  "browser-info": {
    "language": "es-ES",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.11+9",
    "java.vendor": "AdoptOpenJDK",
    "java.vendor.url": "https://adoptopenjdk.net/",
    "java.version": "11.0.11",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.11+9",
    "os.name": "Linux",
    "os.version": "5.4.129-63.229.amzn2.x86_64",
    "user.language": "en",
    "user.timezone": "America/Argentina/Buenos_Aires"
  },
  "metabase-info": {
    "databases": [
      "postgres",
      "googleanalytics",
      "presto"
    ],
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "10.17"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.2.18"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2021-08-26",
      "tag": "v0.40.3.1",
      "branch": "release-x.40.x",
      "hash": "0550b86"
    },
    "settings": {
      "report-timezone": "America/Buenos_Aires"
    }
  }
}

@Vallistruqui
Upgrade to latest release and try again: https://github.com/metabase/metabase/releases/latest

I upgraded to the last version. But the following happens:

  • I no longer have the crash that I used to have when I input the latitude or longitude fields
  • There is no display of my values in the map, it just shows an empty map of the United States

Empty Map:

Example Data:
image

Metabase info:

{
  "browser-info": {
    "language": "es-419",
    "platform": "Win32",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.13+8",
    "java.vendor": "Eclipse Adoptium",
    "java.vendor.url": "https://adoptium.net/",
    "java.version": "11.0.13",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.13+8",
    "os.name": "Linux",
    "os.version": "5.4.129-63.229.amzn2.x86_64",
    "user.language": "en",
    "user.timezone": "America/Argentina/Buenos_Aires"
  },
  "metabase-info": {
    "databases": [
      "postgres",
      "googleanalytics",
      "presto"
    ],
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "10.17"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.2.23"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2021-12-10",
      "tag": "v0.41.4",
      "branch": "release-x.41.4",
      "hash": "471cfb9"
    },
    "settings": {
      "report-timezone": "America/Buenos_Aires"
    }
  }
}

@Vallistruqui Click the Settings button in the lower-left corner and change to Pin map.
Read this: https://www.metabase.com/learn/visualization/maps

I was attempting to do that on a Pin Map. I think I found what the issue is but I don't know how to resolve it. In the link you provided there is a section that talks about making the data compatible with mapping.

The issue here is that in my databases I don't have latitude and longitude fields, instead y have a latlon field that looks like this:

0101000020E6100000D3551575413E4DC0FB18BD642D4B41C0

Using the Postgis functions:

ST_X(worker_ubications.lonlat::geometry) as lon, ST_Y(worker_ubications.lonlat::geometry) as lat,

I can retrieve the latitude and longitude values, but i cannot graph them. The issue might be because the lonlat field is categorized as a 'non semantic' type field.

@flamber, is there a way I can overcome this mapping compatibility issue?

Thanks

@Vallistruqui You're doing this in SQL, right? Then ignore everything about Data Model, since that doesn't apply to you.
Or create a View on your database, where you split the Postgis column in two.
https://github.com/metabase/metabase/issues/2327 - upvote by clicking :+1: on the first post

As I understand there is no way to do this right now and by upvoting the post it gives it importance so Metabase can work on it right?

@Vallistruqui Think some stuff gets lost in translation.

  1. Why can't you use SQL and select the "lat"/"lon" columns? Please show a screenshot of the Settings side panel.
  2. You cannot create a View on the Postgres database?
  3. Priority of what we work on depend on several factors, one of them being upvotes on issues.
  1. Settings on Pin Map

Selecting Latitude

Selecting Longitude

After I select longitude the map starts to load, but it doesn't show anything.

  1. I'm not quite sure how to do that. I'll look into consulting IT to change the view into two separate columns

  2. Great! Then I'll upvote it.

@Vallistruqui Hover the black triangle in the upper-right corner.

@flamber it reads out "truncated data over 2000 rows". When I LIMIT the data to less than 2000 rows the message goes away. I don't think that' s the heart of the issue.

@Vallistruqui Well, that's likely the problem. Try limiting to less than 1000 results.
I cannot say why you're not seeing anything. You'll have to check for errors:

  • Admin > Troubleshooting > Logs
  • and your browser developer console

The data type of the lon and lat columns that I create is double precision, the example of a value of any of these values is

ST_X(worker_ubications.lonlat::geometry) as lon,
-58,765442
ST_Y(worker_ubications.lonlat::geometry) as lat,
-34,4370863

Is there an issue with the length of the lat and lon numbers? Maybe that's the issue.

@Vallistruqui No, but try casting as float. And the separator should be dot of course (computers).
This should work:

select * from (values (1, 2, -58.765442, -34.4370863), (2, 2, -58.123, -34.123)) t(travel_id, worker_id, lat, lon)

But I don't think I can help anymore. You'll need to get help from someone who can debug the problem with you.

It didn't work, but thank you for doing everything you could do to help.

@flamber Last try. Could it be that the URL connection to OSM is wrong?

This is the URL:
http://tiles.openstreetmap.org.ar/osm-ar/{Z}/{X}/{Y}.png

The conection to the OSM could be the issue. Let me know if this could be it!

Thanks

@Vallistruqui Well, that should have been noted in your browser developer console.
Try removing that custom URL and test. It's a million times easier, when you have something that works.
And if your Metabase instance is on https:, then the tile server should also be on https:

It was the URL!!! Thanks @flamber!