Skip to content
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

Supporting mapml-proxy cascading #374

Closed
wants to merge 4 commits into from

Conversation

dromagnoli
Copy link
Member

@dromagnoli dromagnoli commented Aug 23, 2024

PR supporting MapML proxy.

Checklist

For core and extension modules:

  • New unit tests have been added covering the changes.
  • Documentation has been updated (if change is visible to end users).
  • The REST API docs have been updated (when changing configuration objects or the REST controllers).
  • There is an issue in the GeoServer Jira (except for changes that do not affect administrators or end users in any way).
  • Commit message(s) must be in the form [GEOS-XYZWV] Title of the Jira ticket.
  • Bug fixes and small new features are presented as a single commit.
  • Each commit has a single objective (if there are multiple commits, each has a separate JIRA ticket describing its goal).

@dromagnoli dromagnoli requested a review from aaime August 23, 2024 14:12
@prushforth
Copy link
Collaborator

I have successfully used this branch with the CFS CWFIS WMS (GeoServer!), and I found it works well in Remote request mode, except the remote GetFeatureInfo request balks at including of a blank cql_filter paramter:

e.g. the following template
https://cwfis.cfs.nrcan.gc.ca/geoserver/wms?request=GetFeatureInfo&query_layers=fdr_current&crs=EPSG:3978&bbox={xmin},{ymin},{xmax},{ymax}&language=en&cql_filter=&version=1.3.0&transparent=true&service=WMS&layers=fdr_current&width={w}&x={i}&feature_count=50&y={j}&styles=&info_format=text/html&height={h}

when filled out gives rise to an example query such as:

https://cwfis.cfs.nrcan.gc.ca/geoserver/wms?request=GetFeatureInfo&query_layers=fdr_current&crs=EPSG:3978&bbox=-1150222.572178498,-634225.7217853889,863260.6214545518,1688820.5909739062&language=en&cql_filter=&version=1.3.0&transparent=true&service=WMS&layers=fdr_current&width=761&x=381&feature_count=50&y=439&styles=&info_format=text/html&height=878

I find that if I edit the above URL and remove the cql_filter parameter entirely, it works ok:

https://cwfis.cfs.nrcan.gc.ca/geoserver/wms?request=GetFeatureInfo&query_layers=fdr_current&crs=EPSG:3978&bbox=-1150222.572178498,-634225.7217853889,863260.6214545518,1688820.5909739062&language=en&version=1.3.0&transparent=true&service=WMS&layers=fdr_current&width=761&x=381&feature_count=50&y=439&styles=&info_format=text/html&height=878

Maybe this is actually a bug in GeoServer cql_filter handling? Anyway, I will see if there are other cases I come across.

@dromagnoli dromagnoli marked this pull request as ready for review August 27, 2024 11:04
@dromagnoli
Copy link
Member Author

PR updated with WMTS tests and getFeatureInfo with empty cql_filter being properly handled.

@dromagnoli dromagnoli force-pushed the mapml-cascading branch 2 times, most recently from 667ac05 to 043a482 Compare August 27, 2024 13:37
@prushforth
Copy link
Collaborator

prushforth commented Sep 5, 2024

Just returning to playing with this, and maybe it's something odd about the remote WMS, but I can't get it to proxy correctly, it always seems to truncate the "_en" from the remote URL. The remote WMS capabilities is here

The remote layer name to proxy is "WMS-Toporama", which is like a layer group afaict on the remote wms.
image

The client proxy always comes back with a 404, because it uses an incorrect URL in the tref attribute of the <map-link>:
image

Edit: Something similar seems to happen with this WMS - i.e. the base URL gets truncated and substituted with wms inadvertently.

@prushforth
Copy link
Collaborator

prushforth commented Sep 23, 2024

Ideally, creation (at all) of the <map-link rel="query"> would be conditional on if the remote layer is queryable.

IIRC GeoServer itself can cascade remote queries if the remote WMS supports some flavour of GML. Maybe we could change that when the Remote proxy option for MapML is selected, to text/mapml, text/html or text/plain availability? If none is available we would not create a <map-link rel="query" at all, as though the remote layer was not queryable in the first place.

@dromagnoli
Copy link
Member Author

Ideally, creation (at all) of the would be conditional on if the remote layer is queryable.

IIRC GeoServer itself can cascade remote queries if the remote WMS supports some flavour of GML. Maybe we could change that when the Remote proxy option for MapML is selected, to text/mapml, text/html or text/plain availability? If none is available we would not create a <map-link rel="query" at all, as though the remote layer was not queryable in the first place.

I have updated the code so that it won't generate the query link if the remote server has none of these format supported.
I have also added a test.

@prushforth
Copy link
Collaborator

prushforth commented Sep 30, 2024

I get this message:

<ServiceExceptionReport xmlns="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.3.0" xsi:schemaLocation="http://www.opengis.net/ogc http://localhost:8080/geoserver/schemas/wms/1.3.0/exceptions_1_3_0.xsd">
<ServiceException> java.lang.NullPointerException: Cannot invoke "org.geotools.data.ows.OperationType.getFormats()" because "getFeatureInfo" is null Cannot invoke "org.geotools.data.ows.OperationType.getFormats()" because "getFeatureInfo" is null </ServiceException>
</ServiceExceptionReport>

when using the pdi (Layer 0) from this WMS https://agriculture.canada.ca/atlas/services/app_agclimate_agclimat/agclimate_pdi/ImageServer/WMSServer/?request=GetCapabilities&service=WMS

Edit: note I am reprojecting the remote wms from what it advertises to MapML:OSMTILE / EPSG:3857. That may be the issue, will verify.

Update: sure enough, when I use the native advertised CRS 84 and map it to MapML:WGS84, layer works / does not send that exception

@prushforth
Copy link
Collaborator

prushforth commented Sep 30, 2024

Works well for MapML:CBMTILE with this WMS however. Probably due to the quality of the remote WMS, https://cwfis.cfs.nrcan.gc.ca/geoserver/public/wms?service=WMS&version=1.3.0&request=GetCapabilities

@dromagnoli
Copy link
Member Author

Fixed the NPE on missing GetFeatureInfo from remote capabilities document

@prushforth
Copy link
Collaborator

Fixed the NPE on missing GetFeatureInfo from remote capabilities document

confirmed, thank you.

@dromagnoli
Copy link
Member Author

Closing this in favor of the official PR:
geoserver#7930

@dromagnoli dromagnoli closed this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants