开发者

Tools/recommendations to create and check if address falls within a specified boundary on a map?

开发者 https://www.devze.com 2023-03-10 09:16 出处:网络
Abstract problem: Define some (non-rectangular, non-circular) topologically closed area on a map. Find out way to query that map such that it returns true if longitude/latitude within the boundary.

Abstract problem: Define some (non-rectangular, non-circular) topologically closed area on a map. Find out way to query that map such that it returns true if longitude/latitude within the boundary.

Applied problem:

Let's say we're dealing 开发者_运维问答with newspaper boy coverage. A coverage area is defined for each newspaper boy, and I query each house address to find who services what address.

I am looking for suggestions/hints/tips on how best to do this (real world, so helpful APIs and tools would be much appreciated).

So, first defining a boundary, then allowing for an address to query for membership within a specific boundary.


We have a mapping software at work where we implemented this exact problem (obviously in a different domain than paperboy coverage). We could not find an out of the box solution, so we implemented our own.

We solved this problem by defining the geographical areas as set of points (given in latitude and longitude) and used the ray-casting point in polygon method.

http://en.wikipedia.org/wiki/Point_in_polygon

The math is not too complex, but there is a fair bit of setup work involved.

A quick google search brought up this sample code for implementation:

http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html#The%20C%20Code

Good luck! I would be happy to clarify anything if needed.

0

精彩评论

暂无评论...
验证码 换一张
取 消