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

GEOS-11461: Support MapML embedded viewer on HTML for WFS GetFeature #369

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

dromagnoli
Copy link
Member

GEOS-11461

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).

Notes:

The exisiting MapML HTML Embedded Viewer for WMS will thrown an invalid SRS exception if the requested SRS is not one of the 4 supported by MapML. The same logic has been applied when building the MapML HTML Embedded viewer for WFS.

WFS 1.0.0 requires a simple format name to be reported in the capabilities document (i.e. MAPML-HTML). This will reported in 1.1.0 and 2.0.0 too, together with the text/html; subtype=mapml

} else if (rawKvp.containsKey("SRS")) {
srs = (String) rawKvp.get("SRS");
} else {
srs = "EPSG:4326";
Copy link
Member Author

@dromagnoli dromagnoli Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we default to OSMTILE?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gather that because OSMTILE does not include the poles, that Andrea prefers to use WGS84. I can live with that. On the other hand, "OSMTILE" is the default map projection used by the <mapml-viewer> if you don't specify the projection attribute. That shouldn't impact GeoServer though, since as Andrea points out the OSMTILE can't cover all earthly data.
WGS84 could be the default here.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual live mapml should be served as text/mapml. The preview application is (now, in WMS) served as text/html; subtype=mapml.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we default to OSMTILE?

I should be more clear: I think we should default to WGS84 to be consistent with how it's done on the WMS side.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct, we are defaulting to WGS84 indeed.

@@ -31,6 +33,9 @@ public final class MapMLConstants {
/** format name */
public static final String FORMAT_NAME = "MAPML";

/** format name needed to have a parseable format in WFS 1.0.0 capabilities */
public static final String HTML_FORMAT_NAME = "MAPML-HTML";

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WFS 1.0.0 requires a simple format name to be reported in the capabilities document.
This will reported in 1.1.0 and 2.0.0 too, together with the text/html; subtype=mapml

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about text/html; subtype=mapml? This was used in the WMS preview for example. The important thing is to serve content (when asked for mapml) as text/mapml

Copy link
Member Author

@dromagnoli dromagnoli Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. We are indeed using "text/html; subtype=mapml" to serve WFS as HTML (doing the same thing that WMS does).
The problem is in WFS 1.0.0 that is not supporting that as element name for the capabilities due to this check.

https://github.com/geoserver/geoserver/blob/main/src/wfs/src/main/java/org/geoserver/wfs/WFSGetFeatureOutputFormat.java#L125

So we ended up exposing it as MAPML-HTML as well as text/html; subtype=mapml (where the first one makes WFS 1.0.0 capabilities happy).
image

The WFS KML output format does a similar thing, using KML for WFS 1.0.0 (see above screenshot)
This will result in having variations of the same output listed in WFS 1.1.0 and 2.0.0.

Check the below 1.1.0 WFS capabilities document where KML output is listed with the 3 variations (marked in red) and MapML-HTML in 2 variations (marked in yellow)
image

Long story short:
When requesting WFS for MAPML, it will indeed serve content as text/mapml
When requesting WFS 1.0.0 for MAPML-HTML or text/html; subtype=mapml it will indeed serve the Mapml client as text/html; subtype=mapml.

Does it clarify?

Copy link
Collaborator

@prushforth prushforth Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does, thank you very much! So the MAPML value gets sent under the text/mapml Content-type: text/mapml. Curious why text/csv didn't get caught by that rule.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's just that the CSV rule is implemented but the MAPML rule not quite yet, perhaps.

Copy link
Member Author

@dromagnoli dromagnoli Jul 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does, thank you very much! So the MAPML value gets sent under the text/mapml Content-type: text/mapml. Curious why text/csv didn't get caught by that rule.

Actually it gets caught too.
WFS 1.0.0 only reports CSV whilst WFS 1.1.0 reports both csv and text/csv

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I understand now but in no case do we see text/mapml in the list.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed you don't, it's already the case in an un-modified GeoServer, e.g.:

https://gs-main.geosolutionsgroup.com/geoserver/ows?service=WFS&version=1.1.0&request=GetCapabilities

Map<String, Object> rawKvp = Dispatcher.REQUEST.get().getRawKvp();
String value = (String) rawKvp.get("SRSNAME");
if (value == null) value = (String) rawKvp.get("SRS");
throw new ServiceException(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here, we are using the same logic that is applied by WMS when producing the HTML. Only the 4 MapML supported CRSs will be accepted.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without having time to get into the code, I must point out that we currently can serve any WFS SRS into MapML, realizing that we can't view that content without a custom TCRS definition, but it still may be useful to serve it for completeness' sake. The technique I've used in the viewer is to disallow / throw on projection values that contain a : colon. So when serving a text/mapml document as EPSG:1234 for example, we could create a custom TCRS definition for EPSG1234 and serve that. If the projection is unknown i.e. no custom TCRS definition exists, the viewer reports a different problem. The purpose of this is to avoid having people think that EPSG:codes code be uses as TCRS names directly. i.e. you need the extra defintional stuff provided by a TCRS, it's not the same thing as an EPSG:code.

@dromagnoli dromagnoli force-pushed the GEOS-11461 branch 3 times, most recently from 52f9fed to c7c612d Compare July 10, 2024 10:38
@dromagnoli
Copy link
Member Author

Hi @prushforth , based on your feedbacks, I will create the official PR in GeoServer if no changes are required.
About the CoordinateReferenceSystems management and supported CRS, we will revisit that part once we will work on the other task related to supporting TCRS configurations.
Please, let us know.

@prushforth
Copy link
Collaborator

Please, let us know

I apologize I have been looking at Joseph's PR, I will just build this one before I give the thumb's up :-)

@prushforth
Copy link
Collaborator

prushforth commented Jul 11, 2024

About the CoordinateReferenceSystems management and supported CRS, we will revisit that part once we will work on the other task related to supporting TCRS configurations.

Sounds good. Apart from the defaulting to OSMTILE, I am quite happy with this!

edit: maybe I'm wrong about it defaulting to osmtile. Now I'm thinking it's working. I think the content negotiation based on links was fooling me.

@dromagnoli
Copy link
Member Author

About the CoordinateReferenceSystems management and supported CRS, we will revisit that part once we will work on the other task related to supporting TCRS configurations.

Sounds good. Apart from the defaulting to OSMTILE, I am quite happy with this!

Ok. Note that we weren't proposing to default to OSMTILE. That was a question since we were defaulting to WGS84.

@prushforth
Copy link
Collaborator

Sorry its confusion on my part due to getting up at 3:30 am this week

please proceed, lgtm

@aaime aaime merged commit 9c63512 into geosolutions-it:main Jul 15, 2024
11 checks passed
@aaime
Copy link
Member

aaime commented Jul 15, 2024

Dang, merged by mistake. Will clean up the history of the geosolutions fork.

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.

3 participants