Alpha Video Training
Results 1 to 12 of 12

Thread: MySQL and Geo data + search??

  1. #1
    Member
    Real Name
    Jeff Blackwell
    Join Date
    Sep 2011
    Location
    Salem, IN
    Posts
    90

    Default MySQL and Geo data + search??

    Working with the Geographic Search. Using MySQL, the search always returns nothing. Is this a known issue with MySQL right now? I tried with my own table, then even used the ones exactly as described in the MySQL Specific tasks section... Like the DDL below.
    CREATE TABLE geogtest (
    KeyValue VarChar(25) NOT NULL,
    Location geometry NOT NULL,
    PRIMARY KEY (
    KeyValue
    )
    ) ENGINE=InnoDB ;

    Using lon and lat fields I can get things to come up in an Alternate View - just not in the Geographic Search.

    Am I missing something? Or is there a known issue with MySQL ?

    Thanks!

  2. #2
    "Certified" Alphaholic Clipper87's Avatar
    Real Name
    Frank
    Join Date
    Dec 2008
    Location
    Antwerp, Belgium
    Posts
    1,891

    Default Re: MySQL and Geo data + search??

    From the v11 notes:

    Unfortunately, the internal support for geospatial data storage and comparison operations varies greatly from database to database. Alpha Five Version 11 introduces a portable syntax for working with geographic data that is supported for those databases that have sufficient internal support for the core data types and operations. At release time, Alpha Five Version 11 supports geographic data in Microsoft SQL Server, Oracle, DB2, PostgreSQL and (to some extent) MySQL.

    I think this will answer your question.
    Frank

    Tell me and I'll forget; show me and I may remember; involve me and I'll understand

  3. #3
    Member
    Real Name
    Jeff Blackwell
    Join Date
    Sep 2011
    Location
    Salem, IN
    Posts
    90

    Default Re: MySQL and Geo data + search??

    Thank you sir. That's the answer that I feared. That said, it makes sense... It might be worthwhile for the docs to note what parts are supported in Portable SQL and what are not. In MySQL's case, this currently appears to be the Select by radius or Select by polygon type of functions. Which in turn, make the Geographic Search a "no-workie". If anyone has any workaround ideas, I'm open to them. Failing that, it looks like if I want that functionality I get to write it in native SQL and work around it that way. Or do without. In at least one case, switching DB's is not a palatable option.
    Thanks again!

  4. #4
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,838

    Default Re: MySQL and Geo data + search??

    I built a system using MySQL geospatial fields in A5 version 10, which does not support those geospatial fields. It was difficult but I used various custom stored functions to arrive at proper polygon and radius searches. In V11 those field types are recognized and my task would be easier but I would still have to use the custom functions because MySQL does not fully comply with the geo-spatial specification like SQL Server does.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  5. #5
    "Certified" Alphaholic
    Real Name
    Bill Griffin
    Join Date
    Jul 2001
    Location
    Edgewood, NY
    Posts
    1,201

    Default Re: MySQL and Geo data + search??

    Jeff,

    I think you are missing something. mainly a location field. A location field which contains the geography info that is required (not long and lat) for the polygon and radius searches. You do need the longitude and latitude to update the location field though. It absolutely works fine in MySQL. There is some stuff in the wiki about bulk geocoding a DB. My guess is that if you did not update the location field for each record, so you have no location data. Use geometry as the data type for the location field in MySQL. The long and latitude are not geometry types, but (decimal, 18,5) Look at the sample airport db (although this is for sql server).

    Bill
    Last edited by Bill Griffin; 10-05-2011 at 03:57 PM.
    Bill Griffin
    Parkell, Inc

  6. #6
    Member
    Real Name
    Jeff Blackwell
    Join Date
    Sep 2011
    Location
    Salem, IN
    Posts
    90

    Default Re: MySQL and Geo data + search??

    Bill -

    I obviously AM missing something... (grin). I did put in a location field (see the DDL in the OP above) and I followed the exact script given just below that in the MySQL specific tasks page to load a point. Then no workie when I tried a Geographical Search on a nearby center. Long and Lat were just fields that I added later to try to work AROUND the lack of the location working in the search. I've tried all sorts of permutations of the Geometry data type, search set up etc.

    That said, by your comment, am I to understand that you have it WORKING with MySQL?? As in doing a Geographical Search? If so could you please post me the DDL that you are using that you _know_ to be working? I swear I tried the example EXACTLY as written in the docs with no joy. If you've got it working, you've got my undivided attention! (grin)

  7. #7
    "Certified" Alphaholic
    Real Name
    Bill Griffin
    Join Date
    Jul 2001
    Location
    Edgewood, NY
    Posts
    1,201

    Default Re: MySQL and Geo data + search??

    Jeff,

    I am on my way out the door and won't be back till tomorrow afternoon. I used the sample airport db (less the geography field, imported it into MySQL and updated the location field with the script for bulk geocoding. I am certainly no sql (or xbasic) wiz and I was able to get this done. I will get to this as soon as I get in tomorrow.

    Bill
    Last edited by Bill Griffin; 10-05-2011 at 04:29 PM.
    Bill Griffin
    Parkell, Inc

  8. #8
    Member
    Real Name
    Jeff Blackwell
    Join Date
    Sep 2011
    Location
    Salem, IN
    Posts
    90

    Default Re: MySQL and Geo data + search??

    Bill -

    Any help is VERY much appreciated. I'll go down that road and see if I can get there as well.

    THANKS!

  9. #9
    Member
    Real Name
    Jeff Blackwell
    Join Date
    Sep 2011
    Location
    Salem, IN
    Posts
    90

    Default Re: MySQL and Geo data + search??

    UPDATE - (especially to Bill)
    I got the data loaded and SOME of the searches work now. The reason that I didn't think that they were working before was that I was doing Radius searches. Those still are No Workie... I tried a Polygon search and voila - we have success! Still playing with it to determine what works and what doesn't. Big thanks to Mr. Griffin for keeping me at it. If anyone else has MySQL working - can you please verify whether radius searches are working for you or not? Who knows, there may be yet another piece to the puzzle.

  10. #10
    Member
    Real Name
    Jeff Blackwell
    Join Date
    Sep 2011
    Location
    Salem, IN
    Posts
    90

    Default Re: MySQL and Geo data + search??

    Update - Big thanks to Bill - I think that I have things working. I am still working on what exactly the root causes were. I have 3 "suspects" right now. I will run some tests today and confirm things. Suffice it to say that it CAN be done. I will edit this post with some final recommendations as soon as I can.

    BOTTOM LINE - You CAN do this with MySQL!! I would certainly advise getting on the latest version of MySQL. I am running 5.5 successfully. For me 5.0.26 looked like it supported stuff but did not work properly. It sounds like there is more work going on in this area - but don't give up if you're working on a MySQL project. If anyone else is having trouble, upgrade to the latest and give it a go. And yell if it still has issues!
    Last edited by Jeff Blackwell; 10-06-2011 at 12:22 PM.

  11. #11
    Member MichaelCarroll's Avatar
    Real Name
    Michael Carroll
    Join Date
    Feb 2008
    Posts
    467

    Default Re: MySQL and Geo data + search??

    Working my way through this part of v11 and found this reference for MySQl geo data searching that is quite informative.

    http://www.scribd.com/doc/2569355/Ge...rch-with-MySQL

    Michael

  12. #12
    Member
    Real Name
    Jeff Blackwell
    Join Date
    Sep 2011
    Location
    Salem, IN
    Posts
    90

    Default Re: MySQL and Geo data + search??

    That does look interesting. My problem was chiefly just getting MySQL to the proper version. Life got a LOT easier after that! The Alpha stuff pretty much handles things from there. Thanks for that info Michael. That does look helpful in some of the stuff I'm playing with.

Similar Threads

  1. Will V11 be geo-aware?
    By jchasko in forum General Questions
    Replies: 1
    Last Post: 08-08-2011, 10:02 AM
  2. MySQL Search Date Field - Fails
    By MichaelCarroll in forum Application Server Version 10 - Web/Browser Applications
    Replies: 6
    Last Post: 02-04-2011, 10:20 PM
  3. Checkbox's with MySQL Data
    By Andy in forum Application Server Version 10 - Web/Browser Applications
    Replies: 2
    Last Post: 07-13-2010, 04:18 PM
  4. Do Not fetch data from MySql
    By dkolbach in forum Web Application Server v7
    Replies: 5
    Last Post: 07-11-2008, 05:58 PM
  5. Data-2-the-Web for MySQL
    By rudy birchler in forum Alpha Five Version 8
    Replies: 1
    Last Post: 03-03-2007, 10:52 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •