[OpenLayers-Dev] page does not show any thing

Tim Schaub tschaub at opengeo.org
Tue Jul 14 12:41:33 EDT 2009


Hey-

mkabeer wrote:
> Hi Tim,
> 
> First of all Thank you very much.
> 
> i did as you said i copied the 1-basics.html into goeserver/www folder then
> i run from web
> http://localhost:8910/geoserver/www/1-basics.html
> 
> it does not show
> 
> if type wrong html file name like
> http://localhost:8910/geoserver/www/1-b.html 
> the server is there is no file that means the server can read html file now
> but inside html file there is some thing wrong can you please look at the
> code here following
> 
> <html>
>     <head>
>     <script src="openlayers/lib/OpenLayers.js"></script>

Is this the correct path to your OpenLayers.js library?  If you load 
this page from http://localhost:8910/geoserver/www/1-basics.html then 
your OpenLayers.js file should be at 
http://localhost:8910/geoserver/www/openlayers/lib/OpenLayers.js.  If it 
is not there, the map will not load (and if you've got the Firebug 
console open, you'll see an error about OpenLayers being undefined).

>         <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'}
>                 );

You have said above that your GeoServer is accessible on port 8910.  For 
this layer definition, you give an absolute url that looks for GeoServer 
on port 80.  Instead of "http://localhost/geoserver/wms", you want 
"/geoserver/wms" or "http://localhost:8910/geoserver/wms".

If you aren't using Firebug already, get Firefox and install Firebug. 
Use the console, find the scripts loaded in the script tag, and get 
notices about any errors.

Tim

> 
>                 map.addLayers([wms]);
>                 map.zoomToMaxExtent();
>             }
> 
>         </script>
>     </head>
> 
>     <body onload="init()">
>         <div id="map"  style="width: 600px; height: 300px"></div>
>     </body>
> </html>
> 
> 
> Thanks
> Kabeer
> 
> 
> Tim Schaub wrote:
>> Hey-
>>
>> 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 
>> http://localhost:8080/geoserver
>>
>> 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 
>> http://localhost:8080/geoserver/www/basic.html
>>
>> 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.
>>
>> Tim
>>
>>> <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.
>> _______________________________________________
>> Dev mailing list
>> Dev at openlayers.org
>> http://openlayers.org/mailman/listinfo/dev
>>
>>
> 


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



More information about the Dev mailing list