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

David Fawcett david.fawcett at gmail.com
Tue Apr 15 16:52:50 EDT 2008


Take a look at these 5 lines from your map file:

     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

You are telling MapServer that your image extent is 13 million degrees in
the x direction.

Your EXTENT and UNITS need to be of the same units as your output
projection.

Try UNITS "dd" and convert your extent to degrees.

David.

On Tue, Apr 15, 2008 at 3:06 PM, <ptang83 at yahoo.com> wrote:

>
> 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
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080415/c446487e/attachment.html


More information about the Users mailing list