Is there a function in mysql to get the MBR(Minimal Bounding Rectangles) of Geometry?
开发者_StackOverflowI found that some result of MBRContains(g1,g2) and other functions seems not right to me. and I want to find out why. how to see the mbr?
The Envelope
function is what you're looking for to get the MBR for an arbitrary Geometry. See: http://dev.mysql.com/doc/refman/5.5/en/gis-general-property-functions.html#function_envelope
could this be why: http://forums.mysql.com/read.php?23,271928,271968
minimum bounding rectangles for a geometry always have edges parallel to the coordinate axes.
You can just construct them youself with min & max, too.
I agree with Steve0 PostGIS is the way to go...... or you could use the Java Topology Suite (JTS).. or Net Topology Suite (NTS) version... and use datastores such as the very common GIS format of Shapefiles rather than a full db. Guess it depends what you're doing.
As fastmultiplication said MBRs are parallel to coord axes... however you can also use the rotating caliper approach to find minimum bounding boxes which are aligned to the longest axis line of the shape... if you need that.
Check here for more info:
http://cgm.cs.mcgill.ca/~orm/rotcal.html
And in general - MySQL is not the database to use for spatial operations. Most of the spatial functions are not really implemented. I would reccomend PostGIS on Postgresql for a spatial FOSS db. You could also look at spatiallite, built on SQLIte
精彩评论