Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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.

like image 836
Jim Tough Avatar asked Oct 07 '10 00:10

Jim Tough


2 Answers

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.

like image 89
Reed Copsey Avatar answered Oct 11 '22 23:10

Reed Copsey


There is a new library Spatial4J that seems to fullfill your needs, it supports various spaces and shapes

Spatial4j is a general purpose spatial / geospatial ASL licensed open-source Java library (...)

I haven't used it so far but the README is complete, and repositery is rather popular, and it's available on maven repositery I was looking for such spatial library when I end up both on the repo and on this question.

like image 28
AdrieanKhisbe Avatar answered Oct 12 '22 00:10

AdrieanKhisbe