Spatial Convenience Functions | 0 | +------------------+ mysql>  SELECT ST_IsValid(@ls2); +------------------+ | ST_IsValid(@ls2) | +------------------+ | 1 | +------------------+ Returns the rectangle that forms the envelope around two points, as a  Point ,  LineString , or Polygon . Calculations are done using the Cartesian coordinate system rather than on a sphere, spheroid, or on earth. Given two points  pt1  and  pt2 ,  ST_MakeEnvelope()  creates the result geometry on an abstract plane like this: The result geometry has an SRID of 0. ST_MakeEnvelope()  handles its arguments as described in the introduction to this section, with these exceptions: Simplifies a geometry using the Douglas-Peucker algorithm and returns a simplified value of the same type. The geometry may be any geometry type, although the Douglas-Peucker algorithm may not actually process every type. A geometry collection is processed by giving its components one by one to the simplification algorithm, and the returned geometries are put into a geometry collection as result. The  max_distance  argument is the distance (in units of the input coordinates) of a vertex to other segments to be removed. Vertices within this distance of the simplified linestring are removed. 2341 mysql>  SET @pt1 = ST_GeomFromText(’POINT(0 0)’); mysql>  SET @pt2 = ST_GeomFromText(’POINT(1 1)’); mysql>  SELECT ST_AsText(ST_MakeEnvelope(@pt1, @pt2)); +----------------------------------------+ | ST_AsText(ST_MakeEnvelope(@pt1, @pt2)) | +----------------------------------------+ | POLYGON((0 0,1 0,1 1,0 1,0 0)) | +----------------------------------------+ • ST_MakeEnvelope( pt1 ,  pt2 ) •If  pt1  and  pt2  are equal, the result is the point  pt1 . •Otherwise, if  ( pt1 ,  pt2 )  is a vertical or horizontal line segment, the result is the line segment ( pt1 ,  pt2 ) . •Otherwise, the result is a polygon using  pt1  and  pt2  as diagonal points. •If the arguments are not  Point  values, an  ER_WRONG_ARGUMENTS  error occurs. •An  ER_GIS_INVALID_DATA  error occurs for the additional condition that any coordinate value of the two points is infinite or  NaN . •If any geometry has an SRID value for a geographic spatial reference system (SRS), an ER_NOT_IMPLEMENTED_FOR_GEOGRAPHIC_SRS  error occurs. • ST_Simplify( g ,  max_distance )