Hacker News new | past | comments | ask | show | jobs | submit login

I've created a project that provides in-memory Geo-spatial Indexing, with 2-dimensional K-D Tree. I've worked on multiple projects where I used K-D Trees to find the nearest neighbors for provided geo coordinates with efficient results. I used this implementation for applications with ~35m requests per day, with custom modifications and it worked like a charm. Hence I have created a generic implementation, ready to use. I have already shared great feedback from many programmers and working on improvements already to add new features. The project is open to suggestions and contributions as well. Feel free to create any issues on the GitHub repository.



This is a total aside from someone who doesn't know Java...

But why design Point so that you have to do:

`Point point = new Point.Builder() .latitude(25.2012544) .longitude(55.2569389) .build();`

Instead of:

`Point point = new Point(25.2012544,55.2569389)`

Cool project btw... working with geospatial data can be fun.


builder patterns are very common now because they make maintainability a lot easier, (i.e. if god forbid someone accidentally swapped vars in list of inputsof the same type), and secondly because you can use an annotation library to generate the boilerplate for you, you don't have to write any of it.

Although agreed it's used when you start to get to more parameters. I didn't check but it's possible there are a lot of null/default values like projection or something.


Builder patterns are most useful in statically typed languages that don't have strong support for optional parameters.

In creating a Point, neither value is optional, so I would question the value versus the additional complexity in this case.


Less options for mixing latitude and longitude?

I personally like static methods.

Point point = Point.fromLonLat(55.25…, 25.20…);

The builder pattern is useful to set defaults and add features without breaking backward compatibility.


You can also have cached static instances(assuming immutability), eg Point.fromLonLat(0,0) can always return the same instance, whereas new Point(0,0) must allocate and return a new instance.


> The builder pattern is useful to set defaults and add features without breaking backward compatibility.

Ah, that is interesting. Did not think about that.


thanks - I really wanted a library like this on the JVM

`kdTree.findNearestNeighbor(point, 2);` does this return

1. A list of ALL points that match the distance predicate?

2. Are they sorted by distance to the target?

3. Is it possible to cap to only the closest N points?


I am working on the similar feature Asad You can connect with me on the discord server for geo-assist https://discord.gg/8Xe2Ds4BWj

I would like to have your input and have the better understanding of what you are looking for as well.


now do this in 3d, and forget about the geolocation, move toward establishing location and orientation of limb segments, and establish a set of vectors that will satisfy a required velocity/distance intercept, to coordinate limb function and interaction, then worry about where on the globe, the local instance is with respect to other nearby instances; that would impress me, and would be much more usefull than nearest nieghbours geolocation.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: