[OpenLayers-Users] Adding a Mapserv Layer

Christian López Espínola penyaskito at gmail.com
Sat Nov 17 07:49:06 EST 2007


Hi Matthew,

Your div is named 'map', and you are using

var map = new OpenLayers.Map("basemap", options);

This search for a basemap div, but it doesn't exist.
Change the div id, or change that line of code.

Hope this helps.

On 11/17/07, Matthew Pulis <mpulis at gmail.com> wrote:
> Hi,
>
> I am a fairly new user to OpenLayers, and this is my project aims :
>
> - Want to create a Basemap of streets which is a Vector layer and loading it
> as a MapServ Layer
> * create a start / end point
> * create the route
>
> (* are not yet started)
>
> I am having a problem since after going through the Javascript docs, I fixed
> many of my syntax errors, but am still plagued with this one :
>
> this.div has no properties
> callback("basemap", Object)OpenLayers.js (line 464)
> Class()OpenLayers.js (line 57)
> init()openl.html (line 24)
> onload(load )openl.html (line 1)
> [Break on this error] this.active=false;return
> true;},callback:function(name,args){if(this.callbacks[n...
>
> Error found @ OpenLayers.js (line 464) .. Error reporting by FireBug of
> FireFox
>
> The code I am working upon is a mix of viewsourcing some pages and the
> tutorials :
>
> <html>
> <head>
>  <title>OpenLayers Example</title>
>  <script
> src="http://yancho.no-ip.org/~yancho/OpenLayers.js"></script>
>
>
>  <script defer="defer" type="text/javascript">
>  function init(){
>  var options =
>  {
>  maxExtent: new OpenLayers.Bounds(625102.34974933861,215593.742071
> ,656343.383138 ,239014.742071 ),
>  maxResolution: 302051/1024,
>  zoom: 2,
>  projection: "WGS84",
>  'controls': [],
>  units: "m",
>  numZoomLevels: 12
>  };
>  var map = new OpenLayers.Map("basemap", options);
>  var options2 =
>  ( {name : "Streets Layer"},
>  {url : "http://yancho.no-ip.org/~yancho/cgi-bin/mapserv"},
>  {params : "\\home\\yancho\\public_html\\nc\\sample.map"},
>  {options : []}
>  );
>  map.addLayer (new OpenLayers.Layer.MapServer("streets", options2));
>
>  }
>
>  </script>
>  </head>
> <body onload="init()">
> <div style="width:800px;height:600px" id="map"></div>
>
> </html>
>
> If you want the code with syntax highlighted you can go here :
> http://pastebin.com/f218a9fc9
>
>
> I would be extremely happy if you manage to point me to any errors I am
> doing, and maybe some other reading I should do.
>
> Thanks alot for your time in reading my post
>
>
> Regards
>
>
> Matthew
>
> --
> Matthew Pulis
> URL : http://www.solutions-lab.net
> MSN : pulis_matthew[@]hotmail.com
> ICQ : 145951110
> Skype : solutions-lab.net
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>


-- 
Regards,

Christian López Espínola


More information about the Users mailing list