# Path: gbdxtools/vectors.py
# class TermsAggDef(FieldBasedAggDef):
# 
#     def __init__(self, field=None, **kwargs):
#         super(TermsAggDef, self).__init__('terms', field, **kwargs)
# 
# class GeohashAggDef(AggregationDef):
# 
#     def __init__(self, hash_length='3', **kwargs):
#         super(GeohashAggDef, self).__init__('geohash', hash_length, **kwargs)


import gbdxtools
from gbdxtools.vectors import TermsAggDef, GeohashAggDef

gbdx = gbdxtools.Interface()

# Let's look in colorado
colorado_aoi = "POLYGON((-108.89 40.87,-102.19 40.87,-102.19 37.03,-108.89 37.03,-108.89 40.87))"

# Let's limit our search to the OSM indexes
search_index = 'read-vector-osm-*'

# Let's find things that match 'transportation' somewhere in a text field
query = 'transportation'

# let's get 5 geohash buckets with the top 5 item_type values in each
child_agg = TermsAggDef('item_type')

# Path: gbdxtools/vectors.py
# class TermsAggDef(FieldBasedAggDef):
# 
#     def __init__(self, field=None, **kwargs):
#         super(TermsAggDef, self).__init__('terms', field, **kwargs)
# 
# class GeohashAggDef(AggregationDef):
# 
#     def __init__(self, hash_length='3', **kwargs):
#         super(GeohashAggDef, self).__init__('geohash', hash_length, **kwargs)


# Path: examples/vectors_aggregation.py
import gbdxtools
from gbdxtools.vectors import TermsAggDef, GeohashAggDef


gbdx = gbdxtools.Interface()

# Let's look in colorado
colorado_aoi = "POLYGON((-108.89 40.87,-102.19 40.87,-102.19 37.03,-108.89 37.03,-108.89 40.87))"

# Let's limit our search to the OSM indexes
search_index = 'read-vector-osm-*'

# Let's find things that match 'transportation' somewhere in a text field
query = 'transportation'

# let's get 5 geohash buckets with the top 5 item_type values in each
child_agg = TermsAggDef('item_type')

agg = GeohashAggDef('3', children=child_agg)