Lat-Lon Point is in rectangle defined by two other Lat-Lon points

…衆ロ難τιáo~ 提交于 2019-12-25 14:48:24

问题


I would like to determine if a certain point is contained within a 'rectangle'. The 'rectangle' will be made up of latitude/longitude coordinates (given northWest and southEast coordinate points)... so basically here are the parameters:

public boolean hasPoint(LatLon northWest, LatLon southEast, LatLon point) {}

The LatLon class just has: double latitude; double longitude;

I have no idea how to start this... any help will be appreciated.


回答1:


Assuming this LatLon class just has an x and y value. How about just checking if your point x/y lies between the x/y from your other 2 positions ?



来源:https://stackoverflow.com/questions/42823844/lat-lon-point-is-in-rectangle-defined-by-two-other-lat-lon-points

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!