【问题标题】:Check if a coordinate point are lies in certain box area python [duplicate]检查坐标点是否位于某个框区域python [重复]
【发布时间】:2017-07-19 02:37:33
【问题描述】:

我有一个地方的坐标点,例如:

point_coord = [-7.7938593,110.3634829]

我还有一个viewport的一个区域包含两个坐标点,例如:

northeast = [5.9052479,141.0194444]
southwest = [-11.005261,95.01106190000002]

如果我说明这些点,它会是这样的:

问题是,我如何使用 Python 检查point_coord 是否掉落或位于该框区域的某个位置?

谢谢

【问题讨论】:

    标签: python maps coordinate


    【解决方案1】:

    抱歉,在地图和视口方面没有太多经验,但不应该是这样:

    def isInside(point_coord, northeast, southwest):
        return southwest[0]<point_coord[0]<northeast[0] and\
               southwest[1]<point_coord[1]<northeast[1]
    

    我能想到的唯一可能的极端情况是北极和南极。您可能只需要编写特殊情况来处理它们。

    编辑:一些拼写错误,而不是链接比较。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-04-02
      • 2017-07-29
      • 1970-01-01
      • 2013-02-05
      • 1970-01-01
      • 2013-01-17
      • 1970-01-01
      • 2014-12-18
      相关资源
      最近更新 更多