Answer the question
In order to leave comments, you need to log in
How to get geo-points from the visible area on the map when changing the map angle?
ES works on the back, from which I get points to display on the Yandex map.
When the map moves, I get the Map Visibility in the form:
topLeftLat, topLeftLng, bottomRightLat , bottomRightLng
[
"exists" => [
"field" => "location"
]
],
[
"geo_bounding_box" => [
"location" => [
"top_left" => $topLeftLat.','.$topLeftLng,
"bottom_right" => $bottomRightLat.','.$bottomRightLng
]
]
]
Answer the question
In order to leave comments, you need to log in
Long story short, how did I resolve this issue?
because I do not need super accuracy, I used the following formula:
//dist расстояние , в моем случает от центра карты до лев верх угла карты в метрах.
// те это то расстояние от центра на котором мы поставим наши точки
// a = угол на который наклонить точки относительно нулевого азимута.
// lat и long координаты точки в центре экрана
var p180= 180/pi;
var dx = p180 * ((cos(a / 180 * pi) * dist) / 6378137) ;
var dy = p180 * ((sin(a / 180 * pi) * dist) / 6378137) ;
var toplat = latitude + dy;
var toplng = longitude + dx / cos(latitude);
var bottomlat = latitude - dy;
var bottomlng = longitude - dx / cos(latitude);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question