proximitySearch returning empty list of results!

71 views
Skip to first unread message

John_Idol

unread,
Aug 2, 2011, 9:58:18 PM8/2/11
to javageomodel-discuss
Hi All, I am getting started with GeoModel, and trying to run a
proximity search.

As per subject, proximitySearch runs with no errors but no results are
returned. Some code below:

Point center = new Point(/*lat*/55.5,/*long*/-0.55);

List<Object> params = new ArrayList<Object>();
params.add(_userId);

// this is just a query
GeocellQuery baseQuery = new GeocellQuery("userId == userIdParam",
"String userIdParam", params);

// proximity search
List<ThirdParty> parties = GeocellManager.proximitySearch(center, 10,
0, MyObjectWithLocation.class, baseQuery, _pm);

MyObjectWithLocation has all the annotations (@Latitude, @Longitude,
@Geocells) and I can see everything is populated in the local
datastore.

This is the data I am testing against, I am persisting instances with
the following coordinates:

long:-0.55 lat:55.55
long:-0.56 lat:56.56
long:-0.57 lat:57.57
long:-0.58 lat:58.58

Also I tried to arbitrarily increase the "distance" parameter (up to
1000 - what's the distance expressed in anyway, cells? and how do I
work it out in km?) but still no luck.

Any help highly appreciated!

John_Idol

unread,
Aug 2, 2011, 11:00:48 PM8/2/11
to javageomodel-discuss
Oh, just noticed --> ThirdParty = MyObjectWithLocation ... forgot to
edit the name of my class out everywhere.

bharat sharma

unread,
Sep 11, 2011, 9:56:37 PM9/11/11
to javageomodel-discuss
HI John.

I am having the same issue ,., I am not getting any result back . I
made sure the code references my Entity.

This is my code


********Entity*******
@PersistenceCapable
public class PMFEntity {

@PrimaryKey
@Persistent
private String id;

@Persistent
@Latitude
private double latitude;

@Persistent
@Longitude
private double longitude;

@Persistent
@Geocells
private List<String> geocells;

double lat = 44.838611;
double lon = -0.578333;

PMFEntity obj = new PMFEntity();

obj.setId("22");
obj.setLatitude(lat);
obj.setLongitude(lon);
obj.setGeocells(cells);

PersistenceManager pm = PMF.get().getPersistenceManager();

pm.makePersistent(obj);

************Data gets stored *******************************

***************Access data does not work*************************
PersistenceManager pm = PMF.get().getPersistenceManager();


GeocellQuery baseQuery = new GeocellQuery();
List<PMFEntity> objects = null;
try {
objects = GeocellManager.proximitySearch(center, 40, 0,
PMFEntity.class, baseQuery, pm);


object is null .. any help will be appreciated

Thanks
Reply all
Reply to author
Forward
0 new messages