Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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
System.out.println(raio.contains(pos));

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
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.