if dim < 0 or dim > 2:
            raise GEOSException('invalid ordinate dimension "%d"' % dim)