[OpenLayers-Users] epsg:3003 geometries and gmaps

emmexx emmexx at tiscalinet.it
Tue Mar 16 07:13:13 EDT 2010


I want to show a bunch of geometries over a gmap or osm or whatever
commercial baselayer.

I started from shape data created using arcgis: a geotiff map of Milan
and some lines drawn over that map. I don't use arcgis so I imported the
data in grass. Then I exported the vector layer with the lines to a gml
file.

The shape .prj file for one of the vector layers of the arcgis project is:
PROJCS["Monte Mario [Rome] / Italy zone
1",GEOGCS["unnamed",DATUM["D_unnamed",SPHEROID["International_1924",6378388.0,297.0000000000601]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["false_easting",1500000.0],PARAMETER["false_northing",0.0],PARAMETER["central_meridian",9.0],PARAMETER["scale_factor",0.9996],PARAMETER["latitude_of_origin",0.0],UNIT["Meter",1.0]]

I added to the defs folder of proj4js the file EPSG3003.js:
Proj4js.defs["EPSG:3003"] = "+proj=tmerc +lat_0=0 +lon_0=9 +k=0.9996
+x_0=1500000 +y_0=0 +ellps=intl +a=6378388.0 +rf=297.0000000000601
+units=m +no_defs";

In Openlayers I added layers for gmaps & C. like the following:

var gmap = new OpenLayers.Layer.Google(
	"Google Streets",
	{'sphericalMercator': true, numZoomLevels: 22}
);

The map:

var options = {
	projection: new OpenLayers.Projection("EPSG:900913"),
	displayProjection: new OpenLayers.Projection("EPSG:4326"),
	units: "m",
	maxResolution: 156543.0339,
	maxExtent: new OpenLayers.Bounds(-20037508.34, -20037508.34,
		20037508.34, 20037508.34)
};
map = new OpenLayers.Map('map', options);

The layer for the lines I want to load from the GML file:

new OpenLayers.Layer.Vector(
	name,
	{
		projection: map.displayProjection,
  		styleMap: mystyle,
		rendererOptions: {zIndexing: true}
	}
)

I load the gml file like this:

var feat = new OpenLayers.Format.GML({
  projection: new OpenLayers.Projection("EPSG:3003")
});
var y = feat.read($('a_textbox').value);	//I copy the gml file inside
the textbox
for (var i=0; i<y.length; i++)
{						
  y[i].geometry.transform(new OpenLayers.Projection("EPSG:3003"), new
   	OpenLayers.Projection("EPSG:900913"));
}									layer.addFeatures(y);

The lines are imported but they are displaced about 200 m south and 20 m
east in respect of google street or osm. :-(

I don't know if this is a problem with arcgis, grass, openlayers, my code.

Any suggestion?

Thank you
   maxx





More information about the Users mailing list