forked from geoserver/geoserver
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Preserving MapML CRS in layer group links too
- Loading branch information
Showing
2 changed files
with
58 additions
and
4 deletions.
There are no files selected for viewing
40 changes: 40 additions & 0 deletions
40
src/extension/mapml/src/test/java/org/geoserver/web/demo/PreviewLayerTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* (c) 2024 Open Source Geospatial Foundation - all rights reserved | ||
* This code is licensed under the GPL 2.0 license, available at the root | ||
* application directory. | ||
*/ | ||
package org.geoserver.web.demo; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.geoserver.catalog.Catalog; | ||
import org.geoserver.catalog.LayerGroupInfo; | ||
import org.geoserver.data.test.MockData; | ||
import org.geoserver.web.GeoServerWicketTestSupport; | ||
import org.geotools.geometry.jts.ReferencedEnvelope; | ||
import org.geotools.referencing.CRS; | ||
import org.junit.Test; | ||
|
||
public class PreviewLayerTest extends GeoServerWicketTestSupport { | ||
|
||
/** | ||
* Check MapML srs is preserved for layer groups | ||
* | ||
* @throws Exception | ||
*/ | ||
@Test | ||
public void testMapmlFormatLink() throws Exception { | ||
Catalog cat = getCatalog(); | ||
|
||
LayerGroupInfo lg = cat.getFactory().createLayerGroup(); | ||
lg.setName("foo"); | ||
lg.setWorkspace(cat.getWorkspaceByName("sf")); | ||
lg.getLayers().add(cat.getLayerByName(getLayerId(MockData.PRIMITIVEGEOFEATURE))); | ||
lg.setBounds(new ReferencedEnvelope(0, 1, 0, 1, CRS.decode("MapML:OSMTILE"))); | ||
PreviewLayer layer = new PreviewLayer(lg); | ||
layer.getWmsLink( | ||
(r, p) -> { | ||
assertEquals("MapML:OSMTILE", p.get("srs")); | ||
assertEquals("0.0,0.0,1.0,1.0", p.get("bbox")); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters