2017-02-09 68 views
1

我試圖實現OrientDB空間模塊,並需要一些幫助編寫它在Java中。如何查詢OrientDB 2.2.x Spatial Module in Java中的位置「within」?

我怎樣做等價查詢中的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

謝謝!

+0

在java中沒有等價物。你應該執行命令/查詢 你將如何在java中運行這個? – wolf4ood

+0

我認爲有一些方法來構建查詢並執行它。 – ikevin8me

回答

1

的唯一方法是使用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")); 

它是否幫助?