我正在使用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)