Question

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 ??

Was it helpful?

Solution

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 :)

OTHER TIPS

MapServer is just that, a MAP SERVER. It sounds like you are currently using a cgi script to display a hosted map. WMS providers like MapServer host data that can be viewed using a WMS client application. There are many such applications. You will need a more sophisticated client application to connect to the MapServer in order to perform more complicated map manipulations.

check out GoogleEarth

or NASA WorldWind

or I haven't used this yet but it looks like it might be the easiest, if least dependable.

First MapServer is the GIS server side technology. The zoom in/ pan is the client side behavior in my opinion.

When we look at the moment that user pan/zoom at one web application, what really happened is the front end application get the pan/zoom event and make calls to mapserver to get the new map to return to the client side.

So it is more likely your leaflet, Google map API, Openlayers, etc. are handling the detection of the client movement and parse it into new getmap request and send the request to mapserver to get the response.

What you saw from the MapServer using get request is static and it is suppose to be so. The dynamic part is happened in the client side to make dynamic calls from the front end application to make these static calls. That is interactive when client side dynamically sending out request and refresh the map from the response.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top