Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

From point A, I want to check if a point B is within a certain radius from A. How calculate it usindo JTS?

I tried this:

Coordinate posicaoAtual = new Coordinate(-12.974900375893823, -38.48034163207694); 
Localidade localidade = new Localidade(-12.976353604547635, -38.47492356986686);
Geometry ponto = new GeometryFactory().createPoint(localidade.getCoordenada());
Geometry pos = new GeometryFactory().createPoint(posicaoAtual);
Geometry raio = ponto.buffer(100.0, 8); // HERE

My doubt is to know which the distance unit from the first parameter of the buffer method?

share|improve this question
the buffer distance is in the same units as the coordinates - probably degrees in your example. – iant Jul 17 '13 at 13:52
How to convert degrees in meters? Because the user will send the distance in meters. – Luciano Borges Jul 17 '13 at 14:04
Correcting my question: Geometry raio = ponto.buffer(METER_TO_DEGREE, 8); The buffer method receive in degree. How convert meters in degree? – Luciano Borges Jul 18 '13 at 5:09
I use this calc: (PARAMETER_IN_METER * 0.00001)/1.1132 Is it acceptable? – Luciano Borges Jul 18 '13 at 5:19

JTS is only for cartesian coordinates, your's are ellipsoidal. So I would say the answer is "do not use JTS for this". You would need write a method for the calculation yourself.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.