IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

IGN API Géoportail Discussion :

Problème d'ajout de couches


Sujet :

IGN API Géoportail

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Décembre 2010
    Messages
    13
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Décembre 2010
    Messages : 13
    Points : 11
    Points
    11
    Par défaut Problème d'ajout de couches
    Bonjour à tous,
    J'ai un problème qui ne doit pas être compliqué pour des personnes comme vous mais qui les suffisamment pour moi étant jeune développeur sur les SIG.
    J'utilise donc comme openLayer : Geoportail accouplé au framework mapFish.

    J'aimerais pouvoir rajouter une couche comme par exemple: " TOPONYMS.ALL "

    Voici mon code :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
     <script type="text/javascript">
        <!--
            // the viewer variable is declared by the API through the instance parameter
    
            // create namespace
            Ext.namespace('Geoportal');
    
            // create application
            Geoportal.app = function () {
                // private vars:
                var map, toolbarItems = [], viewport, vectorLayer;
    
                var epsg4326 = new OpenLayers.Projection("EPSG:4326");
                var IGNFGeo = new OpenLayers.Projection("IGNF:GEOPORTALFXX");
    
    
                // private functions
                var createMap = function () {
                    map = new OpenLayers.Map('viewerDiv', {
                        projection: "EPSG:4326",
                        resolutions: Geoportal.Catalogue.RESOLUTIONS.slice(0),
                        projection: IGNFGeo,
                        maxExtent: new OpenLayers.Bounds(-180, -57, 180, 72).transform(epsg4326, IGNFGeo, true),
                        units: IGNFGeo.getUnits(),
                        controls: [
                        new OpenLayers.Control.ScaleLine(),
                        new OpenLayers.Control.MousePosition(),
                        new OpenLayers.Control.KeyboardDefaults(),
                        new OpenLayers.Control.Attribution(),
                        new Geoportal.Control.PermanentLogo(),
                        new Geoportal.Control.TermsOfService()
                    ]
                    });
                };
    
                var createGeoportalLayer = function () {
                    var l0 = new Geoportal.Layer.WMSC(
                        OpenLayers.i18n('ORTHOIMAGERY.ORTHOPHOTOS'),
                        gGEOPORTALRIGHTSMANAGEMENT[gGEOPORTALRIGHTSMANAGEMENT.apiKey]
                              .resources['ORTHOIMAGERY.ORTHOPHOTOS:WMSC'].url,
                        {
                            layers: 'ORTHOIMAGERY.ORTHOPHOTOS',
                            format: 'image/jpeg',
                            exceptions: "text/xml"
                        },
                        {
                            gridOrigin: new OpenLayers.LonLat(0, 0),
                            isBaseLayer: true,
                            resolutions: Geoportal.Catalogue.RESOLUTIONS.slice(8, 18),
                            alwaysInRange: true,
                            opacity: 0.8,
                            projection: IGNFGeo,
                            maxExtent: new OpenLayers.Bounds(-180, -57, 180, 72).transform(epsg4326, IGNFGeo, true),
                            units: IGNFGeo.getUnits(),
                            attribution: 'provided by IGN',
                            GeoRM: Geoportal.GeoRMHandler.addKey(
                                 gGEOPORTALRIGHTSMANAGEMENT.apiKey,
                                 gGEOPORTALRIGHTSMANAGEMENT[gGEOPORTALRIGHTSMANAGEMENT.apiKey].tokenServer.url,
                                 gGEOPORTALRIGHTSMANAGEMENT[gGEOPORTALRIGHTSMANAGEMENT.apiKey].tokenServer.ttl,
                                 map)
                        }
                      );
                    map.addLayer(l0);
    
                };
    
    
    
    
    
                var createVectorLayer = function () {
                    vectorLayer = new OpenLayers.Layer.Vector("vector", {
                        displayInLayerSwitcher: true
                    });
                    map.addLayer(vectorLayer);
    
                    return vectorLayer;
                };
    
                var addMapControls = function () {
                    var navControl = new OpenLayers.Control.Navigation({
                        type: OpenLayers.Control.TYPE_TOGGLE,
                        zoomWheelEnabled: true
                    });
                    map.addControl(navControl);
                    navControl.activate();
                };
    
                var createViewport = function () {
                    viewport = new Ext.Viewport({
                        layout: 'border',
                        items: [
                        new Ext.BoxComponent({
                            region: 'north',
                            el: 'north',
                            height: 40,
                            margins: { left: 0, top: 0 }
                        }), {
                            region: 'west',
                            title: OpenLayers.i18n('gpControlLayerSwitcher.label'),
                            width: 200,
                            border: true,
                            margins: '5 0 0 5',
                            frame: false,
                            split: true,
                            layout: 'fit',
                            collapsible: true,
                            items: [{
                                xtype: 'layertree',
                                map: map,
                                border: false
                            }]
                        }, {
                            region: 'center',
                            layout: 'fit',
                            frame: false,
                            border: true,
                            margins: '5 5 0 0',
                            items: [{
                                xtype: 'mapcomponent',
                                map: map,
                                tbar: toolbarItems,
                                border: false
                            }]
                        }, new Ext.BoxComponent({
                            region: 'south',
                            el: 'south',
                            height: 40,
                            border: false
    
                        })
                    ]
                    });
                };
    
                var createToolbar = function () {
                    var action;
    
                    var createSeparator = function () {
                        toolbarItems.push(" ");
                        toolbarItems.push("-");
                        toolbarItems.push(" ");
                    };
    
                    action = new GeoExt.Action({
                        control: new OpenLayers.Control.ZoomToMaxExtent(),
                        map: map,
                        iconCls: 'zoomfull',
                        toggleGroup: 'map',
                        tooltip: 'Zoom minimal'
                    });
    
                    toolbarItems.push(action);
    
                    createSeparator();
    
                    action = new GeoExt.Action({
                        control: new OpenLayers.Control.ZoomBox(),
                        tooltip: 'Zoom supérieur',
                        map: map,
                        iconCls: 'zoomin',
                        toggleGroup: 'map'
                    });
    
                    toolbarItems.push(action);
    
                    action = new GeoExt.Action({
                        control: new OpenLayers.Control.ZoomBox({
                            out: true
                        }),
                        tooltip: 'Zoom inférieur',
                        map: map,
                        iconCls: 'zoomout',
                        toggleGroup: 'map'
                    });
    
                    toolbarItems.push(action);
    
                    action = new GeoExt.Action({
                        control: new OpenLayers.Control.DragPan({
                            isDefault: true
                        }),
                        tooltip: 'Déplacement',
                        map: map,
                        iconCls: 'pan',
                        toggleGroup: 'map'
                    });
    
                    toolbarItems.push(action);
    
                    createSeparator();
    
                    action = new GeoExt.Action({
                        control: new OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.Point),
                        tooltip: 'Déssiner un cercle',
                        map: map,
                        iconCls: 'drawpoint',
                        toggleGroup: 'map'
                    });
    
                    toolbarItems.push(action);
    
    
                    action = new GeoExt.Action({
                        control: new OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.Path),
                        tooltip: 'Déssiner une ligne sur la carte',
                        map: map,
                        iconCls: 'drawline',
                        toggleGroup: 'map'
                    });
    
                    toolbarItems.push(action);
    
                    action = new GeoExt.Action({
                        control: new OpenLayers.Control.DrawFeature(vectorLayer, OpenLayers.Handler.Polygon),
                        tooltip: 'Déssiner un polygon sur la carte',
                        map: map,
                        iconCls: 'drawpolygon',
                        toggleGroup: 'map'
                    });
    
                    toolbarItems.push(action);
    
                    createSeparator();
    
                    action = new GeoExt.Action({
                        text: "navigate",
                        map: map,
                        control: new OpenLayers.Control.Navigation(),
                        toggleGroup: "editing"
                    });
                    toolbarItems.push(action);
                    createSeparator();
    
    
                    action = new GeoExt.Action({
                        text: "Switch",
                        map: map,
                        control: new OpenLayers.Control.LayerSwitcher(),
                        toggleGroup: "switch"
                    });
                    toolbarItems.push(action);
    
                    createSeparator();
    
                    // Bar de zoom
                    action = new GeoExt.Action({
                        map: map,
                        control: new OpenLayers.Control.PanZoomBar()
                    });
    
    
                    // Affichage des graticules
                    action = new GeoExt.Action({
                        map: map,
                        control: new OpenLayers.Control.Graticule()
    
                    });
    
        
                       
               
                    ctrl = new OpenLayers.Control.NavigationHistory();
                    map.addControl(ctrl);
    
                };
    
                // public space:
                return {
                    // for debug, we make this property public:
                    vector: null,
    
                    init: function () {
                        var language = OpenLayers.Lang.getCode();
                        var re = new RegExp("^" + language);
                        var slct = OpenLayers.Util.getElement('gpChooseLang');
                        slct.onchange = function () {
                            OpenLayers.Lang.setCode(this.options[this.selectedIndex].value);
                            OpenLayers.Util.getElement('Taittinger GeoPortail').innerHTML = OpenLayers.i18n('Taittinger GeoPortail');
                            OpenLayers.Util.getElement('example_explain').innerHTML = OpenLayers.i18n('example_explain');
                            OpenLayers.Util.getElement('legal').innerHTML = OpenLayers.i18n('legal');
                            this.blur();
                        };
                        for (var i = 0; i < slct.options.length; i++) {
                            if (slct.options[i].value.match(re)) {
                                slct.options[i].selected = true;
                            }
                        }
    
                        Ext.QuickTips.init();
                        createMap();
                        createGeoportalLayer();
                        // createGeoportalLayer1();
                        this.vector = createVectorLayer();
                        // vector layer est accessible via Geoportal.app.vector
                        addMapControls();
                        createToolbar();
                        createViewport();
    
                        OpenLayers.Util.getElement('example_title').innerHTML = OpenLayers.i18n('GeoPortail');
                        OpenLayers.Util.getElement('example_explain').innerHTML = OpenLayers.i18n('titre');
                        OpenLayers.Util.getElement('legal').innerHTML = OpenLayers.i18n('legal');
                        map.setCenter(new OpenLayers.LonLat(4.02861, 49.2653).transform(epsg4326, IGNFGeo), 18);
    
                    }
                };
            } ();     // end of app
    
            
            Ext.onReady(Geoportal.app.init, Geoportal.app);
    
          -->
        </script>

    J'ai donc essayé de faire comme ce que j'ai pu faire pour "ORTHOIMAGERY.ORTHOPHOTOS" mais cela n'a pas fonctionné.

    Pourriez-vous m'indiquer un tuto ou m'aider sur ce sujet.

    Je vous remercie par avance.

    Cordialement.

    K.

  2. #2
    Expert confirmé
    Homme Profil pro
    Ingénieur cartographe
    Inscrit en
    Avril 2009
    Messages
    3 173
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Val de Marne (Île de France)

    Informations professionnelles :
    Activité : Ingénieur cartographe
    Secteur : Service public

    Informations forums :
    Inscription : Avril 2009
    Messages : 3 173
    Points : 4 224
    Points
    4 224
    Par défaut
    Citation Envoyé par n33dw33d Voir le message
    J'ai donc essayé de faire comme ce que j'ai pu faire pour "ORTHOIMAGERY.ORTHOPHOTOS" mais cela n'a pas fonctionné.
    C'est normal TOPONYMS.ALL n'est pas une couche (encore) affichable, mais une base de données pour le moteur de recherche. Cf.

Discussions similaires

  1. problème d'ajout et suppression de programmes
    Par ran_hery dans le forum Windows XP
    Réponses: 2
    Dernier message: 14/12/2005, 12h21
  2. Problème d'ajout de mois
    Par auriolbeach dans le forum Access
    Réponses: 5
    Dernier message: 02/10/2005, 22h22
  3. [Hibernate] Ajouter une couche multilangage supplémentaire
    Par KiLVaiDeN dans le forum Hibernate
    Réponses: 8
    Dernier message: 01/09/2005, 14h57
  4. Problème d'ajout d'imprimante sur LPT1
    Par arnaud_verlaine dans le forum Périphériques
    Réponses: 10
    Dernier message: 15/03/2005, 22h23
  5. Problème d'ajout multiples dans un BDD Access
    Par arnaud_verlaine dans le forum Langage SQL
    Réponses: 3
    Dernier message: 31/05/2004, 13h34

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo