Hi,

"geocellsP" is taken from code example in HowToUseGeocell.java (in
commented code). I'm a newbe with GAE, and solving puzzles like that
makes me upset. For example 'Query' was commented, and I even not sure
if I imported right Query class (had after uncommenting code) -
eclipse suggested several of them in different packages and at least 2
of them looks like from GAE.

After my modifications I have following code:
--
String queryString = "select from "+Metka.class.getName()+" where
geocellsP.contains(geocells)";
Query query = pm.newQuery(queryString);
query.declareParameters("String geocellsP");
List<Metka> objects = (List<Metka>) query.execute(cells);
--
But it returns all 'Metka' entities though 'cells' list doesn't have
as many entries as 'objects' has. I think I'm doing something wrong,
but do not know what (( Please advice.

My Metka class is:
@PersistenceCapable
public class Metka implements LocationCapable {
    @PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key id;
    @Persistent
    private List<String> geocells;
...

TIA,
Mike


On Apr 10, 10:17 pm, Alex <alexandre.gellib...@gmail.com> wrote:
> Hi Christian,
>
> 1. your exception looks weird. I'm using the library with this kind of
> class:
> @PersistenceCapable(identityType = IdentityType.APPLICATION)
> public class User {
>
>         @PrimaryKey
>         @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
>         private Key key;
>
>         @Persistent
>         private List<String> geocells;}
>
> ... and it works well.
>
> 2. the min/max resolution of cells may be changed if you pass a
> CostFunction as parameter (it tells the algorithm when searching for
> bigger cells: when the cost raises, it stops). Also, since I did the
> java portage of python Geomodel library, I'd be interested in the
> "false positives" cells you get. Can you give me an example of input
> that fails?
>
> 3. Your query in the example seems to be wrong, you're declaring
> "geocellsP" as a parameter, but it does not exist in the request.
>
> I've recently updated the library (and added the proximity fetch
> search). Please post an issue if something does not look ok.
>
> ++
> Alex
>
> On Mar 1, 8:09 pm, Torquester <christian.schloem...@gmail.com> wrote:
>
>
>
> > I tried out the Java Geomodelhttp://code.google.com/p/javageomodel/
>
> > The query used in the example provided on the project page seems
> > strange to me. The example uses a List<String> parameter (containing
> > the cells of the bounding box) and passes it to a query which filters
> > the List<String> (geocells) property of the entity class. When I
> > execute that query I get following error: Collection parameters are
> > only supported when filtering on primary key.
>
> > Is it possible to have a query in appengine where the entity has a
> > List<String> property (which is not a primary key) and you want to
> > know if that property contains one of the values provided by a second
> > List<String>?
>
> > I'm also wondering if the resolution of the cells can be changed. The
> > results I get are inaccurate (I'm getting some false positives when I
> > do a bounding box search).
>
> > class GeoObject {
> >   @Persistent
> >   List<String> geocells;
> >   ...
>
> > }
>
> > // Transform this to a bounding box
> > BoundingBox bb = new BoundingBox(latNE, lonNE, latSW, lonSW);
>
> > // Calculate the geocells list to be used in the queries (optimize
> > list of cells that complete the given bounding box)
> > List<String> cells = Geocell.best_bbox_search_cells(bb, null);
> > // In Google App Engine, you'll have something like below. In
> > hibernate (or whatever else), it might be a little bit different.
> > String queryString = "select from GeoObject where
> > geocellsParameter.contains(geocells)";
> > Query query = pm.newQuery(query);
> > query.declareParameters("String geocellsParameter");
> > query.declareParameters("String geocellsP");
> > List<GeoObject> objects = (List<GeoObject>) query.execute(cells);
>
> > On Feb 8, 11:24 pm, "Ikai L (Google)" <ika...@google.com> wrote:
>
> > > Looks like someone ported the Python code to Java for GeoHash:
>
> > >http://stackoverflow.com/questions/2060219/google-app-engine-geohashing
>
> > > Also seems like a pretty good explanation of GeoHashing in general.
>
> > > On Thu, Feb 4, 2010 at 10:16 AM, mianor <lefebvre.rom...@gmail.com> wrote:
> > > > Hi,
>
> > > > I am trying to implement geolocation search with GAE in Java using
> > > > GeoPt.
> > > > But due to restrictions on Datastore, bounding box queries are also
> > > > not supported in App Engine because there need to be two inequalities
> > > > on two independent properties (latitude and longitude).
>
> > > > There seems to be a solution with Geohash but every thing I found is
> > > > based on GAE Python. Is there anything based on Java or can I use
> > > > Geomodel (http://code.google.com/p/geomodel/) from Python in my Java
> > > > applications?
>
> > > > Thanks for your help!
>
> > > > Romain
>
> > > > --
> > > > You received this message because you are subscribed to the Google 
> > > > Groups
> > > > "Google App Engine for Java" group.
> > > > To post to this group, send email to
> > > > google-appengine-j...@googlegroups.com.
> > > > To unsubscribe from this group, send email to
> > > > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2B
> > > >  ­unsubscr...@googlegroups.com>
> > > > .
> > > > For more options, visit this group at
> > > >http://groups.google.com/group/google-appengine-java?hl=en.
>
> > > --
> > > Ikai Lan
> > > Developer Programs Engineer, Google App 
> > > Enginehttp://googleappengine.blogspot.com|http://twitter.com/app_engine

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to