tags:

views:

33

answers:

2

Hi,

Let us say I have two shapes. One is a polygon and the other a square. Each shape consists of lines which two points (a latitude/logitude pair). I would like to determine the degree to which the square is within the polygon (percentages 0 ... 100). Is this possible? Any pointers to relevant algorithms would be very much appreciated. Thanks.

Christian

A: 

In C++ you could try CGAL. or GEOS

Found CGAL in the intersection detection section of the Stonybrook Algorithm Repository maintained by Steven Skiena and GEOS on OpenGeo

MarkJ
A: 

If you know the projection, add the data to a Postgis/postgres table, compute the area, and then do a matrix between all your boxes such that the data is area_box_1 / area_box_2

Boxes    |  1  |  2  |  3  |  4  |  5
    1       20%   0%   0%     5%    0%
    ----------------------------------
    2
    ----------------------------------
    3
    ----------------------------------
    4
    ----------------------------------
    5
dassouki