Thanks, but now my layer is shifted in South Africa!!! I don't understand what's wrong: the map output the exact coordinates. Well, I've: 3 base layers -> epsg:900913 1 gml layer -> epsg:2498 and I want display projection in wgs84
Is my set up (code in my previous mail) correct? -beppe- 2010/4/7 <[email protected]> > Hi, > > not sure if this is the cause of your problem since I don't know anything > about EPSG:2498, but can you try adding xy false to your Format.GML: > > var isoline = new OpenLayers.Layer.Vector("isoline", { > strategies: [new OpenLayers.Strategy.Fixed()], > protocol: new OpenLayers.Protocol.HTTP({ > url: "../aramus_data/vector/gml/isoipse_2498.gml", > projection: epsg2498, > format: new OpenLayers.Format.GML({xy: false}) > }) > }); > > Best regards, > Bart > > > Hi all, > > I ought to display a map with osm layer as base and a gml file of a > little > > part of Armenia. > > First step was convert my shapefile, with projection epsg:2498, in a gml > > format (ogr2ogr -f GML ...). > > > > Second step was set up my map. > > Within tag <head> of my html page, I' ve insert a link to these > libraries: > > > > - OpenLayers-2.8/OpenLayers.js > > - http://www.openstreetmap.org/openlayers/OpenStreetMap.js > > - proj4js.js > > - proj4s/lib/defs/EPSG2498.js > > > > And this is a snippet of my map code [1]. > > > > The problem is that my gml is in the north of Africa instead of Armenia. > > I've tried with qgis and the layer is correctly positioned, so I suppose > > that the problem is in the code, but I' m not able to detect the bug!!! > > > > thanks > > > > -beppe - > > > > [1] function init() { > > var epsg2498= new OpenLayers.Projection("EPSG:2498"); > > var epsg900913= new OpenLayers.Projection("EPSG:900913"); > > var epsg4326= new OpenLayers.Projection("EPSG:4326"); > > > > var bounds = new OpenLayers.Bounds(44.532, 40.144, 45.038, > > 40.423).transform(epsg4326, epsg900913); > > > > map = new OpenLayers.Map ("map", { > > controls:[ > > new OpenLayers.Control.Navigation(), > > new OpenLayers.Control.LayerSwitcher({activeColor:"#729aa1"}), > > new > > OpenLayers.Control.MousePosition({div:document.getElementById("coord")}), > > new OpenLayers.Control.Attribution()], > > > > maxExtent: bounds, > > maxResolution: 156543.0399, > > numZoomLevels: 5, > > minZoomLevel: 3, > > maxZoomLevel: 8, > > units: 'm', > > projection: epsg900913, > > displayProjection: epsg2498 > > } ); > > > > > > var layerCycleMap = new OpenLayers.Layer.OSM.CycleMap("CycleMap"); > > map.addLayer(layerCycleMap); > > > > var layerTilesAtHome = new > > OpenLayers.Layer.OSM.Osmarender("Osmarender"); > > map.addLayer(layerTilesAtHome); > > > > var layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik"); > > map.addLayer(layerMapnik); > > > > var isoline = new OpenLayers.Layer.Vector("isoline", { > > strategies: [new OpenLayers.Strategy.Fixed()], > > protocol: new OpenLayers.Protocol.HTTP({ > > url: "../aramus_data/vector/gml/isoipse_2498.gml", > > projection: epsg2498, > > format: new OpenLayers.Format.GML() > > }) > > }); > > isoline = OpenLayers.Projection.transform(isoline, epsg2498, > > map.projection); > > map.addLayer(isoline); > > .... > > .... > > .... > > -- > > -beppe- > > _______________________________________________ > > Users mailing list > > [email protected] > > http://openlayers.org/mailman/listinfo/users > > > > > -- -beppe-
_______________________________________________ Users mailing list [email protected] http://openlayers.org/mailman/listinfo/users
