Find Stuff By Minimum Bounding Rectangle

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 […] » about 200 words

Working With Spatial Data in MySQL

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 ON geometry (coord); ```

Insert some data; think in terms of POINT(X Y) or POINT(lat lon):

``` INSERT INTO geometry (coord) VALUES( GeomFromText( 'POINT(40 -100)' )); INSERT INTO geometry (coord) VALUES( GeomFromText( 'POINT(1 1)' )); ```

Get those X,Y coordinates back from the table:

``` SELECT X(coord), Y(coord) FROM geometry ```

Get points within a bounding rectangle:

``` SELECT MBRContains( GeomFromText( 'POLYGON((0 0,0 3,3 3,3 0,0 0))' ), coord ) FROM geometry ```

Calculating Distance Between Points In MySQL

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…

The New Plazes

Plazes, a kinda-cool, formerly networked-based geolocation tool has just been revamped. They’ve been promoting this change for over a month (I got a cool invite to the launch party, but couldn’t make the flight to Germany), and they’re continuing the push now that it’s live. I’ve used the new service for a few days, the […] » about 400 words

Plazes Updated

Wearing the badge “still beta,” Plazes, the free, network-based geolocation service, now sports a new coat of paint. Among the improvements is the Flash-based badge (above) and a much improved frontpage/dashboard that combines the map of known locations with the map of active users, formerly two separate screens. On the downside, I sort of miss […] » about 300 words

Google Geo News

This post started with Ryan sending me this link demonstrating a KML overlay of county borders of his bifurcated state in Google Maps.

Then I found this Roundup of Google’s Geo Developer Day (btw, I so wanted to be at Where 2.0) with tales of the new geocoding feature of the Google Maps API, more details about KML-in-Google-Maps, geotagging in Picasa, and the new Google Earth 4.0 beta.

And somewhere along the line, I ran across a link to SketchUp, Google’s 3-D modeler that seems built especially to put dimensional structures in Google Earth.

bsuite_geocode Plugin For WordPress

I’m a big fan of the WP Geo plugin, but I want more. My biggest complaint is that I want to insert coordinates using Google Maps or MultiMap URLs, rather than insert them in the modified story editor. So I wrote a bit of code that reads through the URLs in a post, finds the […] » about 400 words