Find Stuff By Minimum Bounding Rectangle

mbr mysql minimum bounding rectangleMySQL offers ENVELOPE() to find the minimum bounding rectangle of a geometric object.

The result is a polygon with four segments, defined by five points. It took me a while to make sense of it, partially because the only documentation that I’ve run across so far for POLYGON() syntax is in the ENVELOPE() function mentioned above. I also had to draw a picture to think it through.

They write this: POLYGON(( MINX MINY, MAXX MINY, MAXX MAXY, MINX MAXY, MINX MINY )), I think this (in pseudocode-ish form): POLYGON(( $point_a, $point_b, $point_c, $point_d, $point_a )), with the $point_s corresponding to the diagram.

One thought on “Find Stuff By Minimum Bounding Rectangle

  1. so i’m looking at all your posts about mysql and gis, and i’m kinda curious what you’re working on – might it be relating LCSH geographic subdivisions to map data? now there’s a world of fun and discovery!

Comments are closed.