javascript - Using an PNG or JPEG for Map with OpenLayers (Scale/Zoom Problem) -
I am using an image to display my map with OpenLayers. My JS code looks like this:
map = new openlayer Map ('map'); Var option = {numZoomLevels: 7, isBaseLayer: true,}; Var globe = new open layer Layers Image ('Globe ESA', 'http://upload.wikimedia.org/wikipedia/commons/0/07/World_map_blank_black_lines_4500px.gif', new open layer bounce (-180, -90, 180, 90), new Open Layers Size (4500, 2234), Options); Map.addLayers (globe); Marker = New OpenLayer Layers Marker ("marker"); Map.addLayer (marker); Map.addControl (new OpenLayer control.layerviewer); Map.zoomToMaxExtent (); Map.addControl (new OpenLayer control.mouseposa ()); My CSS is:
#map {width: 640px; Height: 480px; Limit: 1px solid black; } But I can not get the open layer to scale the larger image. It is always displayed at full resolution and I can not zoom out to display the whole world. help please.
You have to set the image size because it should be shown when fully zoomed out.
High Globe = New Open Layer. Layers Image ('Globe ESA', 'http://upload.wikimedia.org/wikipedia/commonS/0/07/World_map_blank_black_lines_4500px.gif', New Open Layers.Bound (-180, -90, 180, 90), New Open Layers size (1125,558), option); I changed the size to a quarter of size size. If you want, you can zoom in more.
Comments
Post a Comment