Closed YeisonVelez11 closed 6 years ago
@wf9a5m75 Excuse my ignorance, but it has not been clear to me. could you help me please? How should that piece of code be?
var circleArea=circle.getBounds(); circleArea.contains({lat:xxx, lng:xxx}) //coordinates to evaluate if is inside of the circle.. //circle.getCenter() and marker.getPosition(). ???
Did you really read my comment, and you don't understand? Are you a junior school student? If yes, I give you exact code. If you are adult, you should use your brain.
@wf9a5m75 I think it's a disrespectful comment. I'm asking you with much respect. We do not all understand and we have the same knowledge as you. and I bet you that if I had your knowledge I would not be arrogant. for your information I am new to this topic of google maps, I have little experience programming and I do not understand very well what I should do. If it makes you feel good, I am what you want to believe it to be, but it is not my fault that I do not understand you. and yes, I read your answer but I'm not sure what I should do.
OKAY, I'm really disappointed your comment. This is NOT programming skill, this is junior school math question.
Here are some hints:
When you create a circle, you need to specify radius
and center
properties.
var R = 50; // 50meter
var centerPos = {lat: ..., lng: ...};
// v2.3.x style
var circle = map.addCircle({
center: centerPos,
radius: R
});
If your circle is moving, you can get both values through getRadius()
and getCenter()
.
var R = center.getRadius();
var centerPos = center.getCenter();
So if a marker is exactly on the edge of the circle, the distance between center
and marker
is distance = R.
If the marker is inside the circle, the distance between center
and marker
is distance < R.
If the marker is outside the circle, the distance between center
and marker
is distance > R.
As I commented below in previous comment, you can calculate distance between center
and marker
position.
Calculating distance between A and B is https://github.com/mapsplugin/cordova-plugin-googlemaps-doc/blob/master/v2.3.0/class/utilities/geometry/spherical/computeDistanceBetween/README.md
So what you should?
Did you resolve your question?
Thanks, I think I have it.
I apologize for the problems, and misunderstandings. I am very bad with maths I must admit it.
Enjoy the maps plugin.
This is just mathematic in junior high school.
https://github.com/mapsplugin/cordova-plugin-googlemaps/issues/2211#issuecomment-380546469