views:

28

answers:

1

I need to use IBM Informix for my project where I have point coordinates and I need to find which points are present in query rectangular region.

Informix has spatial datablade module with ST_POINT and ST_POLYGON data objects. I know how to create, insert and create r-tree index on tables with such objects.

But problem is how to do a SELECT statement, something which list all the points in a particular rectangular region.

A: 

You've got the Spatial Datablade documentation at your fingertips? It is available in the IDS 11.50 Info Centre.

For example, the section in Chapter 1 discusses performing spatial queries:

Performing Spatial Queries

A common task in a GIS application is to retrieve the visible subset of spatial data for display in a window. The easiest way to do this is to define a polygon representing the boundary of the window and then use the SE_EnvelopesIntersect() function to find all spatial objects that overlap this window:

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));

Queries can also use spatial columns in the SQL WHERE clause to qualify the result set; the spatial column need not be in the result set at all. For example, the following SQL statement retrieves each sensitive area with its nearby hazardous waste site if the sensitive area is within five miles of a hazardous site. The ST_Buffer() function generates a circular polygon representing the five-mile radius around each hazardous location. The ST_Polygon geometry returned by the ST_Buffer() function becomes the argument of the ST_Overlaps() function, which returns t (TRUE) if the zone ST_Polygon of the sensitive_areas table overlaps the ST_Polygon generated by the ST_Buffer() function:

SELECT sa.name sensitive_area, hs.name hazardous_site
   FROM sensitive_areas sa, hazardous_sites hs
   WHERE ST_Overlaps(sa.zone, ST_Buffer(hs.location, 26400));


sensitive_area  Summerhill Elementary School
hazardous_site  Landmark Industrial

sensitive_area  Johnson County Hospital
hazardous_site  Landmark Industrial 
Jonathan Leffler
here "overlap" returns a region where as i need points that are covered by query regions. I went through this document and thereafter i am asking this question here.
changed
The function ST_Contains (http://publib.boulder.ibm.com/infocenter/idshelp/v115/index.jsp?topic=/com.ibm.spatial.doc/sii-funcs-59256.htm - and http://publib.boulder.ibm.com/infocenter/idshelp/v115/index.jsp?topic=/com.ibm.spatial.doc/relation1033284.htm) takes two geometries and returns true if the second is completely contained within the first. One valid geometry is a point; another is a polygon. So, the function ST_Contains() can do the job you are after.
Jonathan Leffler