See the Release 3 Milestone Summary page.
|Description||Capability extensions to index and query datasets by geospatial metadata beyond geospatial points supported in R2|
|Deliverable||Data Access Service|
|Development Owner||M. Manning|
|Development Team||Data Processing|
- A user may select "overlaps" as the query operator. The result set are all resources where the resource's geospatial region intersects with the query bounding box.
- A user may select "within" as the query operator. The result set are all resources where the resource's entire geospatial region is wholly contained within the query bounding box.
- A user may select "contains" as the query operator. The result set are all resources where the query bounding box is wholly contained within the resource's geospatial region.
- A user may select "disjoint" as the query operator. The result set are all resources that contain a geospatial region that do not intersect with the query box.
Find data within bounding area that meets the additional condition of a variable (e.g., temperature) within a given range
|This use case is under consideration.|
- Resources can be identified using geospatial search with data conditions.
- A user can specify a range for a data variable and the results will include data products that intersect the range.
- Provide the UI with a count of the result-set from a query in near real-time.
- OOIION-1136 Inconsistent Search results using Advanced Search and Simple Text Search options
Any inconsistencies should be eliminated now that Postgres will handle all queries. The logic for a ‘simple search’ was different than that used in the ‘advanced search’, but both should be passed to Postgres now for consistent results (and limits, order, etc.)
- OOIION-1137 Advanced Search results do not allow scrolling through list
UI related, not service related.
- OOIION-1407 Maximum list size is 100 for Advanced Search results
- OOIION-1409 Advanced Search results page is not constructed properly
UI related, not service related.
- OOIION-1439 Advanced Search needs more documentation, prompts, and tool tips
- OOIION-1611 Advanced Search Temporal Search is not tailored by resource, and therefore gives unexpected results to the end user
This isn’t really a bug. The users all searched for data with timestamps before the ion-alpha system was preloaded. They shouldn’t have found anything with the dates in the comments. However, the question of “what field is searched using the temporal bounds inputs on UI” was still unclear. The additional Postgres field geom_temp now has time bounds which can be searched with Overlaps, Within, etc similar to above to find matching sets.
|Identify Geospatial search requirements||Analyze existing requirements and propose revisions for milestone work. Communicate with Marine IOs and other stakeholders to determine specific detailed features and analyze available documentation as needed. Work with the System Engineer on a requirements revision proposal.|
|Design Geospatial search behavior model||Develop detailed designs of this milestone's capabilities as needed for subsequent implementation and integration with the production system and other components. Identify core interfaces and dependencies to the system and to other compoents. Describe core interfaces provided. Get review from system architect and make design artifacts available in the CI architecture documentation.|
|Define enhanced geospatial indexes in database||Implement database indexes as designed and scoped using the integrated database technology. Develop tests to demonstrate the correct operation of the indexes.|
|Enhance discovery to use enhanced indexes||Implement the capability as designed and scoped. Develop unit and integration tests to demonstrate the correct operation of the code.|
|Enhance resource attributes for geospatial resources||Implement the capability as designed and scoped. Develop unit and integration tests to demonstrate the correct operation of the code.|
|Enhance business logic for geospatial resources||Implement the capability as designed and scoped. Develop unit and integration tests to demonstrate the correct operation of the code.|
|Integrate and test with production environment||Take all developed software capabilities of this milestone and integrate them with the remainder of the system. Demonstrate the correct function of the additions through successful automatic tests running against a fully launched system and by interactive demonstration on the test/alpha system.|
|Add Spatial Operator (view)|| (ion-ux) Add button group to Advanced Search "GEOSPATIAL BOUNDS" form: ('spatial_operator' options - overlap/intersects,within,contains,disjoint) [UI task]
|Add Spatial Operator (controller)||(ion-ux) Create spatial_operator key in service API to pass to discovery service|
| Add Spatial Operator (service)
||(coi-services) Add spatial_operator parameter to discovery service [_qmatcher_geo_loc]|
|User Defined Limits (view)|| (ion-ux) Add form dropdown for number of desired results to return from search (eg. 100,200,500) [UI task]
| User Defined Limits (controller)
|| (ion-ux) Handle 'limit' field in service API (limit currently set in code not user option)
|Return number of total results (view)|| (ion-ux) Display total number of search results available in DB. eg. showing 0-10 of 100 (14,567 available) [UI task]
| Return number of total results (service)
|| (coi-services) Return total results available in DB from discovery service (beyond specified limit)
|Search Offset (view)||(ion-ux) Add "next n button/link below search result navigation to get next set of results past limit. eg. showing 91-100 of 100 (click to retrieve next 101-200) [UI task]|
|Search Offset (controller)||(ion-ux) Create 'offset' key with value in service API to pass to discovery service|
|Search Offset (service)|| (coi-services) Process an offset parameter in discovery service to pass to Postgres OFFSET value (allows search to skip n records)
Analyze existing requirements and propose revisions for milestone work. Communicate with Marine IOs and other stakeholders to determine specific detailed features and analyze available documentation as needed. Work with the System Engineer on a requirements revision proposal.
Develop detailed designs of this milestone's capabilities as needed for subsequent implementation and integration with the production system and other components. Identify core interfaces and dependencies to the system and to other components. Describe core interfaces provided. Get review from system architect and make design artifacts available in the CI architecture documentation.
Implement database indexes as designed and scoped using the integrated database technology. Develop tests to demonstrate the correct operation of the indexes.
Consider OpenGEO Indexing Tutorial. For tables in PostGIS that will have geospatial support, consideration for how to index and creating indexes will need to be designed and implemented. This logic is probably best suited for wherever the CREATE TABLE logic is implemented. A simple scan of the resource fields to identify any fields that are geometries should suffice, and then add an index to the database.
- geom: the geospatial center point
- geom_loc: the area bounding box for the resource
- vertical_range: the vertical range for the resource - postgres numrange type
- temporal_range: the temporal range for the resource - postgres numrange type
So besides the point queries, we now also support intersect, overlap and containment queries against a resources bbox.
The geom colum is filled from the geospatial_point_center attribute, the geom_loc and vertical_range columns are filled based on the constraint_list and the north/south/east/west and depth min/max coordinate values.
See more details here: https://confluence.oceanobservatories.org/display/CIDev/Postgres+Datastore
Documented example queries here. Please feel free to add to this list:
Indexes are inherently used when available in PostgreSQL, without an index a brute-force or exhaustive search is used.
h7. The way to query geospatial via the discovery service is this code:
We will define a resource type hierarchy that supports geometries that are intended to be geospatially indexed.
A Resource that intends to have a field or subset of fields that are geospatially indexed will include a field that is of a geometric type:
h7. See here for the code that fills the geom* columns in the resource registry:
Please discuss any modifications here with MMEisinger.
The resource registry will need to be modified so when the tables are created and a field of type Geometry is created an appropriate PostGIS data type is selected and a proper index is created to geospatially index the resource.
We will refactor the existing discovery code to use PostGIS capabilities for search and navigation as well as geospatial search. We will expose GIS searching capabilities through discovery service.
- Contains http://postgis.refractions.net/documentation/manual-1.4/ST_Contains.html
- Disjoint http://postgis.refractions.net/documentation/manual-1.4/ST_Disjoint.html
- Intersects http://postgis.refractions.net/documentation/manual-1.4/ST_Intersects.html
Overlapswe're using Intersects which is what the user expects
- Within http://postgis.refractions.net/documentation/manual-1.4/ST_Within.html
Take all developed software capabilities of this milestone and integrate them with the remainder of the system. Demonstrate the correct function of the additions through successful automatic tests running against a fully launched system and by interactive demonstration on the test/alpha system.
- Define key oceanographic geospatial search scenarios
- Dataset Metadata Indexing
- CIAD DM OV Discovery Service
- CIAD DM OV Index Management Service
- R2Cx Searches and Catalogs
- Evaluate GeoPortal for Externalization of Catalog and Discovery repository
- M166 PostgreSQL data store
- PostGIS Features
- Introduction to PostGIS
includes postgis notes
After our migration efforts for milestone M166 PostgreSQL data store, we should be able to leverage the featureset of PostGIS to provide OOIN and clients with geospatial awareness for all system resoures that have a geospatial identity. Once PostGIS is installed and the PostgreSQL database has the GIS extension installed then extended resources to include GIS aware objects is simple.
The GIS objects supported by PostGIS are a superset of the "Simple Features" defined by the OpenGIS Consortium (OGC). As of version 0.9, PostGIS supports all the objects and functions specified in the OGC "Simple Features for SQL" specification.
PostGIS extends the standard with support for 3DZ,3DM and 4D coordinates.
The OpenGIS specification defines two standard ways of expressing spatial objects: the Well-Known Text (WKT) form and the Well-Known Binary (WKB) form. Both WKT and WKB include information about the type of the object and the coordinates which form the object.
Examples of the text representations (WKT) of the spatial objects of the features are as follows:
- POINT(0 0)
- LINESTRING(0 0,1 1,1 2)
- POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1, 2 1, 2 2, 1 2,1 1))
- MULTIPOINT(0 0,1 2)
- MULTILINESTRING((0 0,1 1,1 2),(2 3,3 2,5 4))
- MULTIPOLYGON(((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1)), ((-1 -1,-1 -2,-2 -2,-2 -1,-1 -1)))
- GEOMETRYCOLLECTION(POINT(2 3),LINESTRING(2 3,3 4))
The database provides the capability to query against spatial relationships. With standard geometrical relationships: contains, within, touches, etc.
Here is a quick SQL example of the geospatial capabilities:
PostGIS also supports parsers for standard industry shapefiles including KMZ, ESRI Shape files etc. This may play a role if we provide users with the capability of inputing system resources and defining shape boundaries for the resources.
These are the steps I took in order to install postgis on a near-fresh machine:
The prerequisites is that python2.7 is installed via brew
To verify that it was installed correctly:
Prototype using a single column in the resource table to contain the geodata (each row represents a single resource)
- define the types of geometries required to represent various resource types: point, rectangle
- if a resource noes not have a geo-location then simple leave as null
- queries should be a standard PostGIS select and efficient:
- find all instrument devices of model CTDSMP37 in this rectangle
- OGC externalization plans are next phase
- see how much of the standard we can support with the above simple model.
All, you can now try out the Postgres resource registry branch. It is ready to use for initial investigations and for call tracing. It works with the full demo of R2 alpha preload, UI and streaming except for discovery service/ES integration. No changes to coi-services required, other than change pyon and ion-definitions submodules, install postgresql and driver and add a bit of pyon.local.yml:
https://confluence.oceanobservatories.org/display/CIDev/Postgres+Datastore (see at bottom)
It's very easy to use and you can switch back and forth coi-services master and coi-services postgres_merge branch without issues. You don't even have to change pyon.local.yml
I've added this and other information to the "central" Postgres page on Confluence:
I just enhanced the Postgres datastore to set a geometry column (currently based on the geospatial_point_center value). This works nicely for the BETA preload:
Then I tried a bounding box query:
It seems to work. An arbitrary number of extensions are thinkable
If you want to add PostgreSQL to your supervisor config scripts so that it's managed as a daemon by supervisor:
- Issues working thru the several layers of discovery search. Brian feels he has a handle on it now.
- Need to focus on a full suite of integration tests that demonstrate various search types ( overlap, bounding box, etc) for multiple search types
- There are 3 weeks allocated to integration with the UI, this is the time that will test UI-created searches
- Must define which application level resources needed for search
- which need location attributes
- which would be found by searching for an associated resource and how would that work
- A device does not have location attributes but it is deployed to a site which does have location. Search for all devices in a bounding box.
- Temporal and geo search scenarios?