Code Monkey home page Code Monkey logo

javageomodel's People

Watchers

 avatar

javageomodel's Issues

Assertion errors in Point

What steps will reproduce the problem?
1. Create a new point with valid lattitude,longitude - eg. lat=55,lng=7

What is the expected output? What do you see instead?
I expect it to be valid- but I am told that 57 is not between -90 and 90

What version of the product are you using? On what operating system?
any

Please provide any additional information below.
This should fix it:
Change:
Validate.isTrue(lat > 90.0 || lat < -90.0, "Latitude must be in [-90, 90] but 
was ", lat);
Validate.isTrue(lon > 180.0 || lon < -180.0, "Longitude must be in [-180, 180] 
but was ", lon);

To:
Validate.isTrue(lat > -90.0 || lat < 90.0, "Latitude must be in [-90, 90] but 
was ", lat);
Validate.isTrue(lon > -180.0 || lon < 180.0, "Longitude must be in [-180, 180] 
but was ", lon);


I have other minor errors - I would be happy to contribute with fixes and junit 
tests if I could join the project

Original issue reported on code.google.com by [email protected] on 30 Sep 2010 at 12:33

  • Merged into: #8

Broken link

I don't think I can edit the wiki, so I'm filing an issue:
on page http://code.google.com/p/javageomodel/
there is a link to the source tree, but with the recent code reorganization, 
that link no longer works.

Original issue reported on code.google.com by [email protected] on 11 Apr 2010 at 12:51

Cannot find GeoPoint that exists in DB

What steps will reproduce the problem?
1. Perform GeocellManager.proximityFetch(..) where center point is equal to 
a point stored in db.  

What is the expected output? What do you see instead?
Expected : Stored GeoLocated item should be found. 
Experienced: Point is not found.
What version of the product are you using? On what operating system?
0.3

Please provide any additional information below.

It seems that the issue is caused by double precision calculations.  
GeocellUtils.distance(...) uses  Math.acos(arg) method do do some 
calculations. In some cases arg > 1 (i.e 1.0000000002), so acos cannot be 
calculated and the method returns NaN. My solution is very simple, but 
should work:

public static double distance(Point p1, Point p2) {
        double p1lat = Math.toRadians(p1.getLat());
        double p1lon = Math.toRadians(p1.getLon());
        double p2lat = Math.toRadians(p2.getLat());
        double p2lon = Math.toRadians(p2.getLon());
        return RADIUS * Math.acos(makeDoubleInRange(Math.sin(p1lat) * 
Math.sin(p2lat) +
                Math.cos(p1lat) * Math.cos(p2lat) * Math.cos(p2lon - 
p1lon)));
    }

    public static double makeDoubleInRange(double d){
        double result = d;
        if(d>1){
            result =1;
        }
        else if(d<-1){
            result = -1;
        }

        return result;

    }

Original issue reported on code.google.com by [email protected] on 26 May 2010 at 12:25

GeoModel 0.0.8 for java seems don't work...

What steps will reproduce the problem?
1.My queries return always empty.

What is the expected output? What do you see instead?
It should show the searched results.

What version of the product are you using? On what operating system?
0.0.8 Version

Please provide any additional information below.

Just to Give the details

using JPA

Code
Point center = new Point(44.838611, -0.578333)
 EntityManager em = EMF.get().createEntityManager();
 GeocellQuery baseQuery = new GeocellQuery("SELECT id FROM GeoEntity");
 List<GeoEntity> objects = null;
try {
       objects = GeocellManager.proximitySearch(center, 40, 0, GeoEntity.class, baseQuery, em);
 } catch (Exception e) {

No exception no data returned tested locally .
Any response will be greatly appreciated.

Original issue reported on code.google.com by [email protected] on 17 Jul 2013 at 10:33

Attachments:

Use standard Java conventions

I'm currently using a custom library to use geospatial queries with the GAE, 
but I would really like to use your project.
My main problem are method/parameter names like "default_cost_function". I 
know this Library was ported from Python, but this is very uncommon in the 
Java world. Your would rather name the method "defaultCostFunction".
Could this please be refactored? I would gladly help improve this library 
instead of maintain my own implementation.

Original issue reported on code.google.com by [email protected] on 14 Mar 2010 at 5:05

proximityFetch logic bug

This line from proximityFetch cannot be right.  If baseQuery.getBaseQuery()
returns null, the first part of the OR is false, and the second part is
then guaranteed to throw a NPE:

String and = baseQuery.getBaseQuery() != null ||
baseQuery.getBaseQuery().trim().length() == 0 ? " && " : " ";

Original issue reported on code.google.com by [email protected] on 20 Apr 2010 at 1:53

Incorrect distance computed

1. Add latitude and longitude in an entity using 'Double' instead of the 
primitive type
2. Do a proximity search
 => The GeocellManager won't return anything because the computed distance are huge.

The problem is due to the usage of 'Double' instead of 'double' for the types. 
In GAE + JDO, once your model is out, it's almost impossible to be able to get 
primitive types later. Since I need to support Proximity Search in a new set of 
entities, I need to be able to support this case.

Original issue reported on code.google.com by [email protected] on 17 Nov 2011 at 6:33

Wrong Validate.isTrue() calls

I get runtime error when using javageomode:

HTTP ERROR 500

Problem accessing /set_mark. Reason:

    Latitude must be in [-90, 90] but was 2.0
Caused by:

java.lang.IllegalArgumentException: Latitude must be in [-90, 90] but was 
2.0
    at org.apache.commons.lang.Validate.isTrue(Validate.java:130)
    at com.beoui.geocell.model.Point.<init>(Point.java:29)
    at test.Test_gae_1Servlet.doGet(Test_gae_1Servlet.java:55)
...

Looking at the source code com.beoui.geocell.model.Point I see 
    public Point(double lat, double lon) {
        Validate.isTrue(lat > 90.0 || lat < -90.0, "Latitude must be in [-
90, 90] but was ", lat);
        Validate.isTrue(lon > 180.0 || lon < -180.0, "Longitude must be in 
[-180, 180] but was ", lon);
        this.lat = lat;
        this.lon = lon;
    }

According to Validate.isTrue() javadoc:
"Validate an argument, throwing IllegalArgumentException if the test result 
is false."

I'm brand new with GAE, so I wonder if I'm doing something wrong or it is a   
plan error in code? How did you run the code then, cutting somehow Validate 
calls or what? 

Original issue reported on code.google.com by [email protected] on 11 May 2010 at 1:26

Remove dependency on JDO

We need to be able to make a query without depending on JDO. Perhaps an 
interface that we can implement to perform the datastore query using various 
datastore APIs would do the trick. 

Original issue reported on code.google.com by [email protected] on 13 May 2010 at 2:57

Inapproriate variable names

 public void testHowToQueryOnABoundingBox() {
        double latSW = 44.8;
        double lonSW = -0.6;

        double latNE = 44.9;
        double lonNE = -0.7;


The variable names should be:

        double latS = 44.8;
        double latN = 44.9;

        double lonW = -0.6;
        double lonE = -0.7;


Original issue reported on code.google.com by [email protected] on 31 May 2010 at 10:45

Add Maven POM

This project doesn't use a build tool yet. Apache Maven 
(http://maven.apache.org/) is one of the most common used build tools in the 
Java world. Adding a Maven POM (which basically describes the projects 
structure) allows others to easily build and consume this projects. I 
attached a minimal Maven POM. Just drop it in trunk/geocell...

Original issue reported on code.google.com by [email protected] on 14 Mar 2010 at 4:57

Attachments:

geocells field name and parameter are reverses

What steps will reproduce the problem?
1. The GeocellManager.proximityfetch line is like this - 
            Query query = pm.newQuery(entityClass, 
baseQuery.getBaseQuery() + and + "geocellsP.contains(geocells)");

It should be - 
            Query query = pm.newQuery(entityClass, 
baseQuery.getBaseQuery() + and + "geocells.contains(geocellsP)");

Original issue reported on code.google.com by [email protected] on 17 Apr 2010 at 3:02

Getting Started with Geomodel in java

What steps will reproduce the problem?
1. I
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?
geocell-0.0.3-SNAPSHOT.jar 
on Windows 7

Please provide any additional information below.
I am new to Google App Engine. I would like to use Geomodel to be able to store 
spatial data and retrieve them using boundingbox and proximity queries. I read 
all of the forums documentations for Geomodel in java. However, I still have 
problem using Geomodel even in storing data. 
I really appreciate if someone gives me step-by-step instruction on how to 
create a simple GAE application for storing & querying spatial data. 


Thanks.

Original issue reported on code.google.com by [email protected] on 12 Jul 2010 at 5:07

Problems with BaseQuery

I'm trying to retrieve data from a database using the proximity fetch function.
I'm having problems with the baseQuery parameter.
Actually, I didn't understand how to use it. I attached an image of our 
database, I don't have a special attribute to filter the data, so It's like I 
don't have a base query.

What would be in our case the base query?

On the other side, I'll like to thank you for all the job you've take to do 
this projects. It's been really really useful.

Original issue reported on code.google.com by [email protected] on 26 Jul 2010 at 9:54

Attachments:

Question - BoundingBox search

Thanks for porting this project into Java. I have downloaded this project a 
couple weeks back and was working on to add the proximity search. 

But I just saw your latest updates with proximity search. Thanks for that.

Question - Your BoundingBox search method in GeocellManager returns the 
geocells but not list of Objects. Do you plan to implement a boundingbox 
search similar to proximity search?

How can I join the mailing list?

Original issue reported on code.google.com by [email protected] on 12 Apr 2010 at 5:04

Problem downloading from svn maven repository

Out-of the box the instructions on the homepage do not work.

1. the dependency needs to include the version number.

2. users need to install the svn wagon 
http://maven-svn-wagon.googlecode.com/svn/site/index.html

3. the repository url listed requests a password as it is https

4 changing from https to http gives the error:
[WARNING] Unable to get resource 'com.beoui:geocell:pom:0.0.4' from repository 
javageomodel-repo (svn:http://javageomodel.googlecode.com/svn/repository/): 
Connection failed: Unable to connect to 
http://javageomodel.googlecode.com/svn/repository/

This error is a bit strange as I can ping that url.



Original issue reported on code.google.com by [email protected] on 12 Nov 2010 at 3:03

GeocellManager fails to find points outside highest level tile size

When searching for a point that is farther away than the top-level tile size, 
the point will never be found. In other words, if I search for a point that is 
farther away from my origin than 1/16 of the world, I will never find that 
point regardless of the distance specified (including 0 or Integer.MAX_VALUE).

I developed a simple patch to address the issue (though it may be possible to 
optimize it)...

Scott

Index: src/main/java/com/beoui/geocell/GeocellManager.java
===================================================================
--- src/main/java/com/beoui/geocell/GeocellManager.java (revision 153)
+++ src/main/java/com/beoui/geocell/GeocellManager.java (working copy)
@@ -367,6 +367,7 @@

        int noDirection [] = {0,0};
        List<Tuple<int[], Double>> sortedEdgesDistances = Arrays.asList(new Tuple<int[], Double>(noDirection, 0d));
+       boolean done = false;

        while(!curGeocells.isEmpty()) {
            closestPossibleNextResultDist = sortedEdgesDistances.get(0).getSecond();
@@ -405,6 +406,8 @@
            Collections.sort(results);
            results = results.subList(0, Math.min(maxResults, results.size()));

+           if (done) break; // Done with search, we've searched everywhere.
+
            sortedEdgesDistances = GeocellUtils.distanceSortedEdges(curGeocells, center);

            if(results.size() == 0 || curGeocells.size() == 4) {
@@ -413,8 +416,13 @@
                        geocells, in which case we should now search the parents of those
                        geocells.*/
                curContainingGeocell = curContainingGeocell.substring(0, Math.max(curContainingGeocell.length() - 1,0));
-               if(curContainingGeocell.length() == 0) {
-                   break;  // Done with search, we've searched everywhere.
+               if (curContainingGeocell.length() == 0) {
+                 // final check - top level tiles
+                 curGeocells.clear();
+                 String[] items = "0123456789abcdef".split("(?!^)");
+                 for (String item : items) curGeocells.add(item);
+                 done = true;
+                 continue;
                }
                List<String> oldCurGeocells = new ArrayList<String>(curGeocells);
                curGeocells.clear();

Original issue reported on code.google.com by [email protected] on 14 Jan 2013 at 5:30

Tag a version and release a pom

I'm a little disappointed that I can't just use your library as-is. It looks 
like it's still in SNAPSHOT mode (ignoring the apparent release in your 
Downloads section). Nothing's been tagged, and there's no official pom for the 
"released" jar.

I guess we'll be tagging our own version internally.

Original issue reported on code.google.com by [email protected] on 9 Sep 2010 at 10:34

proximitySearch algorithm throws error when point lies on other side of + 90 meridian

What steps will reproduce the problem?
1. Invoke proximity search for center point (22.572, 88.36) with max distance 
from center = 0 and .
2. Create another point in database at (26.167, 91.766)

Positions which are located beyond meridian + 90 are not fetched in results

Please let me know at the soonest if the algorithm has any issue. 

Original issue reported on code.google.com by [email protected] on 15 Sep 2010 at 8:07

GeocellManager.proximityFetch throws exception in AppEngine

What steps will reproduce the problem?

private static final Key SMALLEST_KEY = 
KeyFactory.createKey(MyLocationCapable.class.getSimpleName(), 1);
private static final GeocellQuery GEOCELL_QUERY = new GeocellQuery("key >= 
idParam", "com.google.appengine.api.datastore.Key idParam", 
Lists.<Object>newArrayList(SMALLEST_KEY));


    Point center = new Point(latitude, longitude);
    PersistenceManager pm = PMF.instance().getPersistenceManager();
    return GeocellManager.proximityFetch(center, 4, 100, MyLocationCapable.class, GEOCELL_QUERY, pm);

What is the expected output? What do you see instead?
expected to get back some MyLocationCapables.  Instead I get a stack trace:

org.datanucleus.store.appengine.query.DatastoreQuery$UnsupportedDatastoreFeature
Exception: Problem with query <SELECT FROM mypackage.MyLocationCapable WHERE 
key >= idParam && geocellsP.contains(geocells) PARAMETERS 
com.google.appengine.api.datastore.Key idParam, String geocellsP>: Unsupported 
method <contains> while parsing expression: 
InvokeExpression{[ParameterExpression{geocellsP}].contains(VariableExpression{ge
ocells})}
    at org.datanucleus.store.appengine.query.DatastoreQuery.newUnsupportedQueryMethodException(DatastoreQuery.java:1015)
    at org.datanucleus.store.appengine.query.DatastoreQuery.handleContainsOperation(DatastoreQuery.java:993)
    at org.datanucleus.store.appengine.query.DatastoreQuery.addExpression(DatastoreQuery.java:880)
    at org.datanucleus.store.appengine.query.DatastoreQuery.addExpression(DatastoreQuery.java:850)
    at org.datanucleus.store.appengine.query.DatastoreQuery.addFilters(DatastoreQuery.java:827)
    at org.datanucleus.store.appengine.query.DatastoreQuery.performExecute(DatastoreQuery.java:228)
    at org.datanucleus.store.appengine.query.JDOQLQuery.performExecute(JDOQLQuery.java:89)
    at org.datanucleus.store.query.Query.executeQuery(Query.java:1489)
    at org.datanucleus.store.query.Query.executeWithArray(Query.java:1371)
    at org.datanucleus.jdo.JDOQuery.executeWithArray(JDOQuery.java:312)
    at com.beoui.geocell.GeocellManager.proximityFetch(GeocellManager.java:286)


What version of the product are you using? On what operating system?

This is deployed to appengine.  Using geocell-0.0.3-SNAPSHOT.jar  that I 
downloaded last night (10/30/2010)



Original issue reported on code.google.com by [email protected] on 31 Oct 2010 at 3:41

proximitySearch: NPE at com.beoui.geocell.JPAGeocellQueryEngine.query(JPAGeocellQueryEngine.java:32) (version 0.0.7)

What steps will reproduce the problem?
1. Create code as in the example for JPA. Of course with a working EntityManager
2. Execute code

What is the expected output? What do you see instead?
Expected: List of entities that match the query.
Result: NullPointerException

What version of the product are you using? On what operating system?
0.0.7 GAE/J JPA

Please provide any additional information below.
When doing a proximity search, I get the following error. 
A BB-search with a query like "Query q = em.createQuery("select p from " + 
MyPoint.class.getName() + " p where p.geoCells.contains(:searchCells)");" works 
fine. I hope somebody can give me some insight in case it is my fault, or 
otherwise, track the issue down and fix it in the javageomodel-project.

Caused by: java.lang.NullPointerException
    at com.beoui.geocell.JPAGeocellQueryEngine.query(JPAGeocellQueryEngine.java:32)
    at com.beoui.geocell.GeocellManager.proximitySearch(GeocellManager.java:381)
    at com.beoui.geocell.GeocellManager.proximitySearch(GeocellManager.java:336)
    at com.beoui.geocell.GeocellManager.proximitySearch(GeocellManager.java:330)
    at myproject.dao.Dao.getPointsInArea(Dao.java:125)


The code:
public List<MyPoint> getPointsInArea(float lat, float lon, int radius) {
        EntityManager em = EMF.getInstance().createEntityManager();
        Point center = new Point(lat, lon);
        GeocellQuery baseQuery = new GeocellQuery();
        List<MyPoint> points = GeocellManager.proximitySearch(center, 900, radius, MyPoint.class, baseQuery, em);
        return points;
    }

Original issue reported on code.google.com by hellekalek on 17 Jun 2011 at 9:19

Antimeridean crossing not working quite as expected

I integrated google maps api with app engine and java geo model.

It is working great, apart from when I cross the antimeridian, the results 
aren't as expected.

This bounding box produces what looks like the wrong cells

GeocellManager.bestBboxSearchCells(new BoundingBox(76.043611, 4.576263, 
-54.505934, 87.076263), null)
 = [4, 6, c, e]

This bounding box looks to produce the correct cells (all of them)

GeocellManager.bestBboxSearchCells(new BoundingBox(76.337307, 87.076263, 
-53.785238, 109.576263), null)
 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, a, b, c, d, e, f]

Unless I am incorrectly interpreting the bounds that google maps api is 
returning.

Original issue reported on code.google.com by [email protected] on 13 Apr 2011 at 8:15

Missing Dependency

GeocellManager has a runtime dependency on apache commons StringUtils.

If the dependency is not included in the project, you get the error below:

java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
    at   com.beoui.geocell.GeocellManager.proximityFetch(GeocellManager.java:289)
    at com.beoui.geocell.GeocellManager.proximityFetch(GeocellManager.java:406)

--------------------------------------------------------------

Please include the following dependency in the instructions:

<dependency>
  <groupId>commons-lang</groupId>
  <artifactId>commons-lang</artifactId>
  <version>2.5</version>
</dependency>

Original issue reported on code.google.com by [email protected] on 14 Nov 2010 at 4:30

java.lang.NoSuchMethodError: com.beoui.geocell.model.GeocellQuery: method <init>()V not found

I am getting this exception while I am trying to fetch the geeocell values.


java.lang.NoSuchMethodError: com.beoui.geocell.model.GeocellQuery: method 
<init>()V not found
    at com.cloudjini.store.RetriveStores.getStoresNearLocation(RetriveStores.java:65)
    at com.cloudjini.store.RetriveStores.service(RetriveStores.java:29)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.appengine.tools.development.HeaderVerificationFilter.doFilter(HeaderVerificationFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter(ServeBlobFilter.java:60)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.StaticFileFilter.doFilter(StaticFileFilter.java:122)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.appengine.tools.development.BackendServersFilter.doFilter(BackendServersFilter.java:97)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
    at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
    at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
    at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
    at com.google.appengine.tools.development.DevAppEngineWebAppContext.handle(DevAppEngineWebAppContext.java:78)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at com.google.appengine.tools.development.JettyContainerService$ApiProxyHandler.handle(JettyContainerService.java:362)
    at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
    at org.mortbay.jetty.Server.handle(Server.java:326)
    at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
    at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:923)
    at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:547)
    at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
    at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)

Original issue reported on code.google.com by [email protected] on 24 Jan 2012 at 2:03

iUnitTest fails - a bug in the Point Validate conditions.

The Validate conditions test the success as:

       Validate.isTrue(lat > 90.0 || lat < -90.0, "Latitude must be in
[-90, 90] but was ", lat);
        Validate.isTrue(lon > 180.0 || lon < -180.0, "Longitude must be in
[-180, 180] but was ", lon);


This, however, should be:

        Validate.isTrue( -90.0d <= lat && lat <= 90.0d, "Latitude must be
in [-90, 90] but was ", lat);
        Validate.isTrue( -180.0d <= lon && lon <= 1800d, "Longitude must be
in [-180, 180] but was ", lon);

Original issue reported on code.google.com by [email protected] on 31 May 2010 at 7:07

  • Merged into: #8

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.