Solutions
for a Better World
Configuration
instructions for
mini-Atlas
Prepared for:
DNR
28 June 2006
Social Change Online
NSW,
Tel +61 (02) 9692 5100
Fax +61 (02) 9692 5192
ABN 440 75 603 306
ACN 075 603 306
© Social Change Online Pty Ltd. 2004
This document is the Intellectual Property of Social Change Online Pty Ltd. No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, nor made accessible in any information storage and retrieval system - without the express written permission of Social Change Online Pty Ltd.
Version History
|
Version |
When |
Whom |
Note |
|
1.0 |
|
Trem Stamp |
Draft created |
|
1.1 |
|
Jonathan Doig |
Updated following changes to remove linkURL, and make existing contexts reusable (gazetteers and locators). |
|
1.2 |
|
Jonathan Doig |
Documented new applicationTitle parameter. |
|
1.3 |
|
Jonathan Doig |
Renamed from embedded NRAtlas to miniAtlas, as this better reflects the purpose and function, and is easier to say. |
Contents
2.2 Map views, locator and extents
4.1 Example request with
openApp name and values for Soils
4.2 Example request with
openApp name and values for HITS
This documentation describes the openApps parameters required to change the content of a reusable instance of a WMC layout. The url used to initiate the application enables the layout to display different maps, text and tools.
The url used to open the application can contain parameter name and value pairs which will determine the look of certain features of the layout. Some of these parameters are core features of WMC and have been used in previous applications (ie. NRAtlas), whereas others are new features.
The title of the application window can be
set by specifying an applicationTitle parameter in the calling URL.
Eg. & applicationTitle=SPADE+Pro
The default title is “NSW Natural Resource mini-Atlas”
This describes the configuration for initial map layers and extent and the locator map and extent.
This defines the map layers to be displayed in the main map in a single view. The configuration file which defines the layers (known as a ‘context’ file) is a core WMC feature and has been documented previously for DNR (see Appendix 1 for an example). Essentially the file defines the extent, projection, layers to be used in the view, and a locator object.
The configuration file is stored in the /user/apps/context directory of the application. It can be referenced in the uri with just the name of the file (excluding the file type extension .xml), if loading from the same site.
Eg. &context=Soils.context
If a context file from another server is to be used then use the complete reference to the file.
ie. &context=http://wqdp.socialchange.net.au/wmc/user/apps/context/Hits.context.xml
If the map view is to have an active layer for querying (ie. HITS), then this layer definition needs to be defined as ‘active’ and ‘queryable’ within the context configuration file (see bolded attributes below). The ‘ison’ attribute will need to be set to true for the layer to be visible also.
<layer aggregate_group="" allowdelete="true" allowhide="true" anzlicid="ANZNS0359000234" dataURL="NoURL" description="no description available" error="" hasFeatureInfo="true" hasFeatureQuery="true" hasFeatureZoom="false" hasFilter="true" hasGetFeature="true" hidden="false" isactive="true" ison="true" layerid="88221" metaStyle="CSGI 2.0" metaURL="http://wmt.DNR.nsw.gov.au:8080/wfs-canri_catalogue/servlet/WFS?VERSION=1.0.0&REQUEST=GETBESPOKE&TYPENAME=GetCatalogueXML&FILTER=%3CFilter%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Eid%3C%2FPropertyName%3E%3CLiteral%3E88221%3C%2FLiteral%3E%3C%2FPropertyIsEqualTo%3E%3C%2FFilter%3E&MAXFEATURES=10" name="Hunter Integrated Telemetry System (HITS)" radio_group="" sort_key="2" unique_layerid="88221">
</layer>
Other layers you want displayed can be set to not be queryable and inactive, though ought to be made visible still (ie. ison=true)
Also defined within the context configuration file is the locator object.
In the mini-Atlas applications there is only one locator and its size matches that of "locator2" which appears in the Legend tab in the main NRAtlas application. For contexts to be shared between the mini-Atlas and main NRAtlas applications (see also 2.5 below), the locator should be defined with name="locator2". If the locator is not defined in the context, the default "locator2" defined in the mini-Atlas layout will be used. This is currently set (in the smartlocator module of miniAtlas.map.xml) to:
system/images/widgets/locator/nsw_wmc_locator_towns_tiny.gif
Example of setting a custom locator in the context file:
<locator name="locator2">
<SpatialContext>
<SpatialReferenceSystem name="EPSG:4326"/>
<BoundingBox maxx="152.908" maxy="-31.049" minx="149.513" miny="-33.788"/>
<Image height="76" width="99"/>
</SpatialContext>
<ImageURL layers="Towns" url="http://test.nratlas.nsw.gov.au/wmc/custom/images/locator_HITS.gif"/>
</locator>
If defined in the context, "locator2" will also be used in the NRAtlas Legend tab if the NRAtlas is popped-up from the NRAtlas button on the mini-Atlas toolbar. See 2.5 below.
The locator/SpatialContext/Image/@height and @width represent the size of the locator image to be displayed. In the case of the mini-Atlas, the layout is fixed and therefore so is the locator widget height and width. Therefore if the width and height are made any larger that the sample above, it is unlikely the locator image will fit within the locator widget.
However the image itself (locator/ImageURL/@url) can be changed using either a relative or remote uri reference.
The spatial extent represented by the locator map can be defined using locator/SpatialContext/BoundingBox attributes.
Assuming each instance of the layout can use a different context file, the context files can reference different locator images and bounding boxes to which they represent within the locator objects.
The context must define a gazetteer, whether it be a custom gazetteer or the three NRAtlas gazetteers (CMAs, Towns, LGAs) ie:
<!-- ** Gazetteers ** -->
<gazetteer name="gazetteer1">
<ServiceUrl method="GET" url="/system/xml/gazetteer/NSW_CMA.xml"/>
</gazetteer>
<gazetteer name="gazetteer2">
<ServiceUrl method="GET" url="/system/xml/gazetteer/NSW_Towns.xml"/>
</gazetteer>
<gazetteer name="gazetteer3">
<ServiceUrl method="GET" url="/system/xml/gazetteer/NSW_LGAs.xml"/>
</gazetteer>
If a gazetteer is not defined in the context, when the NRAtlas is popped-up from the NRAtlas button on the mini-Atlas toolbar, only one gazetteer will appear in the Find a place tab. See 2.5 below.
By default, if no context openApp parameter is defined then the application will load the default context as defined in the application configuration.
Remember that if you use a context file in a request and them make a change to the context file, you will need to clear the cache (see Clearing cache section).
By default, a context file which defines the map view, also defines the spatial extent at which the map layers are initially viewed. However this can be over-ridden by passing the application a parameter name called ‘extents’ and the value which represents the new spatial extent.
ie. &extents=149.5469362602999,-36.0751786874594,150.6268932630033,-35.203898635477586
This describes the configuration for text/html content used within the layout instance (ie. header, footer, introduction etc….). The content for the layout instance has been broken up into 3 widgets (header text, instruction text and footer text). Each of these widgets is enabled to allow the user to change the content for any or all of these using openApps for a specific instance of the layout. If content is not set for a widget using openApps, then it will use the default content of whatever has been defined in the default layout configuration for each widget.
The content for these widgets is simply an html file with relevant text, styling (and javascript if necessary), which can be a relative or remote html page.
The content of the html you provide will be loaded into the relevant widget of the layout instance. If you have too much content for the size of the widget then only that text which fits in the widget will be displayed. It is up to the creator of the content to ensure the text fits (could be done by changing the amount of text or perhaps the font size). The size of a widget cannot be changed dynamically depending on the size of the widgets content, as it is defined only in the layout instance.
This defines the content to be used for the header text (it can be a remote url), which sits at the top of the page.
ie. &headerURL=/custom/ssi/soils_header.html
This defines the content to be used for the instruction text (it can be a remote url), which sits to the left of the locator map.
ie. &instructURL=http://localhost/nratlas/custom/ssi/soil_instructions.html
This defines the content to be used for the footer text (it can be a remote url), which sits below the scalebar.
ie. &footerURL=/custom/ssi/hits_footer.html
If you wish to add a select list to the html content page in order to change the map extent, this can be done by including the following javascript code in the included page (should be included between the <head> tags of the html).
<script>
function setExtent(list){
var selectedElem = list.options[list.selectedIndex];
var extVal = selectedElem.value;
var extName = selectedElem.text;
if(extVal.length>0){
top.window.location.href = reloadNewExtent(extVal,extName);
}
}
function reloadNewExtent(extent,extname){
var topUrl = top.window.location.href;
// Replace the extents parameter value in the window url
var domain = topUrl.substring(0,topUrl.indexOf("?")+1);
var params = topUrl.substring(topUrl.indexOf("?")+1,topUrl.length);
var paramArray = params.split("&");
var rebuildUrl = domain;
var extentParam = false; var extentNameParam = false;
for(i=0;i<paramArray.length;i++){
if(paramArray[i].indexOf("=")>-1){
var nameVal = paramArray[i].split("=");
if(nameVal[0]=="extents"){
rebuildUrl += nameVal[0] + "=" + extent + "&";
extentParam = true;
} else if(nameVal[0]=="extentname"){
rebuildUrl += nameVal[0] + "=" + extname + "&";
extentNameParam = true;
} else {
rebuildUrl += paramArray[i] + "&";
}
}
}
if(!extentParam){rebuildUrl += "extents=" + extent + "&";}
if(!extentNameParam){rebuildUrl += "extentname=" + extname + "&";}
return rebuildUrl;
}
function setExtentList(){
var form = document.extentLists;
// Look at all select lists and set relevant values where the label is the same as the being passed in by the parameter 'extentname'
for(x=0;x<form.elements.length;x++){
var elem = form.elements[x];
if(elem.type.indexOf("select")>-1){
selectValue(elem, top.widgets.getState("extentname"));
}
}
}
function selectValue(element, label)
{
var itemno;
for(itemno = 0; itemno < element.length; itemno++) { if(element.options[itemno].text == label) element.options[itemno].selected=true;}
}
</script>
Then all you need to do is add the select list(s) within the <form name="extentLists"> tags with an onchange event in the <select>.
ie.
onChange="setExtent(this)
It doesn’t matter what name you give the select list as long as they are different for each select tag.
<form name="extentLists">
<select class="desc" name="CMA_extent" onChange="setExtent(this)">
<option value="">Select a CMA</option>
<option
value="148.723900,-29.998393,152.117946,-28.538843">
… more options….
</select>
<select class="desc" name="LGA_extent" onChange="setExtent(this)">
<option value="">Select an LGA</option> <!--This is the top label for the select list – nothing will happen when this is selected à
<option value="146.86,-36.12,147.01,-35.97">Albury</option>
… more options….
</select>
</form>
This defines the tool to be set as the active tool on the initial load of the application.
ie. display_tool=INFO
Available values for use with this parameter name are:
|
INFO |
Sets the feature info button as active in the toolbar |
|
PAN |
Sets the pan button as active in the toolbar |
|
ZOOM_IN |
Sets the zoom in button as active in the toolbar |
|
ZOOM_OUT |
Sets the zoom out button as active in the toolbar |
By default, if nothing is set using openApps, then the active tool will be ‘zoom in’.
This button is designed to pop up the main NRAtlas application using the same map context as the mini-Atlas, and the current map extent and map tool choice.
For the popped-up NRAtlas to function correctly, the context:
· must have defined either a custom gazetteer or the three NRAtlas default gazetteers
· may have a custom locator defined, as "locator2"
Both the openApp parameters (buttonToChange and buttonImages) are required if changing the image of the “Set Extent” button.
ie. buttonToChange=setextent&buttonImages=/custom/images/more_tools_on.gif,/custom/images/more_tools_off.gif
By default if, these openApp parameters are not sent, then the toolbar will revert to the default images for the tool bar buttons as defined in the toolbar widget configuration file.
If you wish to override the default reset extent which is the extent at which the map is first viewed when opening the application, then use the resetextent parameter
ie. resetextent=143.15296863370546,-34.71315789473684,147.82068793195108,-30.947368421052627
This identifies the name of the button you wish to change the button image of. This is the name of the tool bar button as defined in the tool bar button configuration file. In the case of the NRATLAS it happens to be “setextent”.
This defines the images that are to be used for the on and off states of the button. They are comma delimited. The first is the “on” image and the second is the “off” image. The image references may be absolute or relative.
This defines the extent which the map will be reset to when the Set Extent button is selected. If this is not sent through in the openApp request, then by default the extent will be set to whatever the very first extent was when the application was first opened.
If using an included html content page with a select list (using the documented javascript code), then the value can be set on initial load by sending in the select list name as the value.
This can be done by going to <url>/wmc/maintain/wmc/index.jsp
View/flush metadata cache (metacache.jsp) and then select “Flush All”
Also select
Stylesheet Manager (xslmanager.jsp) and then select the “Flushed cached output” button.
Soils request setting the following:
|
context |
context file to use (can be remote file) |
|
extents |
default extent to initiate map with |
|
display_tool |
default map tool mode (PAN, ZOOM_IN, ZOOM_OUT, INFO) |
|
headerURL |
header html content (can be remote) |
|
instructURL |
instruction html content (can be remote, bit if it is can't include extent select list due to javascript security issues) |
|
footerURL |
footer html content (can be remote) |
|
linkurl |
encoded url of an NRATLS application for the tools link to open |
|
buttonToChange |
name of map tool button to change the image of (setextent) |
|
buttonImages |
reference to on/off images (comma delimited) for the defined "button to change". Can be remote reference. (currently set to sample image in request below). |
|
extentname |
if using an included html content page with a select list (using the documented javascript code), then the value can be set on initial load by sending in the select list name as the value. |
Request:
http://wqdp.socialchange.net.au/wmc/savedapps/miniAtlas?context=Soils.context&extents=153.34,-29.01,153.62,-28.69&display_tool=INFO&headerURL=/custom/ssi/soils_header.html&instructURL=/custom/ssi/soil_instructions.html&footerURL=/custom/ssi/hits_footer.html&linkurl=http%3A%2F%2Fwqdp.socialchange.net.au%2Fwmc%2Fsavedapps%2Fnratlas%3Fdefaultpanel%3Dmapmaker%26context%3Dcanri2.context%26extents%3D149.513%2C-33.713%2C152.908%2C-31.124%26quickMapTitle%3DHunter+Integrated+Telemetry+System&buttonToChange=setextent&buttonImages=/custom/images/more_tools_on.gif,/custom/images/more_tools_off.gif&extentname=Ballina&
Using the same layout but different parameters, you can get a different view to the SOILS url (see above).
http://wqdp.socialchange.net.au/wmc/savedapps/miniAtlas?context=http://wqdp.socialchange.net.au/wmc/user/apps/context/Hits.context.xml&extents=150.7856539458213,-32.779613388539424,151.85415929405588,-31.91757222113903&display_tool=ZOOM_IN&headerURL=/custom/ssi/hits_header.html&instructURL=/custom/ssi/hits_instructions.html&footerURL=/custom/ssi/hits_footer.html&linkurl=http%3A%2F%2Fwqdp.socialchange.net.au%2Fwmc%2Fsavedapps%2Fnratlas%3Fdefaultpanel%3Dmapmaker%26context%3DGroundwater.context%26extents%3D140.6%2C-38.1115%2C153.82%2C-27.5355%26quickMapTitle%3DGroundwater%26extentname%3DAll+of+NSW%26
<?xml version="1.0" encoding="UTF-8"?>
<WebMapApplication>
<!-- This is an application specification generated automatically -->
<appmeta name="hits.context.xml" description="Default context with no base map layer."/>
<map name="guimap" order="reverse">
<SpatialContext>
<SpatialReferenceSystem name="AGD66/Geographic"/>
<BoundingBox minx="141.26" miny="-38.493896848137545" maxx="153.74" maxy="-27.76610315186246"/>
<ImageSize width="500" height="400"/>
</SpatialContext>
<!-- Hunter Integrated Telemetry System (HITS); catalogue layer_id=88221-->
<layer aggregate_group="" allowdelete="true" allowhide="true" anzlicid="ANZNS0359000234"
dataURL="NoURL" description="no description available" error="" hasFeatureInfo="true"
hasFeatureQuery="true" hasFeatureZoom="false" hasFilter="true" hasGetFeature="true"
hidden="false" isactive="true" ison="true" layerid="88221" metaStyle="CSGI 2.0"
metaURL="http://wmt.DNR.nsw.gov.au:8080/wfs-canri_catalogue/servlet/WFS?VERSION=1.0.0&REQUEST=GETBESPOKE&TYPENAME=GetCatalogueXML&FILTER=%3CFilter%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Eid%3C%2FPropertyName%3E%3CLiteral%3E88221%3C%2FLiteral%3E%3C%2FPropertyIsEqualTo%3E%3C%2FFilter%3E&MAXFEATURES=10"
name="Hunter Integrated Telemetry System (HITS)" radio_group="" sort_key="2" unique_layerid="88221">
</layer>
<!-- Topographic base map (Topoweb); catalogue layer_id=98552 -->
<layer aggregate_group="" allowdelete="true" allowhide="true" anzlicid="ANZNS0404001262"
dataURL="http://canri.nsw.gov.au/nrdd/records/ANZNS0404001262.html"
description="no description available" error="" hasFeatureInfo="true"
hasFeatureQuery="true" hasFeatureZoom="false" hasFilter="false" hasGetFeature="false"
hidden="false" isactive="false" ison="true" layerid="98552" metaStyle="CSGI 2.0"
metaURL="http://wmt.DNR.nsw.gov.au:8080/wfs-canri_catalogue/servlet/WFS?VERSION=1.0.0&REQUEST=GETBESPOKE&TYPENAME=GetCatalogueXML&FILTER=%3CFilter%3E%3CPropertyIsEqualTo%3E%3CPropertyName%3Eid%3C%2FPropertyName%3E%3CLiteral%3E98552%3C%2FLiteral%3E%3C%2FPropertyIsEqualTo%3E%3C%2FFilter%3E&MAXFEATURES=10"
name="Topographic base map (Topoweb)" radio_group="" sort_key="2" unique_layerid="98552">
</layer>
<mapmode mode="imap"/>
</map>
<param name="transparent" value="false"/>
<param name="mapscalelist" value=""/>
<!-- ** Locator Maps ** -->
<locator name="locator1">
<SpatialContext>
<SpatialReferenceSystem name="EPSG:4326"/>
<BoundingBox maxx="154.204" maxy="-27.6" minx="140.396" miny="-38.2"/>
<Image height="76" width="99"/>
</SpatialContext>
<ImageURL layers="Towns" url="http://wqdp.socialchange.net.au/wmc/system/images/widgets/locator/nsw_wmc_locator_towns_tiny.gif"/>
</locator>
</WebMapApplication>