Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started



raktim.0526_188212 avatar image
raktim.0526_188212 asked ·

How do I sort a list of geo points in descending order?

I have followed the Geo-Traversal documentation(DSE 6.7) and was able to find all the cities (points) within a radius from a particular location,

has('location', 'point', Geo.inside(Geo.point(2.352222, 48.856614), 300, Geo.Unit.KILOMETERS)).

But I am unable to sort them by distance from the centerpoint,

g.V().has('place', 'location', Geo.inside(Geo.point(74.0,40.5),50,Geo.Unit.DEGREES)).
order().by{it.value('location').getOgcGeometry().distance(Geo.point(2.352222, 48.856614).getOgcGeometry())}

This is the link to the documentation,

Can anyone please help me figure out this gremlin query?

10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

bettina.swynnerton avatar image
bettina.swynnerton answered ·


in order to execute this traversal, you will need to enable lambdas. Lambdas are restricted by default, as they are not recommended for production use.

To get the example to work, you will need to change the graph schema config with these two commands:

Enable development mode:


Enable lambdas:


Schema mode Development is only for development, as the name implies, and is not suitable for production, so I recommend not to rely on this mode for your traversals.

I hope this helps!

3 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

@bettina.swynnerton Thank you for your response.

After i enable Development and lambdas, it is throwing this error,

Sandbox disallows class com.datastax.shaded.esri.ogc.OGCPoint. Add class com.datastax.shaded.esri.ogc.OGCPoint to whitelist_types in dse.yaml to allow.

Does it require me to change something in the DSE.yaml and restart the nodes? This is the whitelist_types from my DSE.yaml

#         scriptEngines:
#            gremlin-groovy:
#                 config:
#                     # To disable the gremlin groovy sandbox entirely
#                     sandbox_enabled: false
#                     sandbox_rules:
#                         # To completely whitelist a package add the package name here
#                         whitelist_packages:
#                         -
#                         # To whitelist an individual type add the name of the type here
#                         whitelist_types:
#                         -
0 Likes 0 ·

In my case I did not have to make any new changes to the sandbox, but I might have some changes from other tests. Can you confirm your DSE version? I used DSE 6.7.7.

If this is strictly for development, you can of course also disable the sandbox (you will need to do this on all nodes, and you will need to restart your nodes after changes to the dse.yaml)

I come back to the warnings - all these changes are really only for development use, so revert all these changes once you fully explored the example.

To disable the sandbox, append the following after the last commented block in the dse.yaml (this is a yaml, so spacing is important):

          sandbox_enabled: false

Again, not for production use :)

0 Likes 0 ·
raktim.0526_188212 avatar image raktim.0526_188212 bettina.swynnerton ♦♦ ·

@bettina.swynnerton thank you. I am currently using 6.7.7 too.

0 Likes 0 ·