Re: Geo Mapping. How to index/query a non-point geo property?


Hi Dmitry,

It is not clear to me whether you have problems to get any geo predicate working or that your specific example is the issue.
Can you first confirm that the following works for you (on a clean janusgraph-full-0.6.1):

$ bin/ start
$ bin/
    graph ='conf/')
    mgmt = graph.openManagement()
    location = mgmt.makePropertyKey('location').dataType(Geoshape.class).cardinality(Cardinality.SINGLE).make()
    mgmt.buildIndex('byLocation', Vertex.class).addKey(location, Mapping.PREFIX_TREE.asParameter()).buildMixedIndex('search')

    mgmt = graph.openManagement()

    g = graph.traversal()
    g.addV().property('location', Geoshape.point(52, 1))
    g.V().has("location", geoWithin(, 1.1, 20.0)))

Note that you may have erred on the radius units: these seem to be in kilometers (not miles, I hope, did not do the calculation...).

Best wishes,  Marc

On Wed, Mar 30, 2022 at 03:57 PM, <dmitryzezix@...> wrote:
g.V().has("location", geoWithin({lat}, {lon}, {radius})))

Join to automatically receive all group messages.