About GeoHash queries support


#1

Hi community, I have been noticed in the 1.13 release notes of the ChartFactor Toolkit the new support of GeoHash queries. I want to know if this could be used to make marker cluster aggregation on the server-side and if this is automatically integrated into the GeoMap. Thanks.


#2

Hi @ryan, GeoHash queries can be used to create cluster aggregation on the server-side but right know is not supported out of the box by the GeoMap, we plan to add the support in the future. What you can do now is create the Geohash query and then create a GeoMap with that custom data. Let us know if all works well. Best regards.


#3

Hi @dario, I don’t see any example of using custom data with the GeoMap. I think that should be more or less the same as to use custom data with the Vector Map right? I was able to run a geoquery successfully, but I don’t have an idea of how to change the marker depending on the cluster value. Could you provide a code example? Thanks.


#4

Hi @ryan the following code obtains the geohashes and puts markers in the middle of each one:

cf.provider('Elasticsearch')
    .source('chicago_taxi_trips')
    .precision(6)
    .location('pickup_location')
    .element('dummy')
    .execute()
    .then(result => {
        let formattedData = result.data.map(d => {
            let {lat, lon } = Geohash.decode(d.geohash);

            return {lat, lon, count: d.count};
        });

        cf.create()
            .fields('lat', 'lon', cf.Field('count'))
            .data(formattedData)
            .set('zoom', 0.5)
            .set('enableZoom', true)
            .graph('Geo Map')
            .element('chart')
            .execute();
    });

You can get the Geohash library from this site https://www.movable-type.co.uk/scripts/geohash.html. Let me know this helps. Best regards.