小编Ank*_*ain的帖子

利用客体化进行地理空间半径搜索

我正在使用GeoModel开发一个应用程序.我需要根据给定的纬度和经度在特定半径内执行搜索.我可以使用Objectify在数据存储区中生成GeoCells,但无法在特定半径内返回结果.

我在下面分享我的代码.

实体类

@Entity
public class NewsFeed implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Index
private Long feedID;
@Index
private String topic;
@Index
private String title;
private String description;
@Index
private Date createDate;
private String imageOrVideo;
private String imageUrl;
private String blobKey;
@Latitude
private Double latitude;
@Longitude
private Double longitude;
@Geocells
private List<String> cells;

    // getter and setters ...
}
Run Code Online (Sandbox Code Playgroud)

来自此源的自定义GeocellQueryEngine类

public class ObjectifyGeocellQueryEngine implements GeocellQueryEngine {
private String geocellsProperty;
private Objectify ofy; …
Run Code Online (Sandbox Code Playgroud)

java google-app-engine geospatial objectify

6
推荐指数
1
解决办法
865
查看次数

标签 统计

geospatial ×1

google-app-engine ×1

java ×1

objectify ×1