Open b-jazz opened 5 years ago
This is a neat idea. I'll have to think a bit about how the interface of this might work best, as I'm a little nervous about turning the arguments for filtering into some complex syntax that needs to be parsed.
However in the meantime, it's worth mentioning that filter does accept multi-geometries or feature collections, in which case it will check for a match on any of the filtering geometries.
So to achieve your use-case you can do something like this, using geoq gj fc
to turn the list of geohashes into a geojson feature collection, and then using that to do the filtering:
$ wc -l ~/data/microsoft_buildings/9q5.json
1914270 /Users/horace/data/microsoft_buildings/9q5.json
$ geoq filter intersects $(echo 9q5 | geoq gh children | head -n 8 | geoq gj fc) < ~/data/microsoft_buildings/9q5.json | wc -l
180966
I recently realized that the order of children geohashes is such that a range of them splits the parent geohash nicely. For instance aa0-aag and aah-aaz perfectly bisect the aa geohash. This is true for the 16 children just mentioned, 8 children with aa0-aa7, 4 children with aa0-aa3, and so on. It would be great if
qeoq filter contains <gh>
could take a range like aa0-aa7 and filter to something more granular than the major geohashes of 1,2,3,etc degrees.