<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-15">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi, I'm trying to display a KML track from WGS84 to Gauss-Boaga
using the proj4js library but the track result shifted like 500
meters north...what is wrong?<br>
<br>
<b>This is the page</b>: <a
href="http://www.intornoamessina.it/tracking/image-layer2.html">http://www.intornoamessina.it/tracking/image-layer2.html</a><br>
<br>
<b>And this is the code</b>:<br>
<br>
<style><br>
.olControlAttribution { bottom: 0px!important }<br>
</style><br>
<br>
<script type="text/javascript"
src="OpenLayers.js"></script><br>
<br>
<script type="text/javascript"
src="proj4js/lib/proj4js-compressed.js"></script><br>
<script type="text/javascript"
src="proj4js/lib/projCode/tmerc.js"></script><br>
<script type="text/javascript"
src="proj4js/lib/projCode/merc.js"></script><br>
<script type="text/javascript"
src="proj4js/lib/defs/EPSG3004.js"></script><br>
<script type="text/javascript"
src="proj4js/lib/defs/EPSG900913.js"></script><br>
<br>
<script type="text/javascript"><br>
Proj4js.libPath = "./proj4js/lib/";<br>
</script><br>
<br>
<br>
<script type="text/javascript"><br>
<br>
/* area of interest<br>
EPSG:3004<br>
GEOMETRYCOLLECTION(POLYGON((2556348.9846319 4227924.438,2563754.843
4227924.438,2563754.843 4233595.0653626,2556348.9846319
4233595.0653626,2556348.9846319 4227924.438)))<br>
<br>
EPSG:4326<br>
GEOMETRYCOLLECTION(POLYGON((15.415108753542293
38.197099410930804,15.499681620107433
38.19676993127058,15.5000312968338
38.24787310414907,15.415399250825338
38.2482031851047,15.415108753542293 38.197099410930804)))<br>
*/<br>
<br>
var mercator = new OpenLayers.Projection("EPSG:3004"); <!--
Gauss-Boaga --><br>
var geographic = new OpenLayers.Projection("EPSG:4326"); <!--
WGS84 --><br>
<br>
var map;<br>
<br>
function init()<br>
{<br>
<br>
var esriSatellite = new OpenLayers.Layer.ArcGIS93Rest("ESRI
Satellite",
<a class="moz-txt-link-rfc2396E" href="http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/export?f=image">"http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/export?f=image"</a>,<br>
{ "format" :'png24',<br>
"layers" :'show:0'<br>
},<br>
{ "isBaseLayer":true,<br>
"opacity":1,<br>
"attribution": "Provided by <a
href=\<a class="moz-txt-link-rfc2396E" href="http://www.esri.com/software/arcgis/arcgisonline/index.html\">"http://www.esri.com/software/arcgis/arcgisonline/index.html\"</a>
target=\"_new\">ESRI</a>",<br>
"visibility":true<br>
});<br>
<br>
map = new OpenLayers.Map({<br>
div: "map",<br>
projection: mercator,<br>
maxExtent: new
OpenLayers.Bounds(2000000,3900000,3000000,4500000),<br>
maxScale: 3145, //0.84686783985005,<br>
layers: [esriSatellite, new
OpenLayers.Layer.PointTrack("Tracks", {<br>
projection: geographic,<br>
strategies: [new OpenLayers.Strategy.Fixed()],<br>
protocol: new OpenLayers.Protocol.HTTP({<br>
url: "-track.kml",<br>
format: new OpenLayers.Format.KML()<br>
}),<br>
styleMap: new OpenLayers.StyleMap({fillColor:
"darkred", strokeColor: "red", strokeWidth: 4, strokeOpacity: 0.5,
pointRadius: 5}),<br>
//next two lines have no effect?!<br>
//dataFrom: OpenLayers.Layer.PointTrack.TARGET_NODE,<br>
//styleFrom:
OpenLayers.Layer.PointTrack.TARGET_NODE,<br>
eventListeners: {<br>
"beforefeaturesadded": function(e) {<br>
// group the tracks by fid and create one
track for<br>
// every fid<br>
var fid, points = [], feature;<br>
for (var i=0, len=e.features.length;
i<len; i++) {<br>
feature = e.features[i];<br>
if ((fid && feature.fid !== fid)
|| i === len-1) {<br>
this.addNodes(points, {silent:
true});<br>
points = [];<br>
} else {<br>
points.push(feature);<br>
}<br>
fid = feature.fid;<br>
}<br>
return false;<br>
}<br>
}<br>
})<br>
],<br>
center: new
OpenLayers.LonLat(15.4385912418365,38.2424157857895).transform(geographic,
mercator),<br>
zoom: 13<br>
});<br>
<br>
map.addControl(new OpenLayers.Control.Attribution());<br>
map.addControl(new OpenLayers.Control.LayerSwitcher());<br>
}<br>
</script><br>
<br>
</head><br>
<body onload="init();"><br>
<br>
<p
style="font-size:20px;font-family:Arial;">OpenLayers.Layer.PointTrack,
Gauss-Boaga-Projection and proj4js</p><br>
<div id="map" style="width:768px;height:512px;border:1px solid
blue;"></div><br>
<div><br>
<a
href=<a class="moz-txt-link-rfc2396E" href="http://trac.osgeo.org/proj4js/">"http://trac.osgeo.org/proj4js/"</a>>proj4js</a> <a
href=<a class="moz-txt-link-rfc2396E" href="http://trac.osgeo.org/proj4js/">"http://trac.osgeo.org/proj4js/"</a> target="_new"><img
src=<a class="moz-txt-link-rfc2396E" href="http://gis.ibbeck.de/ginfo/apps/OLExamples/index/nw.gif">"http://gis.ibbeck.de/ginfo/apps/OLExamples/index/nw.gif"</a>
title="new window" border="0"></a><br>
<a
href=<a class="moz-txt-link-rfc2396E" href="http://trac.osgeo.org/openlayers/wiki/Documentation/Dev/proj4js">"http://trac.osgeo.org/openlayers/wiki/Documentation/Dev/proj4js"</a>>OpenLayers
and proj4js</a> <a
href=<a class="moz-txt-link-rfc2396E" href="http://trac.osgeo.org/openlayers/wiki/Documentation/Dev/proj4js">"http://trac.osgeo.org/openlayers/wiki/Documentation/Dev/proj4js"</a>
target="_new"><img
src=<a class="moz-txt-link-rfc2396E" href="http://gis.ibbeck.de/ginfo/apps/OLExamples/index/nw.gif">"http://gis.ibbeck.de/ginfo/apps/OLExamples/index/nw.gif"</a>
title="new window" border="0"></a><br>
</div><br>
</body><br>
<br>
Thanks<br>
Valerio<br>
</body>
</html>