Commit 88569ce5 authored by kberry's avatar kberry
Browse files

merge with upstream and changes for jigsaw test

parents b77ba33e 6e4557eb
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ source = autocnet
omit =
    fileio/ControlNetFileV0002_pb2.py
    utils/visualization.py
    vis/*
exclude_lines =
    pragma: no cover
    def __repr__
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ install:

  # Install the non-conda packages if required, requirements.txt duplicates are ignored
  - conda install -c https://conda.anaconda.org/jlaura opencv3=3.0.0
  - conda install -c https://conda.anaconda.org/anaconda gdal
  - conda install -c https://conda.anaconda.org/osgeo gdal
  - conda install -c osgeo proj4
  - conda upgrade numpy
  - pip install -r requirements.txt
+0 −0

Empty file added.

autocnet/cg/cg.py

0 → 100644
+47 −0
Original line number Diff line number Diff line
import json
import ogr
from scipy.spatial import ConvexHull


def convex_hull_ratio(points, ideal_area):
    """

    Parameters
    ----------
    points : ndarray
             (n, 2) array of point coordinates

    ideal_area : float
                 The total area that could be covered

    Returns
    -------
    ratio : float
            The ratio convex hull volume / ideal_area

    """
    hull = ConvexHull(points)
    return hull.volume / ideal_area


def overlapping_polygon_area(polys):
    """

    Parameters
    ----------
    polys : list
            of polygon object with a __geo_interface__

    Returns
    -------
    area : float
           The area of the intersecting polygons
    """
    geom = json.dumps(polys[0].__geo_interface__)
    intersection = ogr.CreateGeometryFromJson(geom)
    for p in polys[1:]:
        geom = json.dumps(p.__geo_interface__)
        geom = ogr.CreateGeometryFromJson(geom)
        intersection = intersection.Intersection(geom)
    area = intersection.GetArea()
    return area
+0 −0

Empty file added.

Loading