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

ptang83 at yahoo.com ptang83 at yahoo.com
Tue Apr 15 18:23:08 EDT 2008


I used the same Map file for the following scenario:
1. using mapserver utility "shp2img" and it generated a 800x500 image (Good size).
2. mapscript + mapserver and it generated a 800x500 image (Good size)

3. openlayer + mapserver and no display.

4. If I change "proj=lcc" to "proj=latlong". openlayer + mapserver generate a 256x256 small image.

Does this mean openlayers can't handle mapfile "proj=lcc"?

Is there a place in openlayer code I can make mapserver generate a 800x500 image if I used "proj=latlong"? 

Thanks!



--- On Tue, 4/15/08, David Fawcett <david.fawcett at gmail.com> wrote:

> From: David Fawcett <david.fawcett at gmail.com>
> Subject: Re: [OpenLayers-Users] Openlayers displa.. size of the map very small.
> To: ptang83 at yahoo.com
> Cc: users at openlayers.org
> Date: Tuesday, April 15, 2008, 3:52 PM
> Take a look at these 5 lines from your map file:
> 
>      EXTENT -8000000 300000 5000000 1500000
>      UNITS METERS
>      PROJECTION
>                "proj=lcc"
> "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=lcc"
> "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
> >


      ____________________________________________________________________________________
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