[OpenLayers-Users] i Only get gray screen

Ian Erickson ierickson at analygis.com
Mon Jul 2 12:01:41 EDT 2007


Pablo,

It appears as though your BBOX request contains a box centered off the 
coast of Portugal.  The extents specified in your .map file contain 
points in Argentina.  The meat of the issue seems to be the lon and lat 
parameters passed into the map.setCenter method.

Try something like:

//-------------------------------------------
lon = -64.187587;
lat = -31.437243;
zoom = 5;

map.setCenter( new OpenLayers.LonLat( lon, lat ), zoom );
//-------------------------------------------

This will, at the very least, center your map on an area that contains 
valid data (based on your .map file).

Ian Erickson
AnalyGIS, LLC
http://www.analygis.com




Pablo Perez De Angelis wrote:

> When i try to publish whit 
> http://trac.openlayers.org/wiki/MappingYourData i get all the thin ok
> But when i try whit my own data i only get solid gray.
> I tray whit WMS instead of mapserver layer and the same result.
>
>
> this query 
> http://localhost/cgi-bin/mapserv?map=/var/www/mapa/unc.map&LAYERS=Ciudad&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=-22.5%2C33.75%2C-11.25%2C45&WIDTH=256&HEIGHT=256 
> <http://localhost/cgi-bin/mapserv?map=/var/www/mapa/unc.map&LAYERS=Ciudad&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&BBOX=-22.5%2C33.75%2C-11.25%2C45&WIDTH=256&HEIGHT=256>
> Return an gray box
> when i erase BBOX=-22.5%2C33.75%2C-11.25%2C45
> http://localhost/cgi-bin/mapserv?map=/var/www/mapa/unc.map&LAYERS=Ciudad&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&WIDTH=256&HEIGHT=256 
> <http://localhost/cgi-bin/mapserv?map=/var/www/mapa/unc.map&LAYERS=Ciudad&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg&SRS=EPSG%3A4326&WIDTH=256&HEIGHT=256>
> I get a map.
>
> Can any one help me?.
>
>
> my .map
>
> # Map file created from QGIS project file /var/www/mapa/unc.qgs
> # Edit this file to customize for your map interface
> MAP
>   NAME mapa
>   # Map image size
>   SIZE 800 600
>   UNITS METERS
>
>   EXTENT -64.196055 -31.444185 -64.179119 -31.430301
>   PROJECTION
>     'proj=longlat'
>     'ellps=WGS84'
>     'datum=WGS84'
>     'no_defs'
>   END
>
>   # Background color for the map canvas -- change as desired
>   IMAGECOLOR 192 192 192
>   IMAGEQUALITY 95
>   IMAGETYPE png
>   OUTPUTFORMAT
>     NAME png
>     DRIVER 'GD/PNG'
>     MIMETYPE 'image/png'
>     #IMAGEMODE PC256
>     EXTENSION 'png'
>   END
>   # Legend
>   LEGEND
>       IMAGECOLOR 255 255 255
>     STATUS ON
>     KEYSIZE 18 12
>     LABEL
>       TYPE BITMAP
>       SIZE MEDIUM
>       COLOR 0 0 89
>     END
>   END
>
>   # Web interface definition. Only the template parameter
>   # is required to display a map. See MapServer documentation
>   WEB
>     # Set IMAGEPATH to the path where MapServer should
>     # write its output.
>     IMAGEPATH '/tmp/'
>
>     # Set IMAGEURL to the url that points to IMAGEPATH
>     # as defined in your web server configuration
>     IMAGEURL '/tmp/'
>
>     # WMS server settings
>     METADATA
>       'wms_title'           'mapa'
>       'wms_onlineresource'  
> 'http://localhost/cgi-bin/mapserv?map=/var/www/mapa/unc.map& 
> <http://localhost/cgi-bin/mapserv?map=/var/www/mapa/unc.map&>'
>       'wms_srs'             'EPSG:4326'
>     END
>
>     #Scale range at which web interface will operate
>     # Template and header/footer settings
>     # Only the template parameter is required to display a map. See 
> MapServer documentation
>   END
>
>   LAYER
>     NAME 'Ciudad'
>     TYPE POLYGON
>     DATA '/var/www/mapa/uncdata/Ciudad.shp'
>     METADATA
>       'wms_title' 'Ciudad'
>     END
>     STATUS DEFAULT
>     TRANSPARENCY 100
>     PROJECTION
>     'proj=longlat'
>     'ellps=WGS84'
>     'datum=WGS84'
>     'no_defs'
>     END
>     CLASS
>        NAME Ciudad
>        STYLE
>          SYMBOL 0
>          SIZE 6
>          OUTLINECOLOR 0 0 0
>          COLOR 161 59 179
>        END
>     END
>   END
>
>  
>
> END
>
>
> My html
> <html xmlns=" http://www.w3.org/1999/xhtml">
>   <head>
>     <style type="text/css">
>         #map {
>             width: 800px;
>             height: 475px;
>             border: 1px solid black;
>         }
>     </style>
>    <script src="http://openlayers.org/dev/lib/OpenLayers.js"></script>
>     <script type="text/javascript">
>         <!--
>         var lon = 5;
>         var lat = 40;
>         var zoom = 5;
>         var map, layer;
>
>         function init(){
>             map = new OpenLayers.Map( 'map' );
>             layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
>                     
> "http://localhost/cgi-bin/mapserv?map=/var/www/mapa/unc.map& 
> <http://localhost/cgi-bin/mapserv?map=/var/www/mapa/unc.map&> ", 
> {layers: 'Ciudad'} );
>             map.addLayer(layer);
>
>             map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
>             map.addControl( new OpenLayers.Control.LayerSwitcher() );
>         }
>        
>         // -->
>     </script>
>   </head>
>   <body onload="init()">
>     <div id="map"></div>
>   </body>
> </html>
>
>
>
> -- 
> Pablo PDA
> http://www.pablopda.com.ar/blog
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Users mailing list
>Users at openlayers.org
>http://openlayers.org/mailman/listinfo/users
>  
>




More information about the Users mailing list