[Tile-serving] [osm2pgsql] Add area reprojection facility (#454)

Paul Norman notifications at github.com
Sat Oct 3 00:08:28 UTC 2015


> +
> +    // MultiPolygon - return sum of individual areas
> +    if (const geos::geom::MultiPolygon* multi = dynamic_cast<const geos::geom::MultiPolygon *>(geom))
> +    {
> +        double area = 0.0;
> +        for (std::size_t i=0; i<multi->getNumGeometries(); i++)
> +        {
> +            area += getArea(multi->getGeometryN(i));
> +        }
> +        return area;
> +    }
> +
> +    const geos::geom::Polygon *poly = dynamic_cast<const geos::geom::Polygon *>(geom);
> +    if (!poly) return 0.0;
> +
> +    // standard polygon - reproject, then compute area of outer - areas of holes

Why compute the area by doing hole subtraction instead of [getArea from geos::geom::Polygon](http://geos.osgeo.org/doxygen/classgeos_1_1geom_1_1Polygon.html#a7fdaf9550f08f56340b0ce8350501b66)

---
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/454/files#r41080066
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20151002/44a543f0/attachment.html>


More information about the Tile-serving mailing list