msg = 'Polygon array must have two columns' if polygon.shape[1] != 2: raise PolygonInputError(msg) msg = ('Points array must be 1 or 2 dimensional. ' 'I got %d dimensions: %s' % (len(points.shape), points)) if not 0 < len(points.shape) < 3: raise PolygonInputError(msg) if len(points.shape) == 1: # Only one point was passed in. Convert to array of points. try: points = numpy.reshape(points, (1, 2)) except ValueError as e: raise PointsInputError(str(e)) msg = ('Point array must have two columns (x,y), ' 'I got points.shape[1]=%d' % points.shape[0]) if points.shape[1] != 2: raise PolygonInputError(msg) msg = ('Points array must be a 2d array. I got %s...' % str(points[:30])) if len(points.shape) != 2: raise PolygonInputError(msg) msg = 'Points array must have two columns' if points.shape[1] != 2: raise PolygonInputError(msg)
msg = 'Polygon array must have two columns' if polygon.shape[1] != 2: raise PolygonInputError(msg) msg = ('Points array must be 1 or 2 dimensional. ' 'I got %d dimensions: %s' % (len(points.shape), points)) if not 0 < len(points.shape) < 3: raise PolygonInputError(msg) if len(points.shape) == 1: # Only one point was passed in. Convert to array of points. try: points = numpy.reshape(points, (1, 2)) except ValueError, e: raise PointsInputError(e.message) msg = ('Point array must have two columns (x,y), ' 'I got points.shape[1]=%d' % points.shape[0]) if points.shape[1] != 2: raise PolygonInputError(msg) msg = ('Points array must be a 2d array. I got %s...' % str(points[:30])) if len(points.shape) != 2: raise PolygonInputError(msg) msg = 'Points array must have two columns' if points.shape[1] != 2: raise PolygonInputError(msg)