|  | Home | Libraries | People | FAQ | More | 
Checks if a geometry is the empty set.
template<typename Geometry> bool is_empty(Geometry const & geometry)
| Type | Concept | Name | Description | 
|---|---|---|---|
| Geometry const & | Any type fulfilling a Geometry Concept | geometry | A model of the specified concept | 
Returns true if the geometry is the empty set
Either
          #include <boost/geometry.hpp>
        
Or
          #include <boost/geometry/algorithms/is_empty.hpp>
        
The function is_empty implements function IsEmpty from the OGC Simple Feature Specification.
| Geometry | Status | 
|---|---|
| Point | 
                     | 
| Segment | 
                     | 
| Box | 
                     | 
| Linestring | 
                     | 
| Ring | 
                     | 
| Polygon | 
                     | 
| MultiPoint | 
                     | 
| MultiLinestring | 
                     | 
| MultiPolygon | 
                     | 
| Variant | 
                     | 
Constant-time
Check if a geometry is the empty set
#include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> int main() { boost::geometry::model::multi_linestring < boost::geometry::model::linestring < boost::geometry::model::d2::point_xy<double> > > mls; boost::geometry::read_wkt("MULTILINESTRING((0 0,0 10,10 0),(1 1,8 1,1 8))", mls); std::cout << "Is empty? " << (boost::geometry::is_empty(mls) ? "yes" : "no") << std::endl; boost::geometry::clear(mls); std::cout << "Is empty (after clearing)? " << (boost::geometry::is_empty(mls) ? "yes" : "no") << std::endl; return 0; }
Output:
Is empty? no Is empty (after clearing)? yes