ibm informix spatial datablade select statement error

Posted by changed on Stack Overflow See other posts from Stack Overflow or by changed
Published on 2010-03-27T23:14:02Z Indexed on 2010/03/27 23:23 UTC
Read the original article Hit count: 375

Filed under:
|
|

Hi

I am using IBM informix spatial datablade module for some geo specific data. I am trying to find points in table xmlData lying in a specified region. But i am getting this error for select statement.

SELECT sa.pre, sa.post 
FROM xmlData sa 
WHERE ST_Contains( ST_PolyFromText('polygon((2 2,6 2,6 6,2 6,2 2))',6),sa.point)

    Query:
    select count(*) as mycnt fromText('polygon((2 2,6 2,6 6,2 6,2 2))',6),sa.point)
    Error: -201
    [Informix][Informix ODBC Driver][Informix]A syntax error has occurred. (SQLPrepare[-201] at /work/lwchan/workspace/OATPHPcompile/pdo_informix/pdo_informix/informix_driver.c:131) 

If any one can help me with this.

 CREATE TABLE xmlData (row_id integer NOT NULL,
     x   integer,
     y   integer,         
     tagname   varchar(40,1),    
     point ST_POINT
     );


    EXECUTE FUNCTION SE_CreateSRID(0, 0, 250000, 250000,
                                   "use the return value in next query last column");

    INSERT INTO geometry_columns
              (f_table_catalog, f_table_schema, f_table_name,
               f_geometry_column, geometry_type, srid)

       VALUES ("mydatabase",         -- database name
               "informix",           -- user name
               "xmlData",            -- table name
               "point",              -- spatial column name
                1,                   -- column type (1 = point)
                6);                  -- srid //use value returned by above query.

    INSERT INTO xmlData VALUES (
        1, 20,20, 'country',
        ST_PointFromText('point (20 20)',6)
    );

    INSERT INTO xmlData VALUES (
        1, 12,13, 'sunday',
        ST_PointFromText('point (12 13)',6)
    );

    INSERT INTO xmlData VALUES (
        1, 21,22, 'monday',
        ST_PointFromText('point (21 22)',6)
    );


SELECT sa.pre, sa.post 
FROM xmlData sa
WHERE ST_Contains(
      ST_PolyFromText('polygon((1 1,30 1,30 30,1 30,1 1))', 6),sa.point);

I am using following query as reference "ibm link".

SELECT name, type, zone FROM sensitive_areas
   WHERE SE_EnvelopesIntersect(zone,
      ST_PolyFromText('polygon((20000 20000,60000 20000,60000
60000,20000 60000,20000 20000))', 5));

© Stack Overflow or respective owner

Related posts about informix

Related posts about spatial-query