[FWTools] ogr2ogr and MySQL
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
Any suggestions or pointers to the right information would be appreciated.
Hotspot Interactive, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the FWTools