Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 834
SpiXel Avatar asked Oct 16 '25 00:10

SpiXel


2 Answers

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

like image 103
SpiXel Avatar answered Oct 17 '25 16:10

SpiXel


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.

like image 44
naugler Avatar answered Oct 17 '25 18:10

naugler



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!