ikevin8me
ikevin8me

Reputation: 4313

How to query location "within" in OrientDB 2.2.x Spatial Module in Java?

I'mm trying to implement OrientDB Spatial Module and need some help on coding it in Java.

How do I do the equivalent query in Java:

select *,ST_Distance_Sphere(location,ST_GeomFromText('POINT(12.4696635 41.8894657)')) as distance from Points where ST_Distance_Sphere(location,ST_GeomFromText('POINT(12.4696635 41.8894657)')) < 200 order by distance

Reference

Thanks!

Upvotes: 1

Views: 80

Answers (1)

Roberto  Franchini
Roberto Franchini

Reputation: 1026

The only way is to use OSQL:

    List<ODocument> execute = db.query(new OSQLSynchQuery<ODocument>(
    "select   *,ST_Distance_Sphere(location,ST_GeomFromText('POINT(12.4696635 41.8894657)')) as distance from Points where ST_Distance_Sphere (location,ST_GeomFromText('POINT(12.4696635 41.8894657)')) < 200 order by distance"));

Does it helps?

Upvotes: 1

Related Questions