Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1643,10 +1643,7 @@ private void generateWMTSClientLinks(MapMLLayerMetadata mapMLLayerMetadata) {
params.put("tilematrix", "{z}");
params.put("TileCol", "{x}");
params.put("TileRow", "{y}");
// if it's a raster layer, use the image format even if features are requested
boolean isRasterLayer = mapMLLayerMetadata.getLayerInfo() != null
&& mapMLLayerMetadata.getLayerInfo().getResource() instanceof CoverageInfo;
if (mapMLLayerMetadata.isUseFeatures() && !isRasterLayer) {
if (mapMLLayerMetadata.isUseFeatures()) {
params.put("format", MAPML_MIME_TYPE);
params.put(
"format_options",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@

public class MapMLFeatureUtil {
private static final Logger LOGGER = Logging.getLogger(MapMLFeatureUtil.class);
private static final double IS_TILE_TOL = 0.002D;
public static final String STYLE_CLASS_PREFIX = ".";
public static final String STYLE_CLASS_DELIMITER = " ";
public static final String BBOX_DISPLAY_NONE = ".bbox {display:none}";
Expand Down Expand Up @@ -324,7 +325,13 @@ public static Mapml layerContextsToMapMLDocument(
}
}
Collections.sort(tiles);
featuresOrTiles.addAll(tiles);
boolean isTile = (getMapRequest.getWidth() == getMapRequest.getHeight()
&& tiles.get(0).getDistance() < IS_TILE_TOL);
if (isTile) {
featuresOrTiles.add(tiles.get(0));
} else {
featuresOrTiles.addAll(tiles);
}
}
} catch (FactoryException | GeoWebCacheException | TransformException e) {
throw new ServiceException("Error while looking up MapML gridset", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
# for more info.
formats.vector = text/mapml
formats.layergroup = text/mapml
formats.raster = text/mapml
Original file line number Diff line number Diff line change
Expand Up @@ -403,12 +403,12 @@ public void testScenarioH2_RasterWithCache() throws Exception {
// For cached raster: should have GetTile URL
assertXpathExists("//html:map-link[@rel='tile']", doc);

// Verify that the tile link contains "GetTile"
String tileUrl = xpath.evaluate("//html:map-link[@rel='tile']/@tref", doc);
// Verify that the tile link contains "GetTile" and has type=text/mapml
String tileUrl = xpath.evaluate("//html:map-link[@rel='tile'][@type='text/mapml']/@tref", doc);
assertTrue("Tile URL should contain GetTile", tileUrl.contains("GetTile"));

// Verify that the tile link uses image format for rasters
assertTrue("Tile URL should use image format for rasters", tileUrl.contains("image/png"));
// Verify that the tile link uses text/mapml for rasters with mapmlusefeatures:true
assertTrue("Tile URL should use text/mapml for vector tiles", tileUrl.contains("text/mapml"));

} finally {
disableTileCaching(new QName(MockData.CITE_URI, "World"), getCatalog());
Expand Down
Loading