Hi!
Im trying to create a map with a basic overlay using Google Maps for base
layer, and a layer of New York Roads ontop (included when dowloading
geoserver). Though I cant get the projections right. Theres an error around
50 meters or so.
var map;
function init(){
format = 'image/png';
var bounds = new OpenLayers.Bounds(
-74.02722, 40.684221,
-73.907005, 40.878178
);
map = new OpenLayers.Map('map',{
controls:[
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PanZoomBar(),
new OpenLayers.Control.Attribution(),
new OpenLayers.Control.LayerSwitcher()
],
maxExtent: new
OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
maxResolution: 156543.0399,
numZoomLevels: 19,
//units: 'm',
projection: new
OpenLayers.Projection("EPSG:4326"),
displayProjection: new
OpenLayers.Projection("EPSG:900913")
});
var gmap = new OpenLayers.Layer.Google(
"Google Streets", // the default
{numZoomLevels: 25}
);
var osm = new OpenLayers.Layer.OSM();
tiled = new OpenLayers.Layer.WMS(
"tiger_roads - Tiled",
"http://localhost:8080/geoserver/wms",
{
//modify parameters
height: '512',
width: '317',
layers: 'tiger:tiger_roads',
styles: '',
srs: 'EPSG:4326',
format: format,
tiled: 'true',
transparent:'true',
tilesOrigin : map.maxExtent.left + ',' +
map.maxExtent.bottom
},
{
reproject: true,
displayOutsideMaxExtent: false,
singleTile: true
}
);
map.addLayers([gmap,tiled]);
map.setCenter(new OpenLayers.LonLat(-74.02,40.69), 14);
}
The road layer used is defined in EPSG:4326, but should I set the map
projection to EPSG:900913 anyway? I have understood its easier to add
google/osm base layers then since this is their default? Either way theres
still an error no matter which "direction" I try to transform in.. I humbly
ask for your help!
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/Projection-problem-basic-tp5958149p5958149.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users