예제 #1
0
    def cat(self, cat_id, vtype, layer=None, generator=False, geo=None):
        """Return the geometry features with category == cat_id.

        :param cat_id: the category number
        :type cat_id: int
        :param vtype: the type of geometry feature that we are looking for
        :type vtype: str
        :param layer: the layer number that will be used
        :type layer: int
        :param generator: if True return a generator otherwise it return a
                          list of features
        :type generator: bool
        """
        if geo is None and vtype not in _GEOOBJ:
            keys = "', '".join(sorted(_GEOOBJ.keys()))
            raise ValueError("vtype not supported, use one of: '%s'" % keys)
        Obj = _GEOOBJ[vtype] if geo is None else geo
        ilist = Ilist()
        libvect.Vect_cidx_find_all(self.c_mapinfo,
                                   layer if layer else self.layer,
                                   Obj.gtype, cat_id, ilist.c_ilist)
        is2D = not self.is_3D()
        if generator:
            return (read_line(feature_id=v_id, c_mapinfo=self.c_mapinfo,
                              table=self.table, writeable=self.writeable,
                              is2D=is2D)
                    for v_id in ilist)
        else:
            return [read_line(feature_id=v_id, c_mapinfo=self.c_mapinfo,
                              table=self.table, writeable=self.writeable,
                              is2D=is2D)
                    for v_id in ilist]
예제 #2
0
    def cat(self, cat_id, vtype, layer=None, generator=False, geo=None):
        """Return the geometry features with category == cat_id.

        :param cat_id: the category number
        :type cat_id: int
        :param vtype: the type of geometry feature that we are looking for
        :type vtype: str
        :param layer: the layer number that will be used
        :type layer: int
        :param generator: if True return a generator otherwise it return a
                          list of features
        :type generator: bool
        """
        if geo is None and vtype not in _GEOOBJ:
            keys = "', '".join(sorted(_GEOOBJ.keys()))
            raise ValueError("vtype not supported, use one of: '%s'" % keys)
        Obj = _GEOOBJ[vtype] if geo is None else geo
        ilist = Ilist()
        libvect.Vect_cidx_find_all(self.c_mapinfo,
                                   layer if layer else self.layer,
                                   Obj.gtype, cat_id, ilist.c_ilist)
        is2D = not self.is_3D()
        if generator:
            return (read_line(feature_id=v_id, c_mapinfo=self.c_mapinfo,
                              table=self.table, writeable=self.writeable,
                              is2D=is2D)
                    for v_id in ilist)
        else:
            return [read_line(feature_id=v_id, c_mapinfo=self.c_mapinfo,
                              table=self.table, writeable=self.writeable,
                              is2D=is2D)
                    for v_id in ilist]
예제 #3
0
    def read(self, feature_id):
        """Return a geometry object given the feature id.

        :param int feature_id: the id of feature to obtain

        >>> test_vect = VectorTopo(test_vector_name)
        >>> test_vect.open(mode='r')
        >>> feature1 = test_vect.read(0)                     #doctest: +ELLIPSIS
        Traceback (most recent call last):
            ...
        ValueError: The index must be >0, 0 given.
        >>> feature1 = test_vect.read(5)
        >>> feature1
        Line([Point(12.000000, 4.000000), Point(12.000000, 2.000000), Point(12.000000, 0.000000)])
        >>> feature1.length()
        4.0
        >>> test_vect.read(-1)
        Centroid(7.500000, 3.500000)
        >>> len(test_vect)
        21
        >>> test_vect.read(21)
        Centroid(7.500000, 3.500000)
        >>> test_vect.read(22)                             #doctest: +ELLIPSIS
        Traceback (most recent call last):
          ...
        IndexError: Index out of range
        >>> test_vect.close()

        """
        return read_line(feature_id, self.c_mapinfo, self.table, self.writeable,
                         is2D=not self.is_3D())
예제 #4
0
    def read(self, feature_id):
        """Return a geometry object given the feature id.

        :param int feature_id: the id of feature to obtain

        >>> cens = VectorTopo('census')
        >>> cens.open(mode='r')
        >>> feature1 = cens.read(0)                     #doctest: +ELLIPSIS
        Traceback (most recent call last):
            ...
        ValueError: The index must be >0, 0 given.
        >>> feature1 = cens.read(1)
        >>> feature1
        Boundary(v_id=1)
        >>> feature1.length()
        444.54490917696944
        >>> cens.read(-1)
        Centoid(642963.159711, 214994.016279)
        >>> len(cens)
        8920
        >>> cens.read(8920)
        Centoid(642963.159711, 214994.016279)
        >>> cens.read(8921)                             #doctest: +ELLIPSIS
        Traceback (most recent call last):
          ...
        IndexError: Index out of range
        >>> cens.close()

        """
        return read_line(feature_id, self.c_mapinfo, self.table, self.writable,
                         is2D=not self.is_3D())
예제 #5
0
    def geo(self, point, maxdist, type="all", exclude=0):
        """Find the nearest vector feature around a specific point.

        :param point: The point to search
        :type point: grass.pygrass.vector.geometry.Point

        :param maxdist: The maximum search distance around the point
        :type maxdist: float

        :param type: The type of feature to search for
                     Valid type are all the keys in find.vtype dictionary
        :type type: string

        :param exclude: if > 0 number of lines which should be
                        excluded from selection

        :return: A grass.pygrass.vector.geometry.Node if found or None

        This methods uses libvect.Vect_find_line()()

        Examples:

        >>> from grass.pygrass.vector import VectorTopo
        >>> from grass.pygrass.vector.geometry import Point
        >>> test_vect = VectorTopo(test_vector_name)
        >>> test_vect.open('r')

        # Find single features
        >>> points = (Point(10,0), Point(10,6), Point(14,2))
        >>> result = []
        >>> for point in points:
        ...     f = test_vect.find_by_point.geo(point=point, maxdist=1)
        ...     if f:
        ...         result.append(f)
        >>> for f in result:
        ...     print(f.to_wkt_p())    #doctest: +NORMALIZE_WHITESPACE
        LINESTRING(10.000000 4.000000,
                   10.000000 2.000000,
                   10.000000 0.000000)
        POINT(10.000000 6.000000)
        LINESTRING(14.000000 4.000000,
                   14.000000 2.000000,
                   14.000000 0.000000)

        >>> test_vect.find_by_point.geo(point=Point(20,20), maxdist=0)

        >>> test_vect.close()
        """
        feature_id = libvect.Vect_find_line(
            self.c_mapinfo,
            point.x,
            point.y,
            point.z if point.z else 0,
            self.vtype[type],
            float(maxdist),
            int(not point.is2D),
            exclude,
        )
        if feature_id:
            return read_line(feature_id, self.c_mapinfo, self.table, self.writeable)
예제 #6
0
    def read(self, feature_id):
        """Return a geometry object given the feature id.

        :param int feature_id: the id of feature to obtain

        >>> test_vect = VectorTopo(test_vector_name)
        >>> test_vect.open(mode='r')
        >>> feature1 = test_vect.read(0)                     #doctest: +ELLIPSIS
        Traceback (most recent call last):
            ...
        ValueError: The index must be >0, 0 given.
        >>> feature1 = test_vect.read(5)
        >>> feature1
        Line([Point(12.000000, 4.000000), Point(12.000000, 2.000000), Point(12.000000, 0.000000)])
        >>> feature1.length()
        4.0
        >>> test_vect.read(-1)
        Centoid(7.500000, 3.500000)
        >>> len(test_vect)
        21
        >>> test_vect.read(21)
        Centoid(7.500000, 3.500000)
        >>> test_vect.read(22)                             #doctest: +ELLIPSIS
        Traceback (most recent call last):
          ...
        IndexError: Index out of range
        >>> test_vect.close()

        """
        return read_line(feature_id, self.c_mapinfo, self.table, self.writeable,
                         is2D=not self.is_3D())
예제 #7
0
    def geo(self, point, maxdist, type='all', exclude=0):
        """Find the nearest vector feature around a specific point.

            :param point: The point to search
            :type point: grass.pygrass.vector.geometry.Point

            :param maxdist: The maximum search distance around the point
            :type maxdist: float

            :param type: The type of feature to search for
                         Valid type are all the keys in find.vtype dictionary
            :type type: string

            :param exclude: if > 0 number of lines which should be
                            excluded from selection

            :return: A grass.pygrass.vector.geometry.Node if found or None

            This methods uses libvect.Vect_find_line()()

            Examples:

            >>> from grass.pygrass.vector import VectorTopo
            >>> from grass.pygrass.vector.geometry import Point
            >>> test_vect = VectorTopo(test_vector_name)
            >>> test_vect.open('r')

            # Find single features
            >>> points = (Point(10,0), Point(10,6), Point(14,2))
            >>> result = []
            >>> for point in points:
            ...     f = test_vect.find_by_point.geo(point=point, maxdist=1)
            ...     if f:
            ...         result.append(f)
            >>> for f in result:
            ...     print(f.to_wkt_p())    #doctest: +NORMALIZE_WHITESPACE
            LINESTRING(10.000000 4.000000,
                       10.000000 2.000000,
                       10.000000 0.000000)
            POINT(10.000000 6.000000)
            LINESTRING(14.000000 4.000000,
                       14.000000 2.000000,
                       14.000000 0.000000)

            >>> test_vect.find_by_point.geo(point=Point(20,20), maxdist=0)

            >>> test_vect.close()
        """
        feature_id = libvect.Vect_find_line(self.c_mapinfo,
                                            point.x, point.y,
                                            point.z if point.z else 0,
                                            self.vtype[type], float(maxdist),
                                            int(not point.is2D), exclude)
        if feature_id:
            return read_line(feature_id, self.c_mapinfo,
                             self.table, self.writeable)
예제 #8
0
파일: find.py 프로젝트: starseeker/archival
    def geo(self, point, maxdist, type='all', exclude=0):
        """Find the nearest line. Vect_find_line

        Valid type are all the keys in find.vtype dictionary
        """
        feature_id = libvect.Vect_find_line(self.c_mapinfo, point.x, point.y,
                                            point.z if point.z else 0,
                                            self.vtype[type], float(maxdist),
                                            int(not point.is2D), exclude)
        if feature_id:
            return read_line(feature_id, self.c_mapinfo, self.table,
                             self.writable)
예제 #9
0
파일: find.py 프로젝트: caomw/grass
    def geo(self, point, maxdist, type='all', exclude=0):
        """Find the nearest line. Vect_find_line

        Valid type are all the keys in find.vtype dictionary
        """
        feature_id = libvect.Vect_find_line(self.c_mapinfo,
                                            point.x, point.y,
                                            point.z if point.z else 0,
                                            self.vtype[type], float(maxdist),
                                            int(not point.is2D), exclude)
        if feature_id:
            return read_line(feature_id, self.c_mapinfo,
                             self.table, self.writable)
예제 #10
0
파일: find.py 프로젝트: caomw/grass
    def geos(self, bbox, type='all', bbox_list=False):
        """Find the geometry features contained in the bbox.
        Vect_select_lines_by_box

        Valid type are all the keys in find.vtype dictionary
        """
        found = BoxList()
        if libvect.Vect_select_lines_by_box(self.c_mapinfo, bbox.c_bbox,
                                            self.vtype[type], found.c_boxlist):
            if bbox_list:
                return found
            else:
                return (read_line(f_id, self.c_mapinfo, self.table,
                                  self.writable) for f_id in found.ids)
예제 #11
0
파일: find.py 프로젝트: starseeker/archival
    def geos(self, bbox, type='all', bbox_list=False):
        """Find the geometry features contained in the bbox.
        Vect_select_lines_by_box

        Valid type are all the keys in find.vtype dictionary
        """
        found = BoxList()
        if libvect.Vect_select_lines_by_box(self.c_mapinfo, bbox.c_bbox,
                                            self.vtype[type], found.c_boxlist):
            if bbox_list:
                return found
            else:
                return (read_line(f_id, self.c_mapinfo, self.table,
                                  self.writable) for f_id in found.ids)
예제 #12
0
파일: find.py 프로젝트: caomw/grass
    def geos(self, point, maxdist, type='all', exclude=None):
        """Find the nearest line. Vect_find_line_list

        Valid type are all the keys in find.vtype dictionary
        """
        excl = Ilist(exclude) if exclude else Ilist([])
        found = Ilist()
        if libvect.Vect_find_line_list(self.c_mapinfo,
                                       point.x, point.y,
                                       point.z if point.z else 0,
                                       self.vtype[type], float(maxdist),
                                       int(not point.is2D),
                                       excl.c_ilist, found.c_ilist):
            return [read_line(f_id, self.c_mapinfo, self.table, self.writable)
                    for f_id in found]
        else:
            return []
예제 #13
0
파일: find.py 프로젝트: starseeker/archival
    def geos(self, point, maxdist, type='all', exclude=None):
        """Find the nearest line. Vect_find_line_list

        Valid type are all the keys in find.vtype dictionary
        """
        excl = Ilist(exclude) if exclude else Ilist([])
        found = Ilist()
        if libvect.Vect_find_line_list(self.c_mapinfo, point.x, point.y,
                                       point.z if point.z else 0,
                                       self.vtype[type], float(maxdist),
                                       int(not point.is2D), excl.c_ilist,
                                       found.c_ilist):
            return [
                read_line(f_id, self.c_mapinfo, self.table, self.writable)
                for f_id in found
            ]
        else:
            return []
예제 #14
0
    def geos(self, point, maxdist, type="all", exclude=None):
        """Find the nearest vector features around a specific point.

        :param point: The point to search
        :type point: grass.pygrass.vector.geometry.Point

        :param maxdist: The maximum search distance around the point
        :type maxdist: float

        :param type: The type of feature to search for
                     Valid type are all the keys in find.vtype dictionary
        :type type: string

        :param exclude: if > 0 number of lines which should be
                        excluded from selection

        :return: A list of grass.pygrass.vector.geometry
                 (Line, Point, Boundary, Centroid) if found or None

        This methods uses libvect.Vect_find_line_list()()

        Examples:

        >>> from grass.pygrass.vector import VectorTopo
        >>> from grass.pygrass.vector.geometry import Point
        >>> test_vect = VectorTopo(test_vector_name)
        >>> test_vect.open('r')

        # Find multiple features
        >>> points = (Point(10,0), Point(10,5), Point(14,2))
        >>> result = []
        >>> for point in points:
        ...     f = test_vect.find_by_point.geos(point=point,
        ...                                      maxdist=1.5)
        ...     if f:
        ...         result.append(f)
        >>> for f in result:
        ...     print(f)             #doctest: +NORMALIZE_WHITESPACE
        [Line([Point(10.000000, 4.000000),
               Point(10.000000, 2.000000),
               Point(10.000000, 0.000000)])]
        [Line([Point(10.000000, 4.000000),
               Point(10.000000, 2.000000),
               Point(10.000000, 0.000000)]),
         Point(10.000000, 6.000000)]
        [Line([Point(14.000000, 4.000000),
               Point(14.000000, 2.000000),
               Point(14.000000, 0.000000)])]

        # Find multiple boundaries
        >>> point = Point(3,3)
        >>> result = test_vect.find_by_point.geos(point=Point(3,3),
        ...                                          type="boundary",
        ...                                          maxdist=1.5)
        >>> result                   #doctest: +NORMALIZE_WHITESPACE
        [Boundary([Point(0.000000, 4.000000), Point(4.000000, 4.000000)]),
         Boundary([Point(4.000000, 4.000000), Point(4.000000, 0.000000)]),
         Boundary([Point(1.000000, 1.000000), Point(1.000000, 3.000000),
                   Point(3.000000, 3.000000), Point(3.000000, 1.000000),
                   Point(1.000000, 1.000000)]),
         Boundary([Point(4.000000, 4.000000), Point(6.000000, 4.000000)])]

        # Find multiple centroids
        >>> point = Point(3,3)
        >>> result = test_vect.find_by_point.geos(point=Point(3,3),
        ...                                          type="centroid",
        ...                                          maxdist=1.5)
        >>> result                   #doctest: +NORMALIZE_WHITESPACE
        [Centroid(2.500000, 2.500000),
         Centroid(3.500000, 3.500000)]

        >>> test_vect.find_by_point.geos(point=Point(20,20), maxdist=0)

        >>> test_vect.close()
        """
        excl = Ilist(exclude) if exclude else Ilist([])
        found = Ilist()
        if libvect.Vect_find_line_list(
            self.c_mapinfo,
            point.x,
            point.y,
            point.z if point.z else 0,
            self.vtype[type],
            float(maxdist),
            int(not point.is2D),
            excl.c_ilist,
            found.c_ilist,
        ):
            return [
                read_line(f_id, self.c_mapinfo, self.table, self.writeable)
                for f_id in found
            ]
예제 #15
0
    def geos(self, bbox, type='all', bboxlist_only=False):
        """Find vector features inside a boundingbox.

            :param bbox: The boundingbox to search in
            :type bbox: grass.pygrass.vector.basic.Bbox

            :param type: The type of feature to search for
                         Valid type are all the keys in find.vtype dictionary
            :type type: string

            :param bboxlist_only: If true the BoxList will be returned,
                                  no features are generated
            :type bboxlist_only: boolean

            :return: A list of grass.pygrass.vector.geometry
                     (Line, Point, Boundary, Centroid) if found,
                     or None if nothing was found.
                     If bboxlist_only is True a BoxList
                     object will be returned, or None if nothing was found.

            This methods uses libvect.Vect_select_lines_by_box()

            Examples:

            >>> from grass.pygrass.vector import VectorTopo
            >>> from grass.pygrass.vector.basic import Bbox
            >>> test_vect = VectorTopo(test_vector_name)
            >>> test_vect.open('r')

            >>> bbox = Bbox(north=5, south=-1, east=3, west=-1)
            >>> result = test_vect.find_by_bbox.geos(bbox=bbox)
            >>> [bbox for bbox in result] #doctest: +NORMALIZE_WHITESPACE
            [Boundary([Point(4.000000, 0.000000), Point(0.000000, 0.000000)]),
             Boundary([Point(0.000000, 0.000000), Point(0.000000, 4.000000)]),
             Boundary([Point(0.000000, 4.000000), Point(4.000000, 4.000000)]),
             Boundary([Point(1.000000, 1.000000), Point(1.000000, 3.000000),
                       Point(3.000000, 3.000000), Point(3.000000, 1.000000),
                       Point(1.000000, 1.000000)]),
             Centoid(2.500000, 2.500000)]

            >>> bbox = Bbox(north=5, south=-1, east=3, west=-1)
            >>> result = test_vect.find_by_bbox.geos(bbox=bbox,
            ...                                      bboxlist_only=True)
            >>> result                   #doctest: +NORMALIZE_WHITESPACE
            Boxlist([Bbox(0.0, 0.0, 4.0, 0.0),
                     Bbox(4.0, 0.0, 0.0, 0.0),
                     Bbox(4.0, 4.0, 4.0, 0.0),
                     Bbox(3.0, 1.0, 3.0, 1.0),
                     Bbox(2.5, 2.5, 2.5, 2.5)])

            >>> bbox = Bbox(north=7, south=-1, east=15, west=9)
            >>> result = test_vect.find_by_bbox.geos(bbox=bbox)
            >>> [bbox for bbox in result] #doctest: +NORMALIZE_WHITESPACE
            [Line([Point(10.000000, 4.000000), Point(10.000000, 2.000000),
                   Point(10.000000, 0.000000)]),
             Point(10.000000, 6.000000),
             Line([Point(12.000000, 4.000000), Point(12.000000, 2.000000),
                   Point(12.000000, 0.000000)]),
             Point(12.000000, 6.000000),
             Line([Point(14.000000, 4.000000), Point(14.000000, 2.000000),
                   Point(14.000000, 0.000000)]),
             Point(14.000000, 6.000000)]

            >>> bbox = Bbox(north=20, south=18, east=20, west=18)
            >>> test_vect.find_by_bbox.geos(bbox=bbox)

            >>> bbox = Bbox(north=20, south=18, east=20, west=18)
            >>> test_vect.find_by_bbox.geos(bbox=bbox, bboxlist_only=True)

            >>> test_vect.close()
        """
        found = BoxList()
        if libvect.Vect_select_lines_by_box(self.c_mapinfo, bbox.c_bbox,
                                            self.vtype[type], found.c_boxlist):
            if bboxlist_only:
                return found
            else:
                return (read_line(f_id, self.c_mapinfo, self.table,
                                  self.writeable) for f_id in found.ids)
예제 #16
0
    def geos(self, point, maxdist, type='all', exclude=None):
        """Find the nearest vector features around a specific point.

            :param point: The point to search
            :type point: grass.pygrass.vector.geometry.Point

            :param maxdist: The maximum search distance around the point
            :type maxdist: float

            :param type: The type of feature to search for
                         Valid type are all the keys in find.vtype dictionary
            :type type: string

            :param exclude: if > 0 number of lines which should be
                            excluded from selection

            :return: A list of grass.pygrass.vector.geometry
                     (Line, Point, Boundary, Centroid) if found or None

            This methods uses libvect.Vect_find_line_list()()

            Examples:

            >>> from grass.pygrass.vector import VectorTopo
            >>> from grass.pygrass.vector.geometry import Point
            >>> test_vect = VectorTopo(test_vector_name)
            >>> test_vect.open('r')

            # Find multiple features
            >>> points = (Point(10,0), Point(10,5), Point(14,2))
            >>> result = []
            >>> for point in points:
            ...     f = test_vect.find_by_point.geos(point=point,
            ...                                      maxdist=1.5)
            ...     if f:
            ...         result.append(f)
            >>> for f in result:
            ...     print(f)             #doctest: +NORMALIZE_WHITESPACE
            [Line([Point(10.000000, 4.000000),
                   Point(10.000000, 2.000000),
                   Point(10.000000, 0.000000)])]
            [Line([Point(10.000000, 4.000000),
                   Point(10.000000, 2.000000),
                   Point(10.000000, 0.000000)]),
             Point(10.000000, 6.000000)]
            [Line([Point(14.000000, 4.000000),
                   Point(14.000000, 2.000000),
                   Point(14.000000, 0.000000)])]

            # Find multiple boundaries
            >>> point = Point(3,3)
            >>> result = test_vect.find_by_point.geos(point=Point(3,3),
            ...                                          type="boundary",
            ...                                          maxdist=1.5)
            >>> result                   #doctest: +NORMALIZE_WHITESPACE
            [Boundary([Point(0.000000, 4.000000), Point(4.000000, 4.000000)]),
             Boundary([Point(4.000000, 4.000000), Point(4.000000, 0.000000)]),
             Boundary([Point(1.000000, 1.000000), Point(1.000000, 3.000000),
                       Point(3.000000, 3.000000), Point(3.000000, 1.000000),
                       Point(1.000000, 1.000000)]),
             Boundary([Point(4.000000, 4.000000), Point(6.000000, 4.000000)])]

            # Find multiple centroids
            >>> point = Point(3,3)
            >>> result = test_vect.find_by_point.geos(point=Point(3,3),
            ...                                          type="centroid",
            ...                                          maxdist=1.5)
            >>> result                   #doctest: +NORMALIZE_WHITESPACE
            [Centoid(2.500000, 2.500000),
             Centoid(3.500000, 3.500000)]

            >>> test_vect.find_by_point.geos(point=Point(20,20), maxdist=0)

            >>> test_vect.close()
        """
        excl = Ilist(exclude) if exclude else Ilist([])
        found = Ilist()
        if libvect.Vect_find_line_list(self.c_mapinfo,
                                       point.x, point.y,
                                       point.z if point.z else 0,
                                       self.vtype[type], float(maxdist),
                                       int(not point.is2D),
                                       excl.c_ilist, found.c_ilist):
            return [read_line(f_id, self.c_mapinfo, self.table, self.writeable)
                    for f_id in found]
예제 #17
0
    def geos(self, bbox, type="all", bboxlist_only=False):
        """Find vector features inside a boundingbox.

        :param bbox: The boundingbox to search in
        :type bbox: grass.pygrass.vector.basic.Bbox

        :param type: The type of feature to search for
                     Valid type are all the keys in find.vtype dictionary
        :type type: string

        :param bboxlist_only: If true the BoxList will be returned,
                              no features are generated
        :type bboxlist_only: boolean

        :return: A list of grass.pygrass.vector.geometry
                 (Line, Point, Boundary, Centroid) if found,
                 or None if nothing was found.
                 If bboxlist_only is True a BoxList
                 object will be returned, or None if nothing was found.

        This methods uses libvect.Vect_select_lines_by_box()

        Examples:

        >>> from grass.pygrass.vector import VectorTopo
        >>> from grass.pygrass.vector.basic import Bbox
        >>> test_vect = VectorTopo(test_vector_name)
        >>> test_vect.open('r')

        >>> bbox = Bbox(north=5, south=-1, east=3, west=-1)
        >>> result = test_vect.find_by_bbox.geos(bbox=bbox)
        >>> [bbox for bbox in result] #doctest: +NORMALIZE_WHITESPACE
        [Boundary([Point(4.000000, 0.000000), Point(0.000000, 0.000000)]),
         Boundary([Point(0.000000, 0.000000), Point(0.000000, 4.000000)]),
         Boundary([Point(0.000000, 4.000000), Point(4.000000, 4.000000)]),
         Boundary([Point(1.000000, 1.000000), Point(1.000000, 3.000000),
                   Point(3.000000, 3.000000), Point(3.000000, 1.000000),
                   Point(1.000000, 1.000000)]),
         Centroid(2.500000, 2.500000)]

        >>> bbox = Bbox(north=5, south=-1, east=3, west=-1)
        >>> result = test_vect.find_by_bbox.geos(bbox=bbox,
        ...                                      bboxlist_only=True)
        >>> result                   #doctest: +NORMALIZE_WHITESPACE
        Boxlist([Bbox(0.0, 0.0, 4.0, 0.0),
                 Bbox(4.0, 0.0, 0.0, 0.0),
                 Bbox(4.0, 4.0, 4.0, 0.0),
                 Bbox(3.0, 1.0, 3.0, 1.0),
                 Bbox(2.5, 2.5, 2.5, 2.5)])

        >>> bbox = Bbox(north=7, south=-1, east=15, west=9)
        >>> result = test_vect.find_by_bbox.geos(bbox=bbox)
        >>> [bbox for bbox in result] #doctest: +NORMALIZE_WHITESPACE
        [Line([Point(10.000000, 4.000000), Point(10.000000, 2.000000),
               Point(10.000000, 0.000000)]),
         Point(10.000000, 6.000000),
         Line([Point(12.000000, 4.000000), Point(12.000000, 2.000000),
               Point(12.000000, 0.000000)]),
         Point(12.000000, 6.000000),
         Line([Point(14.000000, 4.000000), Point(14.000000, 2.000000),
               Point(14.000000, 0.000000)]),
         Point(14.000000, 6.000000)]

        >>> bbox = Bbox(north=20, south=18, east=20, west=18)
        >>> test_vect.find_by_bbox.geos(bbox=bbox)

        >>> bbox = Bbox(north=20, south=18, east=20, west=18)
        >>> test_vect.find_by_bbox.geos(bbox=bbox, bboxlist_only=True)

        >>> test_vect.close()
        """
        found = BoxList()
        if libvect.Vect_select_lines_by_box(
            self.c_mapinfo, bbox.c_bbox, self.vtype[type], found.c_boxlist
        ):
            if bboxlist_only:
                return found
            else:
                return (
                    read_line(f_id, self.c_mapinfo, self.table, self.writeable)
                    for f_id in found.ids
                )