fallhunter
fallhunter

Reputation: 551

Is there a function in mysql to get the MBR(Minimal Bounding Rectangles) of Geometry?

I 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?

Upvotes: 1

Views: 2857

Answers (4)

hexist
hexist

Reputation: 5250

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

Upvotes: 7

timemirror
timemirror

Reputation: 596

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

Upvotes: 1

TheSteve0
TheSteve0

Reputation: 3526

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

Upvotes: 0

fastmultiplication
fastmultiplication

Reputation: 3091

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.

Upvotes: 1

Related Questions