Hello,
I thought I'd share some of my experiences getting GN 2.6.0 (Linux/PostGIS/Tomcat) map viewing and search interfaces to work; hopefully this might be of help to anyone else who's having trouble.
Our requirements are for the OpenLayers map viewer to display data from a local Geowebcache instance in Antarctic Polar Stereographic (EPSG:3031). I'd hoped that it would be possible to do all the configuration in config-gui.xml, but as has been said before, this isn't quite the case in the current version. Following the guidelines in config-gui got me most of the way (adding the Proj string for EPSG:3031, layers etc).
However, my experience is that the options available in config-gui aren't quite enough to get a working system once you change projection from EPSG:4326 or EPSG:900913. I had to make changes in:
scripts/ol_map.js
scripts/ol_minimap.js
scripts/geo/extentMap.js
scripts/geo/proj4js-compressed.js
It seems to me that createMap() in ol_map.js has a bunch of options which the current code will ignore (line 48) unless the supplied mapOptions arg was null. I would like to have options which look something like:
{
projection: new OpenLayers.Projection("EPSG:3031"),
displayProjection: new OpenLayers.Projection("EPSG:3031"),
maxExtent: new OpenLayers.Bounds(-4000000,-4000000,4000000,4000000),
restrictedExtent: new OpenLayers.Bounds(-4000000,-4000000,4000000,4000000),
scales: [40000000, 20000000, 10000000, 5000000, 2000000, 1000000, 500000, 200000, 100000, 50000, 20000, 10000, 5000, 2000, 1000],
numZoomLevels : 15,
units : "m",
controls:
}
So I think, at least for the time being until these extra options (like "units", "scales", "numZoomLevels") are available through config-gui.xml, we need line 48 and following to read:
var options = OpenLayers.Util.applyDefaults(mapOptions, {
projection: new OpenLayers.Projection("EPSG:3031"),
displayProjection: new OpenLayers.Projection("EPSG:3031"),
maxExtent: new OpenLayers.Bounds(-4000000,-4000000,4000000,4000000),
restrictedExtent: new OpenLayers.Bounds(-4000000,-4000000,4000000,4000000),
scales: [40000000, 20000000, 10000000, 5000000, 2000000, 1000000, 500000, 200000, 100000, 50000, 20000, 10000, 5000, 2000, 1000],
numZoomLevels : 15,
units : "m",
controls:
});
Same for ol_minimap.js.
I did correct a minor stylistic problem (Firefox 3.6.10, WinXP) with the drop-down list for the map scales (which also occurs for the projection list above the map). Basically the list of values is unreadable when the drop-down is operated because the combo box list is not wide enough. It needs the Ext config option "listWidth" setting, e.g (line 647 ff):
var zoomSelector = new Ext.form.ComboBox({
emptyText: 'Zoom level',
tpl: '<tpl for="."><div class="x-combo-list-item">1 : {[parseInt(values.scale)]}</div></tpl>',
editable: false,
triggerAction: 'all',
mode: 'local',
store: zoomStore,
width: 110,
listWidth: 170
});
fixes it.
I also altered the projection code (line 61 and following) in extentMap.js to reflect our use of EPSG:3031.
The Javascript Proj library (proj4js.js) needed one edit so as to use a projection definition file EPSG3031.js in scripts/defs. The variable "scriptName" needs to be set to "proj4js-compressed.js", not "proj4js.js". It can then work out that the defs directory is there and has projection definitions in it. This makes GN a bit more responsive as it doesn't have to make calls to spatialreference.org all the time.
It was helpful (thanks to Francois' post pointing me in the right direction) to test these modifications in debug mode (i.e. without all the Javascript minified) by using:
http://<server>/geonetwork/srv/en/main.home?debug
Once it seemed to work I needed to rebuild the aggregated minified Javascript in scripts/lib. For this I downloaded the source from:
http://geonetwork.svn.sourceforge.net/viewvc/geonetwork/trunk/?view=tar
as a tarball. Pointing an SVN client at the GN repository persisted in giving me "Repository moved temporarily to 'viewvc/geonetwork/trunk'; please relocate" (I think it's an HTTP 301 code), so I don't know what I can do my end to fix this?
Thanks again to Francois, I used:
mvn net.alchim31.maven:yuicompressor-maven-plugin:compress
to rebuild the libraries. This failed initially as I found many of the .js files in the tarball had extracted with a .j extension.
scripts/openlayers/lib/OpenLayers/Format/CSWGetRecords.js
was one example where this had happened. Once I'd corrected the 30 or so .js files whose extensions were mangled, I was able to run the Maven compress command above and create new libraries. Uploading these and restarting GN, the map viewer and map search seem to work well.
I don't know whether any of the issues raised here need to go into Trac as tickets - I'm happy to put them in if so.
HTH,
David Herbert
British Antarctic Survey.
--
This message (and any attachments) is for the recipient only. NERC
is subject to the Freedom of Information Act 2000 and the contents
of this email and any reply you make may be disclosed by NERC unless
it is exempt from release under the Act. Any material supplied to
NERC may be stored in an electronic records management system.