Need a standalone Java library for performing spatial calculations on lat/lon data

Jim Tough picture Jim Tough · Oct 7, 2010 · Viewed 18.8k times · Source

I'm looking for a Java library that is capable of performing spatial calculations on sets of lat/lon data. Here are some of the functions that I'm looking for:

  • Calculate the Great Circle distance between two points
  • Determine if a point lies within a simple closed polygon, where the polygon is defined by an ordered list of points
  • Determine if the line between point "A" and point "B" intersects a simple closed polygon, where the polygon is defined by an ordered list of points
  • Determine if point "A" is within a certain radius of point "B"

What I'm NOT looking for:

  • I don't want a library that is dependent upon a database geospatial component, such as Oracle Spatial, and cannot function independently.
  • I don't want a library whose purpose is to generate graphics/maps/etc. I am building an analysis module for an existing application and the end goal is not to create pretty pictures.
  • I don't want a library for searching large amounts of spatial data. If it also happens to do this, that's ok, but I'm not going to use that feature.

The organization is planning to acquire a license for Oracle Spatial eventually (so spatial searching will be covered at that point), but for now I need to implement the analysis functions that I have mentioned above on small data sets without relying on database-supplied spatial support.

Answer

Reed Copsey picture Reed Copsey · Oct 7, 2010

I believe GeoTools would satisfy your requirements. Note that it does have facilities for doing graphics/maps, but they can be left unused easily enough.