[OpenLayers-Users] Putting map-div in a table won't work

kejster kejster at gmail.com
Tue Sep 2 14:21:02 EDT 2008


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&amp;v=2&amp;key=ABQIAAAAjpkAC9ePGem0lIq5XcMiuhR_wWLPFku8Ix9i2SXYRVK3e45q1BQUd_beF8dtzKET_EteAjPdGDwqpQ'></script>
    <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.




More information about the Users mailing list