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-11353] MapML Make default image format for raster requests configurable for layers and layer groups #7612

Merged

Conversation

turingtestfail
Copy link
Contributor

@turingtestfail turingtestfail commented May 8, 2024

GEOS-11353 Powered by Pull Request Badge

-Added tests for dropdown values and tile cache version

getting from enabled tile cache

added ajax

added to layergroup panel

Added document builder read and write of default mime

layer group and unit test

cleanup

removed default call

made sure default representation goes to html

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

Copy link
Member

@aaime aaime left a comment

Choose a reason for hiding this comment

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

I've tested the layer case, the UI does not seem to be responsive:

  • I uncheck "use features", the mime type drop-down is still disabled
  • I go to the tile caching tab, add a format, it does not show in the drop-down either

In both cases, even pressing "apply" does not help, one has to exit the page and come back into it.

The changes seem to introduce a new format option to control the format: as I correct? Is it documented anywhere?

Comment on lines 565 to 568
defaultMimeType =
layerMeta.get(MapMLConstants.MAPML_MIME) != null
? layerMeta.get(MapMLConstants.MAPML_MIME).toString()
: defaultMimeType;
Copy link
Member

Choose a reason for hiding this comment

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

This block is duplicated here and below. It can be shared outside of the if, because layerMeta itself can be obtained calling PublishedInfo.getMetadata (that is, no need to know if it's a layer group or not).

Copy link
Member

Choose a reason for hiding this comment

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

Also no need to call onto that metadata entry twice, e.g.:

Suggested change
defaultMimeType =
layerMeta.get(MapMLConstants.MAPML_MIME) != null
? layerMeta.get(MapMLConstants.MAPML_MIME).toString()
: defaultMimeType;
defaultMimeType = Optional.ofNullable(layerMeta.get(MapMLConstants.MAPML_MIME)).orElse(defaultMimeType);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to Optional.ofNullable format but still needs to appear in both parts of if because metadata is stored in resourceInfo in the case of LayerInfo and in the main metadata in the case of LayerGroupInfo.

@@ -1,65 +1,98 @@
<html xmlns:wicket="http://wicket.apache.org/">
<head></head>
<body>
<form name="theForm">
Copy link
Member

Choose a reason for hiding this comment

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

Mass reformat here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

Comment on lines +98 to +101
boolean useTilesFromModel =
Boolean.TRUE.equals(
model.getObject().getMetadata().get(MAPML_USE_TILES, Boolean.class));
mime =
Copy link
Member

Choose a reason for hiding this comment

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

What happes if use tiles gets flipped? This "boolean" here does not look like it would update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ajax update added.

Comment on lines 58 to 64
// GridSetBroker gridSetBroker =
// new GridSetBroker(Collections.singletonList(new DefaultGridsets(true, true)));
// tileLayer = new
// GeoServerTileLayer(getCatalog().getLayerByName(MockData.PONDS.getLocalPart()),
// gridSetBroker, tileLayerInfo);
// GridSet testGridSet = namedGridsetCopy("TEST",
// gridSetBroker.getDefaults().worldEpsg4326());
Copy link
Member

Choose a reason for hiding this comment

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

Avoid commented out code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Comment on lines +255 to +245
assertThat(
dropDownChoiceTile.getChoices(),
Matchers.containsInAnyOrder("image/jpeg", "image/png"));
Copy link
Member

Choose a reason for hiding this comment

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

While I don't expect the mapml client to handle tiff related format, it's browser based, should be able to handle all the png/jpeg variations, including the "jpeg or png" one. Give it a try?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tested and confirmed that tiff is not supported. Removed from regex.

"image/vnd.jpeg-png",
"image/jpeg",
"image/vnd.jpeg-png8",
"image/tiff8",
Copy link
Member

Choose a reason for hiding this comment

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

tiff is normally not handled properly by clients... what about the MapML one, can it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See above, not handled. Removed

@turingtestfail turingtestfail force-pushed the GEOS-11353-MapML-default-image-format branch from 5649c70 to d32890f Compare May 20, 2024 22:52
…igurable for layers and layer groups

-Added tests for dropdown values and tile cache version

getting from enabled tile cache

added ajax

added to layergroup panel

Added document builder read and write of default mime

layer group and unit test

cleanup

removed default call

made sure default representation goes to html

pr changes

formatting
@turingtestfail turingtestfail force-pushed the GEOS-11353-MapML-default-image-format branch from d32890f to ef4e44b Compare May 21, 2024 01:10
@turingtestfail
Copy link
Contributor Author

UI is fixed - use features now uses Ajax for disabling dropdown. Tile caching format, once apply is clicked is added to list. The dropdown is documented in index.rst.

I've tested the layer case, the UI does not seem to be responsive:

  • I uncheck "use features", the mime type drop-down is still disabled
  • I go to the tile caching tab, add a format, it does not show in the drop-down either

In both cases, even pressing "apply" does not help, one has to exit the page and come back into it.

The changes seem to introduce a new format option to control the format: as I correct? Is it documented anywher

turingtestfail and others added 4 commits May 21, 2024 10:03
switched to text

actually xpath is better

community compile issue
…igurable for layers and layer groups

-Added tests for dropdown values and tile cache version

getting from enabled tile cache

added ajax

added to layergroup panel

Added document builder read and write of default mime

layer group and unit test

cleanup

removed default call

made sure default representation goes to html

pr changes

formatting
@aaime aaime merged commit 36aadf1 into geoserver:main May 31, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants