[OpenLayers-Users] adding relief wms (http://www.maps-for-free.com/) in openlayers

maning sambale emmanuel.sambale at gmail.com
Mon Sep 17 05:27:47 EDT 2007


I am using Geographic Lat/Lon in my webmap:

http://www.greenpeace.org/seasia/en/philippine-hotspots-map

How do I add relief map which has different projection parameters?

Thanks for such a cool software!

The code is below:
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <style type="text/css">
        #map {
            width: 100%;
            height: 80%;
            border: 2px solid green;
        }
    </style>
    <script src="http://openlayers.org/api/OpenLayers.js"></script>
    <script type="text/javascript">
        <!--
        box_extents = [
            [117.76631123, 4.47179102, 121.30658338, 7.52866962],
            [122.17708367, 11.1529166, 123.100417, 11.7329166],
            [122.29875033, 13.24958327, 123.99958367, 14.4979166],
            [123.94128598, 6.64958327, 124.99232407, 7.6279166],
            [124.00101862, 12.2179166, 125.34016093, 12.69708327],
            [120.35786342, 14.71708327, 120.91035233, 15.27458327],
            [120.957917, 17.50958327, 122.33708367, 19.9704166],
            [116.75664335, 7.82916667, 121.35834832, 12.72833333],
            [121.25859274, 13.16208327, 122.80069214, 15.21708327],
            [122.36293328, 9.42124994, 123.57044166, 10.8624993],
            [121.59024665, 6.80166667, 123.58182406, 8.42333333],
            [116.52249998, 4.235, 127.45833332, 21.22565]            	
         ];

        function init(){
            var map = new OpenLayers.Map('map', { controls: [] });

            map.addControl(new OpenLayers.Control.PanZoomBar());
            map.addControl(new OpenLayers.Control.MouseToolbar());
            map.addControl(new
OpenLayers.Control.LayerSwitcher({'ascending':false}));
            map.addControl(new OpenLayers.Control.Permalink());
            map.addControl(new OpenLayers.Control.Permalink($('permalink')));
            map.addControl(new OpenLayers.Control.MousePosition());
            map.addControl(new OpenLayers.Control.OverviewMap());

            var bounds = new OpenLayers.Bounds(116.52, 4.47, 127.45, 20.01);

		var ol_wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
                "http://labs.metacarta.com/wms/vmap0?", {layers: 'basic'} );

            var ol_wms2 = new OpenLayers.Layer.WMS( "PBCPP",
			"http://202.57.66.38/cgi-bin/mapserv?map=/var/www/manual/examples/wms-server/phil_wms.map&",
			{layers: 'cover,roads', format: 'image/png'});

            var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
            	"http://wms.jpl.nasa.gov/wms.cgi",
			{layers: "modis,global_mosaic"});

            var shade = new OpenLayers.Layer.WMS("Shaded Relief",

"http://ims.cr.usgs.gov:80/servlet19/com.esri.wms.Esrimap/USGS_EDC_Elev_NED_3",
                {layers: "HR-NED.IMAGE", reaspect: "false",
transparent: 'true'});

            var dm_wms1 = new OpenLayers.Layer.WMS( "rise at 1m",
			"http://202.57.66.38/cgi-bin/mapserv?map=/var/www/manual/examples/wms-server/rise.map&",
			{layers: 'at1_meters',  transparent: "true", format: 'image/png'});
		
		var dm_wms2 = new OpenLayers.Layer.WMS( "rise at 2m",

	"http://202.57.66.38/cgi-bin/mapserv?map=/var/www/manual/examples/wms-server/rise.map&",
                 	{layers: 'at2_meters',  transparent: "true", format:
'image/png'});
		
		var dm_wms3 = new OpenLayers.Layer.WMS( "rise at 3m",
			"http://202.57.66.38/cgi-bin/mapserv?map=/var/www/manual/examples/wms-server/rise.map&",
                 	{layers: 'at3_meters',  transparent: "true", format:
'image/png'});
	
		var dm_wms4 = new OpenLayers.Layer.WMS( "rise at 4m",

	"http://202.57.66.38/cgi-bin/mapserv?map=/var/www/manual/examples/wms-server/rise.map&",
                 	{layers: 'at4_meters',  transparent: "true", format:
'image/png'});

		var dm_wms5 = new OpenLayers.Layer.WMS( "rise at 5m",

	"http://202.57.66.38/cgi-bin/mapserv?map=/var/www/manual/examples/wms-server/rise.map&",
                 	{layers: 'at5_meters',  transparent: "true", format:
'image/png'});

		var dm_wms6 = new OpenLayers.Layer.WMS( "rise at 6m",
			"http://202.57.66.38/cgi-bin/mapserv?map=/var/www/manual/examples/wms-server/rise.map&",
                 	{layers: 'at6_meters',  transparent: "true", format:
'image/png'});

            var dm_wms7 = new OpenLayers.Layer.WMS( "rise at 7m",

	"http://202.57.66.38/cgi-bin/mapserv?map=/var/www/manual/examples/wms-server/rise.map&",
                 	{layers: 'at7_meters',  transparent: "true", format:
'image/png'});

		var dm_wms8 = new OpenLayers.Layer.WMS( "Adm bnd",

	"http://202.57.66.38/cgi-bin/mapserv?map=/var/www/manual/examples/wms-server/phil_wms.map&",
                 	{layers: 'muni',  transparent: "true", format: 'image/png'});

            var dm_wms9 = new OpenLayers.Layer.WMS( "Populated places",

	"http://202.57.66.38/cgi-bin/mapserv?map=/var/www/manual/examples/wms-server/phil_wms.map&",
                 	{layers: 'geoname',  transparent: "true", format:
'image/png'});


            jpl_wms.setVisibility(false);
			dm_wms1.setVisibility(false);
			dm_wms2.setVisibility(false);
			dm_wms3.setVisibility(false);
			dm_wms4.setVisibility(false);
			dm_wms5.setVisibility(false);
			dm_wms6.setVisibility(false);
			dm_wms7.setVisibility(false);
			dm_wms8.setVisibility(false);
			dm_wms9.setVisibility(false);
			
			
            var boxes  = new OpenLayers.Layer.Boxes( "Highly at risk" );

            for (var i = 0; i < box_extents.length; i++) {
                ext = box_extents[i];
                bounds = new OpenLayers.Bounds(ext[0], ext[1], ext[2],
ext[3], ext[4], ext[5], ext[6], ext[7], ext[8], ext[9], ext[10],
ext[11], ext[12], ext[13]);
                box = new OpenLayers.Marker.Box(bounds);
                box.events.register("click", box, function (e) {
                    this.setBorder("yellow");
                });
                boxes.addMarker(box);
            }
            map.addLayers([ol_wms, ol_wms2, jpl_wms, dm_wms7, dm_wms6,
dm_wms5, dm_wms4, dm_wms3, dm_wms2, dm_wms1, dm_wms8, dm_wms9,
boxes]);
            if (!map.getCenter()) map.zoomToExtent(bounds);

        }
        // -->
    </script>
  </head>
  <body onload="init()">
    <div id="map"></div>
  </body>
</html>



On 9/17/07, Christopher Schmidt <crschmidt at metacarta.com> wrote:
> On Mon, Sep 17, 2007 at 12:37:14PM +0800, maning sambale wrote:
> > Hi,
> >
> > How can we add relief wms from http://www.maps-for-free.com/ in
> openlayers?
>
> http://crschmidt.net/~crschmidt/google/examples/relief-map.html
>
> Regards,
> --
> Christopher Schmidt
> MetaCarta
>


-- 
|---------|----------------------------------------------------------|
| __.-._  |"Ohhh. Great warrior. Wars not make one great." -Yoda     |
| '-._"7' |"Freedom is still the most radical idea of all" -N.Branden|
|  /'.-c  |Linux registered user #402901, http://counter.li.org/     |
|  |  /T  |http://esambale.wikispaces.com|
| _)_/LI  |http://www.geocities.com/esambale/philbiodivmap/philbirds.html   |
|---------|----------------------------------------------------------|



More information about the Users mailing list