Need help with geo spatial ingest and query

Hi,

I’m having trouble getting filtering by spatial dimensions to work. I’m testing with the latest imply container (1.3.0)

I created a sample data point for testing, that looks like this -

{

“bytes” : 2208,

“longitude” : -122.0,

“app” : “gmail”,

“timestamp” : 1463170946,

“latitude” : 37.4,

“user” : “abc@domain”

}

My ingest spec has this dimensionsSpec attribute -

  "parser" : {

    "type" : "string",

    "parseSpec" : {

      "format" : "json",

      "timestampSpec" : {

        "column" : "timestamp",

        "format" : "posix"

      },

      "dimensionsSpec" : {

        "dimensions": ["app","user"],

        "dimensionExclusions" : [],

        "spatialDimensions" : [

            { "dimName": "location", "dims":["latitude", "longitude"]}

        ]

      }

    }

  },

My understanding is that this makes lat and long available for filtering via the alias ‘location’. So I was expecting this query to work -

"filter": {

    "type": "spatial",

    "dimension": "location",

    "bound": {

        "maxCoords": [

            0.0,

            90.0

        ],

        "type": "rectangular",

        "minCoords": [

            -180.0,

            0.0

        ]

    }

},

but it returns an empty result set. I should mention this filter is part of a ‘groupBy’ query, where I group by app and user. When I remove the filter, I see the expected results, so at least that I know the data was ingested.

Another question - does Druid support ingestion of geo data where the coordinates are contained in an array like so - {‘location’: [-122.0, 37.4]} instead of separate latitude and longitude attributes ? If so, how do I specify this in the ingest spec? Can it say - { ‘spatialDimensions’: [ {‘dimName’: ‘location’} ] } ?

I’ve looked at other posts related to spatial dimensions, but can’t find one that matches the exact same issue. Any help would be greatly appreciated.

thanks

Nandan

Hey Nandan,

Your input coordinate is [37.4, -122.0] but your filter on x is [-180, 0] and your filter on y is [0, 90]. So that won’t match your coordinate. Just for a sanity check, try a radius bound centered on your point [37.4, -122.0] with a small radius and see if that matches.

Hi Gian,

Is this the format for the radius query ?

"filter": {

    "type": "spatial",

    "dimension": "location",

    "bound": {

        "coords": [

            37.4,

            -122.0

        ],

        "type": "radius",

        "radius": 1000.0

    }

}

If so, this doesn’t work either - it returns an empty result set. I don’t see any errors in var/sv/broker.log.

Also, I had previously assumed the ‘x’ coordinate in the query was longitude, not latitude. For the ingest spec it’s clearly spelt out in http://druid.io/docs/latest/development/geo.html that the first of the 2 values is latitude. Either way, I switched the order of the lat and long values in the original rectangle query and that didn’t work either.

thanks

Nandan

Any suggestions Gian ? I can upload the entire ingest spec and query if that would help.

thanks

That filter looks correct. What do you mean nothing is returned? Do you get an empty result or a count of 0?
If you a timeseries query with just a count aggregator, do you get a correct count back?