[OpenLayers-Dev] .JPG image in OverviewMap

Jean-Daniel JDG. GONON jdg at geosphere.fr
Thu May 14 12:03:41 EDT 2009


 

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

 

________________________________

De : Jean-Daniel JDG. GONON 
Envoyé : jeudi 7 mai 2009 09:44
À : 'XinGang Li'
Cc : dev at openlayers
Objet : RE: [OpenLayers-Dev] .JPG image in OverviewMap

 

Yes I want to use this idea, so I modify my code like this :

 

var minimapImgLayer = new OpenLayers.Layer.Image('ImageLayer', 'reference.jpg',

      new OpenLayers.Bounds(extent->minx, extent->miny, extent->maxx, extent->maxy),

      new OpenLayers.Size('150', '150'), {numZoomLevels: '1', alwaysInRange: true} );

 

var ol_miniMap;

var ol_Map = new OpenLayers.Map('viewport', {

      controls: [ ol_miniMap = new OpenLayers.Control.OverviewMap( {

            mapOptions: {

                  maxExtent: new OpenLayers.Bounds(extent->minx, extent->miny, extent->maxx, extent->maxy),

                  maxResolution: ResolutionMap,

                  projection: ProjectionMap,

                  units: UnitsMap,

                  layers: [minimapImgLayer],

                  numZoomLevels: '1'

            }, size: new OpenLayers.Size('150','150') } ) ],

      maxExtent: new OpenLayers.Bounds(extent->minx, extent->miny, extent->maxx, extent->maxy),

      scales: [NewScalesMap],

      maxResolution: ResolutionMap,

      units: UnitsMap,

      i: szImgFormat,

      tileSize: new OpenLayers.Size('tileWidth','tileHeight'),

      projection: ProjectionMap

}, numZoomLevels = NumberScalesMap );

 

The reference.jpg image has a resolution of 150*150 pixels.

 

With this code, I have no error message.

But the overview map display a clone of main map, instead of my JPG image.

I don't know why ..??

 

Is what someone have an idea of solution ??

 

Thank you in advance !!

JDG

 

 

________________________________

De : XinGang Li [mailto:slinavlee at gmail.com] 
Envoyé : mercredi 6 mai 2009 07:25
À : Jean-Daniel JDG. GONON
Cc : dev at openlayers
Objet : Re: [OpenLayers-Dev] .JPG image in OverviewMap

 

You can use the OpenLayers.Layer.Image with one zoom level in your overview map, like this:
         var imageLayer = new OpenLayers.Layer.Image(
                "ImageLayer", 
                "test.jpg", 
                new OpenLayers.Size(150, 150),
                {numZoomLevels: 1, alwaysInRange: true}
            );

On Tue, May 5, 2009 at 6:12 PM, Jean-Daniel JDG. GONON <jdg at geosphere.fr> wrote:

For my question :


I can't specify LAYER attribut of overviewMap control, because this JPG image is generated by an admin according wanted layers mapfile's (it's generated when it's necessary) : the wanted layers can change often, so I can't modify LAYER attribute each times.
Selected layers by the admin in the JPG image aren't saved elsewhere.

Zooming function doesn't interrest me : the JPG image has 150*150px resolution, and I want always display the full map in OverviewMap (whatever the scale and the current position in OpenLayers map).
But I want to keep a moving function between OpenLayers map and OverviewMap...

Thank you in advance.
JDG

 

________________________________

De : Jean-Daniel JDG. GONON 
Envoyé : lundi 4 mai 2009 14:14
À : 'dev at openlayers.org'
Objet : .JPG image in OverviewMap

 

Hi all,

 

Is it possible to load a .JPG image in the overview map control ?

 

In my application, a JPG mini-map is generated by an admin according to layers selected or not.

I want to load this JPG image (with a point to locate the current position), with a fixed size and without zoom function.

 

Thank you for answers

JDG


_______________________________________________
Dev mailing list
Dev at openlayers.org
http://openlayers.org/mailman/listinfo/dev




-- 
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/20090514/1ff58bf4/attachment.html


More information about the Dev mailing list