# HG changeset patch # User Ingo Weinzierl # Date 1271747945 0 # Node ID 47578d91c4f0016c8be62e0ce6d59259c2da2e73 # Parent ac5988f27714fe14e7071def79fa273a69b660e6 Added a metadata section into the mapfile and feed it with the MapServer URL (issue235). gnv-artifacts/trunk@952 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r ac5988f27714 -r 47578d91c4f0 gnv-artifacts/ChangeLog --- a/gnv-artifacts/ChangeLog Mon Apr 19 14:19:19 2010 +0000 +++ b/gnv-artifacts/ChangeLog Tue Apr 20 07:19:05 2010 +0000 @@ -1,3 +1,15 @@ +2010-04-20 Ingo Weinzierl + + Issue235 + + * doc/conf/maptemplates/mapfile.vm: Added a metadata section into the + mapfile template. + + * src/main/java/de/intevation/gnv/utils/MapfileGenerator.java: Read the URL + of the MapServer from configuration and feed the template with this + information. The URL is used in the metadata section for filling the 'wms + onlineresource' field. + 2010-04-19 Ingo Weinzierl Issue152 diff -r ac5988f27714 -r 47578d91c4f0 gnv-artifacts/doc/conf/maptemplates/mapfile.vm --- a/gnv-artifacts/doc/conf/maptemplates/mapfile.vm Mon Apr 19 14:19:19 2010 +0000 +++ b/gnv-artifacts/doc/conf/maptemplates/mapfile.vm Tue Apr 20 07:19:05 2010 +0000 @@ -11,6 +11,27 @@ "init=epsg:4326" END + WEB + METADATA + "wms_title" "GNV Web Map Service" + "wms_onlineresource" "$MAPSERVERURL" + "wms_accessconstraints" "none" + "wms_fees" "none" + "wms_addresstype" "postal" + "wms_address" "Any Street" + "wms_city" "Any City" + "wms_stateorprovince" "Any state" + "wms_postcode" "My Postalcode" + "wms_country" "Any Country" + "wms_contactperson" "Any Person" + "wms_contactorganization" "Any Orga" + "wms_contactelectronicmailaddress" "any-email@example.com" + "wms_contactvoicetelephone" "Any's telephone number" + "wms_srs" "EPSG:4326 EPSG:32631 EPSG:32632 EPSG:32633" + "wms_feature_info_mime_type" "text/html" + END + END + ## Don't change the following lines. $LAYERS diff -r ac5988f27714 -r 47578d91c4f0 gnv-artifacts/src/main/java/de/intevation/gnv/utils/MapfileGenerator.java --- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/MapfileGenerator.java Mon Apr 19 14:19:19 2010 +0000 +++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/MapfileGenerator.java Tue Apr 20 07:19:05 2010 +0000 @@ -73,6 +73,12 @@ "/artifact-database/velocity/logfile/@path"; /** + * The URL for calling the mapserver + */ + public static final String MAPSERVER_URL = + "/artifact-database/mapserver/server/@path"; + + /** * The name of the file storing meta information coresponding to shapefiles. */ public static final String META_FILE_NAME = "meta.xml"; @@ -96,6 +102,7 @@ private static MapfileGenerator instance; private File mapfile; + private String mapServerUrl; private String shapefileDirectory; private String templatePath; private String velocityLogfile; @@ -279,6 +286,21 @@ /** + * Returns the URL for calling the MapServer. + * + * @return the url for calling the MapServer. + */ + protected String getMapServerUrl() { + if (mapServerUrl == null) { + mapServerUrl = Config.getStringXPath(MAPSERVER_URL); + mapServerUrl = Config.replaceConfigDir(mapServerUrl); + } + + return mapServerUrl; + } + + + /** * Returns a template specified by model. * * @param model The name of the template. @@ -519,6 +541,7 @@ writer = new FileWriter(tmp); VelocityContext context = new VelocityContext(); + context.put("MAPSERVERURL", getMapServerUrl()); context.put("LAYERS", sb.toString()); Template mapTemplate = getMapfileTemplate();