[OpenLayers-Dev] .JPG image in OverviewMap

XinGang Li slinavlee at gmail.com
Thu May 14 23:33:05 EDT 2009


Try this example:

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
      <title>OpenLayers Image Layer Example</title>
    <link rel="stylesheet" href="../theme/default/style.css" type="text/css"
/>
    <link rel="stylesheet" href="style.css" type="text/css" />
    <script src="../lib/OpenLayers.js"></script>
    <script type="text/javascript">
        var map;
        function init(){
            map = new OpenLayers.Map('map');

            var graphic = new OpenLayers.Layer.Image(
                'City Lights',
                '
http://earthtrends.wri.org/images/maps/4_m_citylights_lg.gif',
                new OpenLayers.Bounds(-180, -88.759, 180, 88.759),
                new OpenLayers.Size(580, 288),
                {numZoomLevels: 1}
            );

            var jpl_wms = new OpenLayers.Layer.WMS( "NASA Global Mosaic",
                "http://t1.hypercube.telascience.org/cgi-bin/landsat7",
                {layers: "landsat7"});

            map.addLayer(jpl_wms);
            map.addControl(new OpenLayers.Control.LayerSwitcher());

            var overview1 = new OpenLayers.Control.OverviewMap({Layers:
graphic});
            map.addControl(overview1);
            map.zoomToMaxExtent();
        }
    </script>
  </head>
  <body onload="init()">
    <h1 id="title">OverviewMap with Image Layer Example</h1>

    <div id="map" class="smallmap"></div>
  </body>
</html>




On Fri, May 15, 2009 at 12:03 AM, Jean-Daniel JDG. GONON
<jdg at geosphere.fr>wrote:

>
>
> Hi
>
>
>
> As I said in my last mail, I want to display a .JPG image in an OverviewMap
> control.
>
>
>
> I view these sites (http://workshops.opengeo.org/openlay.../controls.html,
> http://trac.openlayers.org/wiki/Control/OverviewMap ) to help me.
>
>
>
> To to this display, I have this code :
>
>
>
> Creation of the image layer to display in the overviewMap control :
>
> minimapImgLayer = new OpenLayers.Layer.Image('ImageLayer',
>
>     'C:/ms4w/minicarte/reference.jpg',
>
>     new OpenLayers.Bounds(937134.75,281924.76,942621,287411.01),
>
>     new OpenLayers.Size('150', '150'),
>
>     {numZoomLevels: '1', alwaysInRange: true});
>
>
>
> Creation of the main map with OverviewMap control :
>
> ol_Map = new OpenLayers.Map('viewport', {
>
>     controls: [ol_miniMap = new OpenLayers.Control.OverviewMap( {
>
>         layers:[minimapImgLayer],
>
>         size: new OpenLayers.Size('150','150')
>
>         } )],
>
>     maxExtent: new OpenLayers.Bounds(937134.75,281924.76,942621,287411.01),
>
>     scales: [25000,10000,5000,2500,1000],
>
>     maxResolution: '96',
>
>     units: 'm',
>
>     i: 'JPEG',
>
>     tileSize: new OpenLayers.Size('400','400'),
>
>     projection: 'init=epsg:27562'
>
>     }, numZoomLevels = '5');
>
>
>
> Creation of KaMap layer for the main map :
>
> KaMapLayer = new OpenLayers.Layer.KaMap( 'Couche_KaMap',
>
>     'http://localhost/kernel/myKaTile.php',
>
>     { map: 'Couche_KaMap',
>
>     qId:'-1',
>
>     i: 'JPEG',
>
>     la:'Couche0,Couche1,Couche2,Couche3,Couche4'
>
>     });
>
>     ol_Map.addLayer(KaMapLayer);
>
>     ol_Map.zoomToMaxExtent();
>
>
>
> The main map is displayed correctely.
>
> But nothing is displayed in OverviewMap control.
>
>
>
> Is somebody has an idea to help me ? ?
>
>
>
> Thank you !!
>
> JDG
>
>
>



-- 
Li XinGang
EMail: slinavlee at gmail.com
Blog:   avlee.cnblogs.com
Site:    www.mapboost.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-dev/attachments/20090515/6b08fee1/attachment.html


More information about the Dev mailing list