[OpenLayers-Users] Putting map-div in a table won't work
Andrew de Klerk
andrew.deklerk at gmail.com
Tue Sep 2 16:02:42 EDT 2008
Does your map div have a style with width and height set? - i.e.
#map{
width:500px;
height:500px;
border:1px solid;
}
Other than that, I We have placed ours in a table before - so that should
not be a problem. I may be missing something, but your code looks ok
The div is a normal html div so you should be able to position it through
styles
-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] On
Behalf Of kejster
Sent: 02 September 2008 08:21 PM
To: users at openlayers.org
Subject: [OpenLayers-Users] Putting map-div in a table won't work
I am very new to Openlayers, so I thought I would play around with one of
the
examples (the Google with overlay one).
I can get that to work OK, but then I though I'd try to position the div
where the map is show.
I tried two ways: using a stylesheet ( #map { position: ...... ) and a
table.
Neither of these things work. I just see a blank page.
Below is my code for the one I did with the table.
Can anyone tell me if I'm just doing something wrong, or does OpenLayers not
allow you to mess with the position of it's div?
------------------------------------------
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Untitled Page</title>
<script
src='http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAjpkAC9ePGe
m0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></scri
pt>
<script src="JavaScript/OpenLayers.js"></script>
<script type="text/javascript">
var map;
function init(){
map = new OpenLayers.Map('map');
var satellite = new OpenLayers.Layer.Google(
"Google Satellite" , {type: G_SATELLITE_MAP}
);
var wms = new OpenLayers.Layer.WMS(
"World Map",
"http://world.freemap.in/cgi-bin/mapserv",
{
map: '/www/freemap.in/world/map/factbooktrans.map',
transparent: 'TRUE',
layers: 'factbook'
},
{'reproject': true}
);
map.addLayers([satellite, wms]);
map.setCenter(new OpenLayers.LonLat(10.205188,48.857593), 5);
map.addControl( new OpenLayers.Control.LayerSwitcher() );
}
</script>
</head>
<body onload="init();">
<table>
<tr>
<td>Some text</td>
</tr>
<tr>
<td>
<div id="map"></div>
</td>
</tr>
</table>
</body>
</html>
--
View this message in context:
http://n2.nabble.com/Putting-map-div-in-a-table-won%27t-work-tp834581p834581
.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.169 / Virus Database: 270.6.14/1647 - Release Date: 9/2/2008
6:02 AM
More information about the Users
mailing list