[OpenLayers-Users] OpenLayers error - template.replace is not a function

Leigh Holcombe lholcombe at triple-bypass.net
Fri Feb 25 05:25:48 EST 2011


Hello,
I'm a new user of OpenLayers, with not much JavaScript or Ajax programming experience.  I thought I was starting to get the hang of the API, but then I came across an error.  This error shows up in the Firefox error console, and an empty map-sized container is shown:

template.replace is not a function
http://www.openlayers.org/api/OpenLayers.js
Line: 102

Can anyone shed some light on what might be causing this?  My humble code, relying heavily on various samples and tutorials, is below:

function init() {

Proj4js.defs["EPSG:26904"]="+proj=utm +zone=4 +ellps=GRS80 +datum=NAD83 +units=m +no_defs";
var x = 626910.977254;
var y = 2358256.879039;
var mercator = new Proj4js.Proj("EPSG:90013");
var utm4n = new Proj4js.Proj("EPSG:26904");
var map = new OpenLayers.Map('testmap', {projection: mercator});
var osm = new OpenLayers.Layer.OSM('osmlayer', {sphericalMercator: true});
var point = new Proj4js.Point(x,y);
map.addLayer(osm);
map.addControl(new OpenLayers.Control.PanZoomBar());
map.setCenter(Proj4js.transform(utm4n, mercator, point));
map.zoomTo(15);
}

Regards,
Leigh Holcombe



More information about the Users mailing list