I did not realise you needed geodesic calculations.

The options below need code, so do not address your original criterion of being pre-packaged, but maybe they will help.

One option is to use Geo::Proj to project your coordinates into a projected coordinate system, perhaps varying the system by location and extent to minimise distortions. Or hand roll such a system yourself. This should in many cases involve updating an existing system with your own central meridian and perhaps parallel(s) of latitude, and this can be done using the proj string.

Coordinate systems can be downloaded from http://spatialreference.org/. Which is best depends on the spatial extent of your bounding boxes.

You might also have some luck with GDAL via Geo::GDAL::FFI. I have not checked if its centroid method handles data in geographic coordinates, but it's not a new problem so I would not be surprised if it does. The issue with this approach is that GDAL is a big beast, so it will take a while to install Alien::gdal and its dependencies if they are not already on your system.

Edit: I just re-read your initial requirements, and GDAL has operations for all the criteria you listed.


In reply to Re^3: Geo bounding box module? by swl
in thread Geo bounding box module? by bliako

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.