MySQL 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. [...]
Posted June 13, 2008 by Casey Bisson
Categories: Technology. Tags: geolocation, MBR, minimum bounding rectangle, mysql, MySQL spatial functions, spatial data, spatial functions. One Comment.
It’s MySQL spatial data week here, though I am spreading out the posts to, um, ease the pain (or boredom). Anyway, here are some commands/functions I don’t want to forget about later:
Start with an existing table called geometry, add a spatial column and index it:
ALTER TABLE GEOMETRY ADD coord POINT NOT NULL;
CREATE SPATIAL INDEX coord [...]
Posted June 12, 2008 by Casey Bisson
Categories: Technology. Tags: geolocation, mysql, MySQL spatial functions, spatial data, spatial functions. One Comment.
MySQL has some powerful, and perhaps underused spatial extensions, but the most interesting functions are still unimplemented: “Note: Currently, MySQL does not implement these functions…â€
Among those as-yet unimplemented functions is DISTANCE(). Alternatives can be found here and here, though neither is clean or simple. I wonder if a simple MBRContains() is good enough, though…
Posted June 10, 2008 by Casey Bisson
Categories: Technology. Tags: distance, geolocation, mysql, MySQL spatial functions, spatial functions, unimplemented, workaround. Be the first one.
Found in the MySQL 5.0 Reference Manual:
Related(g1,g2,pattern_matrix)
Returns 1 or 0 to indicate whether the spatial relationship specified by pattern_matrix exists between g1 and g2. Returns –1 if the arguments are NULL. The pattern matrix is a string. Its specification will be noted here if this function is implemented.
(emphasis mine.)
Posted June 8, 2008 by Casey Bisson
Categories: Dispatches, Technology. Tags: documentation, funny, mysql, MySQL spatial functions, spatial functions, unimplemented. One Comment.