Topic: Verify that the object is out of scope

Hello! Tell me how to check that the object is beyond the scope of the map camera? Using geographic coordinates for this purpose

Re: Verify that the object is out of scope

Hello.

Get the coordinates of the corners of the map and compare it with your coordinate.

public static bool InMapView(double lng, double lat)
{
    double tlx, tly, brx, bry;
    OnlineMaps.instance.GetCorners(out tlx, out tly, out brx, out bry);

    if (lat > tly || lat < bry) return false;
    if (tlx < brx && (lng < tlx || lng > brx)) return false;
    if (tlx > brx && lng < tlx && lng > brx) return false;

    return true;
}
Kind Regards,
Infinity Code Team

3 (edited by NovaEiz 2018-08-17 18:13:29)

Re: Verify that the object is out of scope

Thx!)

Re: Verify that the object is out of scope

Now I used it. Thanks again for the help)
But it's not quite that. Do you have methods to get the camera corners that look at the map? After all, the map of the visibility boundary is wider than that of the camera. I would like to use the visibility of the camera.

Can you help? Thanks for any help)

Re: Verify that the object is out of scope

Convert the geographic coordinate to a screen position, and compare with the screen size.
OnlineMapsControlBase.GetScreenPosition
http://infinity-code.com/doxygen/online … b35214c35b

Kind Regards,
Infinity Code Team

Re: Verify that the object is out of scope

Thank you so much!