SpiXel SpiXel - 3 months ago 18
Apache Configuration Question

How to get mapserver to work

I've been working with MapServer for about 2 hours now , but it seems alittle bit complicated to get started with.
So here's my question

Is there any way to get mapserver to show a simple map of whole world in which I can move the map to see different parts of the world ?

( from what I've learnt so far , it just shows you the Map you've passed the mapserv cgi , and the map is static and cannot be moved ! )

EDIT :
I'm still wondering if I can have a simple map for the whole world or a country or whatever ! Should I be Writing .Map Files for everything On my own ??

Answer

Okay , so after looking it up and struggling alittle , I found some JS libraries to do this, One of the was Open Layers. You just have to reference it at the beginning of your html page like :

<script src="http://openlayers.org/api/OpenLayers.js"></script>

and then you can have zoom and move options for your map by binding MapServer data as follows to the OpenLayers init function.

Var map, layer;

function init(){
    map = new OpenLayers.Map( 'map' );
    layer = new OpenLayers.Layer.MapServer( "NAME",
       "http://localhost/cgi-bin/mapserv", {map: 'PATH_TO_.MAP'} );
    map.addLayer(layer);
    map.zoomToMaxExtent();
}

And lots of cool tutorials can be found in spatialhorizons.com.
Hope this helps someone :)