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


hadoopmarc@...
 

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/janusgraph.sh start
$ bin/gremlin.sh
    graph = JanusGraphFactory.open('conf/janusgraph-cql-es.properties')
    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.commit()

    mgmt = graph.openManagement()
    mgmt.printSchema()
    mgmt.close()    

    g = graph.traversal()
    g.addV().property('location', Geoshape.point(52, 1))
    g.V().has("location", geoWithin(Geoshape.circle(51.9, 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(Geoshape.circle({lat}, {lon}, {radius})))

Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.