GeoPoint with Vega keep on top left corner

Hello,
I've been trying to show geopoints using vega. Following the tutorials and documentation here is what I come up with :

{
  $schema: https://vega.github.io/schema/vega/v3.0.json
  config: {
    kibana: {
      type: map
      latitude: 30.6
      longitude: 104.06
      zoom: 11
      mapStyle: default
    }
  }
  projections: [
    {name: "projection", type: "mercator"}
  ]
  data: [
    {
      name: table
      url: {
        index: index
        %context%: true
        // Uncomment to enable time filtering
        // %timefield%: timestamp
        body: {
          size: 0
          aggs: {
            coord: {
              top_hits: {
                _source: {
                  includes: ["location", "event_id"]
                }
                size: 10
              }
            }
          }
        }
      }
    }
  ]
  format: {property: "aggregations.coord.buckets"}
  transform: [
    {
      from: table
      type: geopoint
      projection: projection
      fields: [
        coord.hits.hits[0]._source.location.lon
        coord.hits.hits[0]._source.location.lat
      ]
    }
  ]
  encoding: {
    longitude: {field: "_source.location.lon", type: "quantitative"}
    latitude: {field: "_source.location.lat", type: "quantitative"}
    tooltip: {field: "coord.hits.hits[0]._source.event_id", type: "nominal"}
  }
  marks: [
    {
      type: symbol
      from: {data: "table"}
      encode: {
        enter: {
          size: {value: 100}
          fill: {value: "black"}
          stroke: {value: "orange"}
        }
        update: {
          x: {field: "x"}
          y: {field: "y"}
        }
      }
    }
  ]
}

But unfortunately, it seems like my points aren't recognized, and just one shows on the top left corner.

Here is the result to my query:

},
  "hits" : {
    "total" : 1528,
    "max_score" : 0.0,
    "hits" : [ ]
  },
  "aggregations" : {
    "coord" : {
      "hits" : {
        "total" : 1528,
        "max_score" : 1.0,
        "hits" : [
          {
            "_index" : "index",
            "_type" : "doc",
            "_id" : "44a310aade39b480526a16c4f0c12e15ee02f1b1c15b908b5a82af5a34e8280b",
            "_score" : 1.0,
            "_source" : {
              "location" : {
                "lon" : 104.0613698249725,
                "lat" : 30.591389561919556
              }
            }
          },

Would you have any idea of why this is happening ?

I think the problem is with your projection. Your data is provided in WGS84 yet you have specified mercator projection. You should be able to remove the entire projection settings as vega should default to WGS 84

Hello nathan, I have found the problem since that and it was probably with my projection. I let it choose a projection on itself and it works fine now!

Thanks again!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.