[OpenLayers-Users] Openlayers displa.. size of the map very small.

ptang83 at yahoo.com ptang83 at yahoo.com
Tue Apr 15 16:06:55 EDT 2008


I downloaded a demo which display a nice map through mapserver. The image is like this.
http://www.mobilegeographics.com/mapserver/usa1.phtml

The image is big and nice. 

When I changed it to display throught openlayers. The openlayer map only display a blank windows with all controls. If I change the "proj=lcc" to "proj=latlong" , then it display a map but the size of the map is very small and only occupied the upper lift corner of the openlayers div. Is there any way to make  display fit the windows?

Would like to take any suggestion. Thanks in advance!

=========
usa1.html
===========
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
 //  <title>My Test MapServer Layer</title>
    <style type="text/css">
        #map {
            width: 800px;
            height: 500px;
            border: 1px solid black;
        }
    </style>

    <script type="text/javascript" src="http://clients.multimap.com/API/maps/1.1/metacarta_04"></script>

    <script src="http://openlayers.org/dev/lib/OpenLayers.js"></script>
    <script type="text/javascript">
        <!--
        var map, layer;

        function init(){
            map = new OpenLayers.Map( 'map' );
            layer = new OpenLayers.Layer.MapServer( "OpenLayers WMS", 
                    "http://localhost/cgi-bin/mapserv.exe",
                     {map: 'C:/Program Files/ms4w/Apache/htdocs/MSrecipes/usa1.map'} );
                     // {map: 'C:/Program Files/ms4w/Apache/htdocs/usa1.map'} );

            map.addLayer(layer);
            map.zoomToMaxExtent();
        }
        // -->
    </script>
  </head>
  <body onload="init()">
    <div id="map"></div>
  </body>
</html>


============
map file
==============

MAP
    NAME USA1
    STATUS ON
    SIZE 800 500
    IMAGETYPE PNG
    IMAGECOLOR 240 240 240
    SHAPEPATH "C:\oatdir\statesp020.tar"
    EXTENT -8000000 300000 5000000 1500000
    UNITS METERS
    PROJECTION
		"proj=latlong" "lat_1=32" "lat_2=44" "lat_0=38" "lon_0=-100" "x_0=0" "y_0=0" "ellps=GRS80" "datum=NAD83"
    END
    WEB
        IMAGEPATH "C:\Program Files\ms4w\Apache\htdocs\tmp\"
        IMAGEURL "/tmp/"
    END
	
	LAYER
		NAME "US state boundaries"
		TYPE POLYGON
		STATUS DEFAULT
		DATA 'C:\oatdir\statesp020.tar\statesp020'

		PROJECTION
			"proj=latlong"
			"ellps=GRS80"
			"datum=NAD83"
		END
		CLASS
			NAME "US states"
			OUTLINECOLOR 60 60 60
			COLOR 255 255 0
			SYMBOL 0
		END
	END
	
	
	
END


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ



More information about the Users mailing list