[FWTools] ogr2ogr and MySQL

Bob Scheller bscheller at hotspotinteractive.com
Thu Feb 25 12:45:18 EST 2010


Hello all, I am new to working with map files but have a strong database
background. I have recently downloaded several .shp files and used ogr2ogr
to import into MySQL. Everything appears to have worked correctly because I
can run an area() function in MySQL and get a result for each of the files.
My problem is that I have lat/long data in another table which I believe I
have correctly converted to a POINT datatype in MySQL. However, when I run a
query using something like the within() function in MySQL, I can't get a
result at all. My import of shapefiles contains 73 polygons which designate
specific areas within Wichita, KS. I have 2,900 points in my table I am
analyzing which I know all have physical addresses in Wichita, KS. However,
my queries return no results. I suspect there may be a problem with the way
I imported the shapefiles into the database that the database is not
associating the area correctly.

The import was done with this command:

ogr2ogr -f "MySQL" MySQL:"dbname,user=root,host=localhost,password=secret"
-lco engine=MYISAM source.shp

My query is:

select b.* from locations b, area z where contains(z.SHAPE, b.locPoint);

z.SHAPE is of datatype GEOMETRY in MySQL. b.locPoint is of datatype POINT in
MySQL.

Any suggestions or pointers to the right information would be appreciated.

-- 

Bob Scheller
Hotspot Interactive, Inc.
Office: 913-871-6990
Mobile: 913-653-2877
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/fwtools/attachments/20100225/6f838efe/attachment.htm 


More information about the FWTools mailing list