2
votes

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.

1

1 Answers

1
votes

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