Hello Jeremy, Thanks for the help.
Regards, Shamit Verma ----- Original Message ----- From: "Jeremy Zawodny" <[EMAIL PROTECTED]> To: "Shamit Verma" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, January 07, 2003 12:42 PM Subject: Re: How to store maps in MySQL > On Tue, Jan 07, 2003 at 11:22:50AM +0530, Shamit Verma wrote: > > Hi List, > > > > I read that MySQL (4.1) now supports geometric data types. I tried > > to look for documentation related to geometric data types in > > mysql. But could not find any. > > Yeah, the docs haven't been integrated (or even written?) yet. > > > Can someone point me to documentation of geometric data types? > > Are you at all familiar with spatial data in other database systems? > > I'd suggest looking at the OpenGIS spec: > > http://www.opengis.org/techno/specs/99-049.pdf > > But if you're just looking for a flavor, ere's what MySQL 4.1 can do > in a simple exmaple of three points and asking MySQL which ones fall > within given polygons: > > mysql> create table map_test > -> ( > -> name varchar(100) not null primary key, > -> loc tinyblob, > -> spatial index(loc) > -> ); > Query OK, 0 rows affected (0.00 sec) > > mysql> insert into map_test values ('One Two', point(1,2)); > Query OK, 1 row affected (0.00 sec) > > mysql> insert into map_test values ('Two Two', point(2,2)); > Query OK, 1 row affected (0.00 sec) > > mysql> insert into map_test values ('Two One', point(2,1)); > Query OK, 1 row affected (0.00 sec) > > mysql> select name, AsText(loc) from map_test; > +---------+-------------+ > | name | AsText(loc) | > +---------+-------------+ > | One Two | POINT(1 2) | > | Two Two | POINT(2 2) | > | Two One | POINT(2 1) | > +---------+-------------+ > 3 rows in set (0.00 sec) > > mysql> SELECT name FROM map_test WHERE Contains(GeomFromText('POLYGON((0 0, 0 3, 3 3, 3 0, 0 0))'), loc) = 1; > +---------+ > | name | > +---------+ > | One Two | > | Two Two | > | Two One | > +---------+ > 3 rows in set (0.00 sec) > > mysql> SELECT name, AsText(loc) FROM map_test WHERE > Contains(GeomFromText('POLYGON((0 0, 0 1, 1 1, 2 0, 0 0))'), loc) = 1; > +---------+-------------+ > | name | AsText(loc) | > +---------+-------------+ > | Two One | POINT(2 1) | > +---------+-------------+ > 1 row in set (0.00 sec) > > Hope that helps... > > Jeremy > -- > Jeremy D. Zawodny | Perl, Web, MySQL, Linux Magazine, Yahoo! > <[EMAIL PROTECTED]> | http://jeremy.zawodny.com/ > > MySQL 3.23.51: up 23 days, processed 777,922,525 queries (390/sec. avg) > --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php