[OpenLayers-Dev] page does not show any thing

Tim Schaub tschaub at opengeo.org
Mon Jul 13 15:07:27 EDT 2009


mkabeer wrote:
> Dear All,
> i am new to open layers and geoserver, as per documents i installed
> geoserver and tested its working
> then i created following html page and copied as 1-basics.html and copied
> into /geoserver/1-basics.html
> and running through the firefox but nothing is displaying. page is empty.
> here is the following code

I assume you access GeoServer via a URL like 

If so, then http://localhost/geoserver/wms (used below) will only 
resolve to your WMS endpoint if you set up a proxy.

If you don't want to set up a proxy, you can dump things in the www 
directory in GeoServer's config directory.  Assuming you place a page in 
there called basic.html, it will be accessible via a URL like 

If your html uses relative URLs to pull in additional resources (like 
OpenLayers.js), then those resources must be located relative to your 
basic.html page.

None of this is really OpenLayers specific, but if you have additional 
trouble getting OpenLayers to load, send more detail.


> <html>
>     <head>
>     <script src="openlayers/lib/OpenLayers.js"></script>
>         <script type="text/javascript">
>             var map;
>             function init() {
>                 map = new OpenLayers.Map('map');
>                 var wms = new OpenLayers.Layer.WMS(
>                     "Blue Marble",
>                     "http://localhost/geoserver/wms",
>                     {layers: 'world'}
>                 );
>                 map.addLayers([wms]);
>                 map.zoomToMaxExtent();
>             }
>         </script>
>     </head>
>     <body onload="init()">
>         <div id="map"  style="width: 600px; height: 300px"></div>
>     </body>
> </html>
> some one please help me in this 
> Thanks
> Kabeer

Tim Schaub
OpenGeo - http://opengeo.org
Expert service straight from the developers.

More information about the Dev mailing list