-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#1945 Make FeatureGrid attributes visibility selector counted when user exports grid data #7845
#1945 Make FeatureGrid attributes visibility selector counted when user exports grid data #7845
Conversation
- Keep geometry in exported file when custom propertyName value is passed to the request.
15d00e5
to
14e9bd4
Compare
…m attributes list is passed to the action. New observables to use for custom attributes list.
Right now this feature is blocked by the limitation on GeoServer side. There are two WPS processes that can be used to achieve desired workflow when resulting layer data is filtered in a way that part of the attributes are removed from the output: "gs:Query" and "vec:Query". Both of them doing same things but first one is marked as deprecated. "vec:Query" has following description: "Queries a feature collection using an optional filter and an optional list of attributes to include. Can also be used to convert feature collection format." The issue is that it doesn't accept list of attributes in any possible format.
|
@taba90 Can we have some assistance from you on this? |
@tdipisa i think @offtherailz is a more suitable person to review this |
@MV88 this is in blocked for now, but ok. |
I did a few attempts and I guessed that the correct format for multi-attributes is this: <?xml version="1.0" encoding="UTF-8"?><wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>vec:Query</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>features</ows:Identifier>
<wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wfs" method="POST">
<wps:Body>
<wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2" xmlns:gs="https://gs-stable.geo-solutions.it/geoserver/geoserver">
<wfs:Query typeName="gs:us_states"/>
</wfs:GetFeature>
</wps:Body>
</wps:Reference>
</wps:Input>
<wps:Input>
<ows:Identifier>attribute</ows:Identifier>
<wps:Data>
<wps:LiteralData>STATE_NAME</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>attribute</ows:Identifier>
<wps:Data>
<wps:LiteralData>STATE_FIPS</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>attribute</ows:Identifier>
<wps:Data>
<wps:LiteralData>WATER_KM</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>attribute</ows:Identifier>
<wps:Data>
<wps:LiteralData>the_geom</wps:LiteralData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:RawDataOutput mimeType="text/xml; subtype=wfs-collection/1.0">
<ows:Identifier>result</ows:Identifier>
</wps:RawDataOutput>
</wps:ResponseForm>
</wps:Execute> In this case I receive (with default format).
This is the CURL you can use for test: curl --location --request POST 'http://gs-stable.geo-solutions.it/geoserver/wfs' \
--header 'Content-Type: application/xml' \
--data-raw '<?xml version="1.0" encoding="UTF-8"?><wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wcs="http://www.opengis.net/wcs/1.1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd">
<ows:Identifier>vec:Query</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier>features</ows:Identifier>
<wps:Reference mimeType="text/xml" xlink:href="http://geoserver/wfs" method="POST">
<wps:Body>
<wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML2" xmlns:gs="https://gs-stable.geo-solutions.it/geoserver/geoserver">
<wfs:Query typeName="gs:us_states"/>
</wfs:GetFeature>
</wps:Body>
</wps:Reference>
</wps:Input>
<wps:Input>
<ows:Identifier>attribute</ows:Identifier>
<wps:Data>
<wps:LiteralData>STATE_NAME</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>attribute</ows:Identifier>
<wps:Data>
<wps:LiteralData>STATE_FIPS</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>attribute</ows:Identifier>
<wps:Data>
<wps:LiteralData>WATER_KM</wps:LiteralData>
</wps:Data>
</wps:Input>
<wps:Input>
<ows:Identifier>attribute</ows:Identifier>
<wps:Data>
<wps:LiteralData>the_geom</wps:LiteralData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:RawDataOutput mimeType="text/xml; subtype=wfs-collection/1.0">
<ows:Identifier>result</ows:Identifier>
</wps:RawDataOutput>
</wps:ResponseForm>
</wps:Execute>' The result you said @alexander-fedorenko is probably the result of my first attempt, passing attributes this way <wps:Data>
<wps:LiteralData>STATE_NAME</wps:LiteralData>
<wps:LiteralData>STATE_FIPS</wps:LiteralData>
</wps:Data>
</wps:Input> In this case I was receiving only Correct me if I'm wrong. It doesn't seems to be possible to create this request in demo -> WPS request builder, I'm guessing this is a limitation or a bug of the current builder. Maybe @aaime knows more about it. Not sure. Anyway generating the request like this should work. |
I should put this PR in draft, because it is not ready to be delivered, as far as I understood (and because it is blocked) |
…ncluded into attributes list.
Thank you very much .
Il giorno ven 25 feb 2022 alle ore 17:04 Alexander ***@***.***>
ha scritto:
… @offtherailz <https://github.com/offtherailz> Thanks for reviewing.
You're right, your request (as well as mine in the last sample of the code)
is correct. The problem was that I didn't notice initially that gs:Download
method transform geometry attribute name to "coordinates" somewhere
internally when geojson format is selected. I was using
"extractGeometryAttributeName" method to include geometry attribute into
output, which caused a problem because such attribute was not available in
the data that is feed to the vec:Query process.
I will do minor changes and then it can be tested.
—
Reply to this email directly, view it on GitHub
<#7845 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJYMFRYMDFM3WJ363O3POLU46SB3ANCNFSM5NYQAKTQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@offtherailz Thanks for reviewing. |
I tested it and I think that we should do it better. Download process has been created to manage big sets of data. With this solution I think you are downloading the data, then resending them to the service. This is not optimal and for big data sets can be problematic. Anyway I think there is a way to optimize |
Switched vec:Query process to use process reference as an input instead of the WMS collection. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check a few comments
testing this locally with no wps (direct download it works)
* @param {object} customAttributesSettings object containing information about deactivated attributes, see getCustomAttributesSettings | ||
* @returns undefined|array | ||
*/ | ||
export const getAttributesList = (attributes, customAttributesSettings) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can this be unit tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test with different scenarios.
Added unit test for "getAttributesList" function
Please skip this problem with readthedocs, I just don't want to merge master back to this branch cause I'm not sure it won't mess up with the changelog of PR. This issue was fixed on master afaik by you @MV88 |
@ElenaGallo please test DEV |
@alexander-fedorenko sometime it is not possible to download data, in any format and it always happens if I select the attributes I want to export. See the gif attached: download.movdownload2.mov |
@alexander-fedorenko @ElenaGallo we are too close to the release, therefore I'm going move to the next one (2022.01.02). |
@ElenaGallo I tried to reproduce problems you had, unfortunately I was not able to do so. As per the screencasts you've shared it really looks like there was some problem with GeoServer running process on any step during file generation. It didn't return meaningful error message in your case, so the only way to trace the error is to reproduce error one more time and check GeoServer logs, or catch a period when problem appears and debug it locally with configured proxy to the dev instance of GeoServer. |
Hi @alexander-fedorenko, this issue has been fixed here so I move this pr to test. |
@ElenaGallo let us know if we can backport to 2022.01.xx. |
Test passed, @alexander-fedorenko please backport to 2022.01.xx. Thanks |
…counted when user exports grid data (geosolutions-it#7845) * geosolutions-it#1945 FeatureGrid layer data export will exclude hidden attributes. * Added tooltips in few places * - Keep attributes list undefined if no attribute is excluded. - Keep geometry in exported file when custom propertyName value is passed to the request. * Update for WPS export: using custom flow if layer is vector and custom attributes list is passed to the action. New observables to use for custom attributes list. * Minor changes required to make geometry properly exported when it's included into attributes list. * Using process reference to get results of gs:Download as an input for vec:Query * Minor corrections: selector name, variable name Added unit test for "getAttributesList" function (cherry picked from commit f62a9f3)
…er exports grid data (#7845) (#8232) * #1945 FeatureGrid layer data export will exclude hidden attributes. * Added tooltips in few places * - Keep attributes list undefined if no attribute is excluded. - Keep geometry in exported file when custom propertyName value is passed to the request. * Update for WPS export: using custom flow if layer is vector and custom attributes list is passed to the action. New observables to use for custom attributes list. * Minor changes required to make geometry properly exported when it's included into attributes list. * Using process reference to get results of gs:Download as an input for vec:Query * Minor corrections: selector name, variable name Added unit test for "getAttributesList" function (cherry picked from commit f62a9f3)
Description
This PR suggests changes needed to make FeatureGrid attributes visibility selector counted when user exports grid data.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x", remove the others)
Issue
What is the current behavior?
#1945
What is the new behavior?
WFS export will properly use list of hidden attributes to load data only for visible columns.
Breaking change
Does this PR introduce a breaking change? (check one with "x", remove the other)
Other useful information