We do not treat the historic data as a separate feature from the current data.
There is only one instance of the top-level feature, no matter how much history
it has. All its history is _internal_ to the one and only instance of the
feature. What we want is for the user to be able to choose an abridged version
of the feature, or an unabridged version of the feature, in response to exactly
the same filter.
Let's say we have buildings as a feature, and buildings are of various types -
offices, flats, stores, warehouses, etc. Part of the data for a feature is its
valuation for tax purposes. Below is a building built in 2017, in unabridged
form showing all tax assessment history attached to the building:
123 Main St
Mytown
Office
2017
9
2018-01-01
2018
92000
2019-01-01
2019
96000
2020-01-01
2020
99000
Sometimes I really do want the above unabridged form for every
BuildingType=Office in my database. The filter below will do it:
BuildingType
Office
Other times, however, I am not interested in the history. All I want is the
abridged form below, representing just the current year for every Office:
123 Main St
Mytown
Office
2020
99000
How can I get GeoServer to give me my choice of the two results? I have even
added your DateArchived. What filter would give me the second, abridged format
for all my office buildings?
What you are suggesting would work if our output looked like this:
123 Main St
Mytown
Office
2017
9
123 Main St
Mytown
Office
2018
92000
123 Main St
Mytown
Office
2019
96000
123 Main St
Mytown
Office
2020
99000
Then I could filter on both the building type and the tax year, and get the
combination of Office and tax year 2020. Unfortunately, that is not the schema
definition we are using.
From: Humphries, Graham
Sent: Thursday, May 14, 2020 19:54
To: Stein, Michael P [US] (TS)
Cc: geoserver-users@lists.sourceforge.net
Subject: EXT :RE: How to map the same feature from alternate data sources in WFS
Probably should keep the discussion on the list. Other people might have a
better understanding of your problem than me.
The way we handle our historic data is by having a date_archived field in the
table. If the data is current the date_archived value is null. When this record
is suprceded the date_archived is populated with the date when this occurs.
This makes filtering historic and current data simple ie: date_archived is null
or date_archived is not null.
From: Stein, Michael P [US] (TS) [mailto:mike.st...@ngc.com]
Sent: Friday, 15 May 2020 12:42 AM
To: Humphries, Graham
mailto:graham.humphr...@stategrowth.tas.gov.au>>
Subject: RE: How to map the same feature from alternate data sources in WFS
(I am responding to you directly, not the list.)
I am not entirely sure where you are suggesting this filtering be established.
We could certainly post-process the existing output to remove all but the
current detail record, but that would be a significant performance hit. We want
the filtering to be done in the initial SQL query for maximum performance.
We could also stand up a separate instance of GeoServer with the alternative
mappings, but the customer is not going to be happy with the idea of buying
additional system capacity to support that solution.
If you are suggesting adding the filter to the request, there are two problems
with this. One problem is that we do not want to burden the end user with the
task of creating a complex filter that they must remember to edit every time
they run it to put in a new value corresponding to "today". The stickier
problem is that a filter is a filter on the feature as a whole, not on
sub-elements of the feature. Any feature that has one detail item that matches
the filter on detail items will bring back all the detail. Using my example
feature, if I were to filter for color red in the request as follows:
myns:FeatureDetails/myns:FeatureDetail/myns:color
red
it is interpreted as "return any feature having at least one detail with the
color red". The feature as a whole is considered a match and the feature as a
whole comes back in the response, including the green detail.
If you are suggesting something other than the above, please explain in more
d