Skip to content

Commit

Permalink
[GEOS-9224] Add MapML preview link to the Layer Preview page
Browse files Browse the repository at this point in the history
Add MapMLController test case.

Suppress warnings due to unset application context during some tests,
by getting a reference to the application context in the test case.

Add en user doc for MapML preview layer functionality
  • Loading branch information
prushforth authored and jodygarnett committed Jun 12, 2019
1 parent b8425cb commit 3cfe2a6
Show file tree
Hide file tree
Showing 63 changed files with 20,815 additions and 118 deletions.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 12 additions & 6 deletions doc/en/user/source/community/mapml/index.rst
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -110,16 +110,22 @@ Each of the URL query string parameters are optional, but if provided they are e
MapML Visualization MapML Visualization
------------------- -------------------


The only tool which is presently able to display MapML is a Leaflet-based MapML client. This client can be imported into an HTML page with the appropriate ``<map>`` and ``<layer>`` elements to reference the MapML resources defined above. Here is a simple, self-contained example of such an HTML page: With the MapML Community Module installed, the GeoServer Layer Preview page is modified to add a link to the MapML resources for each layer and layer group. The MapML link in the Layer Preview table intercepted by the MapML module, and an HTML Web map page is created on the fly which refers to the MapML resource:

.. figure:: images/mapml_preview_ui.png

You can add layers to the map as you like, by dragging the link URL from the Layer Preview table and dropping it onto another layer's MapML preview. If all goes well, you should see the layers stacked on the map and in the layer control.

The only tool which is presently able to display MapML is a Leaflet-based MapML client. You can get your own copy of the client by using the npm "bower" package management tool. Once you have bower installed, you can install the web-map client in a directory of your choice, by running the "bower install web-map" command in that directory. This will create a "bower_components" directory in the directory in which you execute the command. This client can be imported into an HTML page with the appropriate ``<map>`` and ``<layer>`` elements to reference the MapML resources defined above. Here is a simple, self-contained example of such an HTML page:


.. code-block:: html .. code-block:: html


<html> <html>
<head> <head>
<title>MapML Test Map</title> <title>MapML Test Map</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<script src="http://geogratis.gc.ca/api/beta/mapml/client/bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> <script src="./bower_components/webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="http://geogratis.gc.ca/api/beta/mapml/client/bower_components/web-map/web-map.html"> <link rel="import" href="./bower_components/web-map/web-map.html">
<style> <style>
/* make the map fullscreen */ /* make the map fullscreen */
html, body { html, body {
Expand All @@ -138,10 +144,10 @@ The only tool which is presently able to display MapML is a Leaflet-based MapML
</style> </style>
</head> </head>
<body> <body>
<map is="web-map" projection="{projectionName}" zoom="2" lat="61.209125" lon="-90.850837" controls> <map is="web-map" projection="osmtile" zoom="2" lat="61.209125" lon="-90.850837" controls>
<layer- label="{layerName}" src="http://{serverName}/geoserver/mapml/{layerName}/{projectionName}?style={styleName}" checked hidden></layer-> <layer- label="US States" src="http://localhost:8080/geoserver/mapml/topp:states/osmtile?style=population" checked></layer->
</map> </map>
</body> </body>
</html> </html>


In the above example, the place-holders ``{layerName}``, ``{serverName}``, ``{projectionName}``, and ``{styleName}`` would need to be replaced with the appropriate values, and/or the ``style`` parameter could be removed entirely from the URL if not needed. In the above example, the place-holders ``topp:states``, ``localhost:8080``, ``osmtile``, and ``population`` would need to be replaced with the appropriate values, and/or the ``style`` parameter could be removed entirely from the URL if not needed. You may also like to "View Source" on the preview page to see what the markup looks like for any layer. This code can be copied and pasted without harm, and you should try it and see what works and what the limitations are. For further information about MapML, and the Maps for HTML Community Group, please visit http://maps4html.org.
61 changes: 59 additions & 2 deletions src/community/mapml/pom.xml
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


<groupId>org.geoserver.community</groupId> <groupId>org.geoserver.community</groupId>
<artifactId>gs-mapml</artifactId> <artifactId>gs-mapml</artifactId>
<name>MapML Support</name> <name>MapML Support for GeoServer</name>


<dependencies> <dependencies>
<dependency> <dependency>
Expand All @@ -28,6 +28,11 @@
<groupId>org.geoserver.web</groupId> <groupId>org.geoserver.web</groupId>
<artifactId>gs-web-core</artifactId> <artifactId>gs-web-core</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.geoserver.web</groupId>
<artifactId>gs-web-demo</artifactId>
<version>${gs.version}</version>
</dependency>
<dependency> <dependency>
<groupId>org.geoserver</groupId> <groupId>org.geoserver</groupId>
<artifactId>gs-wfs</artifactId> <artifactId>gs-wfs</artifactId>
Expand All @@ -36,6 +41,20 @@
<groupId>org.geoserver</groupId> <groupId>org.geoserver</groupId>
<artifactId>gs-wms</artifactId> <artifactId>gs-wms</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-referencing</artifactId>
</dependency>
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency> <dependency>
<groupId>org.eclipse.persistence</groupId> <groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.moxy</artifactId> <artifactId>org.eclipse.persistence.moxy</artifactId>
Expand All @@ -60,12 +79,50 @@
<artifactId>junit</artifactId> <artifactId>junit</artifactId>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>org.geoserver</groupId>
<artifactId>gs-wms</artifactId>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>xmlunit</groupId>
<artifactId>xmlunit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<groupId>com.mockrunner</groupId> <groupId>com.mockrunner</groupId>
<artifactId>mockrunner</artifactId> <artifactId>mockrunner</artifactId>
<version>0.3.6</version> <version>0.3.6</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<excludes>**/org/geoserver/mapml/xml/**/*</excludes>
</configuration>
</plugin>
</plugins>
</build>


</project> </project>
Original file line number Original file line Diff line number Diff line change
@@ -1,4 +1,4 @@
/* (c) 2014 - 2016 Open Source Geospatial Foundation - all rights reserved /* (c) 2019 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license, available at the root * This code is licensed under the GPL 2.0 license, available at the root
* application directory. * application directory.
*/ */
Expand Down
Original file line number Original file line Diff line number Diff line change
@@ -1,12 +1,13 @@
/* (c) 2016 Open Source Geospatial Foundation - all rights reserved /* (c) 2019 Open Source Geospatial Foundation - all rights reserved
* This code is licensed under the GPL 2.0 license, available at the root * This code is licensed under the GPL 2.0 license, available at the root
* application directory. * application directory.
*/ */


package org.geoserver.mapml; package org.geoserver.mapml;


import java.nio.charset.Charset; import java.nio.charset.Charset;
import java.text.SimpleDateFormat; import java.util.Arrays;
import java.util.List;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;


public final class MapMLConstants { public final class MapMLConstants {
Expand All @@ -21,6 +22,14 @@ public final class MapMLConstants {
/** format name */ /** format name */
public static final String FORMAT_NAME = "MAPML"; public static final String FORMAT_NAME = "MAPML";


public static final SimpleDateFormat DATE_FORMAT = public static final String DATE_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
public static final String REL_ZOOMIN = "zoomin";
public static final String REL_ZOOMOUT = "zoomout";
public static final String REL_NEXT = "next";
public static final String REL_LICENSE = "license";

public static final List<String> ZOOM_RELS = Arrays.asList(REL_ZOOMIN, REL_ZOOMOUT);

public static int PAGESIZE = 100;
} }

0 comments on commit 3cfe2a6

Please sign in to comment.