Skip to content Skip to sidebar Skip to footer

Check If A Coordinate Point Are Lies In Certain Box Area Python

I have a coordinate point of a place, for example: point_coord = [-7.7938593,110.3634829] I also have a viewport of an area contain two point of corrdinates, for example: northeas

Solution 1:

Sorry, not too much experience with maps and viewports, but shouldn't it simply be:

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

The only possible edge cases I can think of would be north and south poles. You could probably just code special cases to handle them.

Edit: some typos and not chaining comparisons.

Post a Comment for "Check If A Coordinate Point Are Lies In Certain Box Area Python"