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 :

Portlet Liferay. Problème de passage en 2.0


Sujet :

IGN API Géoportail

  1. #1
    Candidat au Club
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Octobre 2011
    Messages : 7
    Points : 4
    Points
    4
    Par défaut Portlet Liferay. Problème de passage en 2.0
    Bonjour,

    Pour situer le contexte, je travaille sur un portail qui tourne sur Liferay. Ce portail a été commandé et certains développements spécifiques ont été effectués, notamment pour créer des portlets avec du Geoportail.

    Un des portlets est chargé d'afficher directement la carte au chargement. Sur cette partie, aucun problème: la transition en 2.0 s'est bien déroulée.

    Par contre, je bloque sur un portlet un peu plus spécifique: il affiche une image représentant une carte du monde, et selon l'endroit cliqué la carte disparait pour faire place à l'interface géoportail. Lors de mes tentative d'upgrade de version, je me retrouve avec rien lorsque je clique sur la carte.

    Voici le code original pour le JS:
    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
    <%@ page contentType="text/html;charset=utf-8" %>
    <%@ include file="include.jsp" %>
    
    <liferay-util:html-top>
    <script type="text/javascript" src="http://api.ign.fr/geoportail/api?v=1.1-e&amp;key=${cleGeoportail}&amp;instance=VISU"></script>
    <script type="text/javascript">
    function afficheCarteDetail(zone)
    {
    	document.getElementById('carte_fixe').style.display='none';
    	if(geoportalLoadVISU)
    	{
    		geoportalLoadVISU("GeoportalVisuDiv", "normal");
    		if (VISU) 
    		{
    			VISU.addGeoportalLayers();
    			VISU.setSize(600,600);
    			var markers = new OpenLayers.Layer.Markers( "Stations");
    			VISU.getMap().addLayer(markers);
    			var size = new OpenLayers.Size(21,25);
    			var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
    			var wgs84 = OpenLayers.Projection.CRS84;
    			var mapProj = VISU.getMap().getProjection();
    			<c:forEach var="station" items="${stations}">
    			<c:if test="${station.longitude!=null && station.latitude!=null}">
    			var icon${station.idStation} = new OpenLayers.Icon('${context}/images/icone_station_${station.etat}.png', size, offset);
    			var marker${station.idStation} = new OpenLayers.Marker(new OpenLayers.LonLat(${station.longitude},${station.latitude}).transform(wgs84,mapProj),icon${station.idStation});
    			marker${station.idStation}.events.register("click",marker${station.idStation},function() {document.location='/${station.friendlyUrl}';});
    			markers.addMarker(marker${station.idStation});
    			</c:if>
    			</c:forEach>
    			if(zone=='FM')
    				VISU.getMap().setCenterAtLonLat(1.9,47, 4);
    			else if(zone=='SP')
    				VISU.getMap().setCenterAtLonLat(-56.32,47.85, 4);	
    			else if(zone=='AG')
    				VISU.getMap().setCenterAtLonLat(-61.5,11.03, 4);
    			else if(zone=='CL')
    				VISU.getMap().setCenterAtLonLat(-109.18,10.31, 4);
    			else if(zone=='PF')
    				VISU.getMap().setCenterAtLonLat(-149.566667,-17.533333, 3);
    			else if(zone=='OI')
    				VISU.getMap().setCenterAtLonLat(75.55,-26.67, 2);
    			else if(zone=='NC')
    				VISU.getMap().setCenterAtLonLat(166.45,-22.27, 4);
    			else if(zone=='WF')
    				VISU.getMap().setCenterAtLonLat(-176.17,-13.3, 4);
    			else if(zone=='AN')
    				VISU.getMap().setCenterAtLonLat(145.35,-57.10, 2);		
    		}
    	}
    }
    </script>
    </liferay-util:html-top>
    
    <div id="GeoportalVisuDiv" style="width:600px"></div>
    <img src="${context}/images/carte.png" style="width:600px" id="carte_fixe" usemap="#carte_fixe_map" alt="<spring:message code="carte-du-monde"/>">
    <map name="carte_fixe_map">
      <area shape="rect" coords="90,100,255,170" href="javascript:;" alt="Saint-Pierre et Miquelon" title="Saint-Pierre et Miquelon" onClick="afficheCarteDetail('SP');" />
      <area shape="rect" coords="270,135,460,160" href="javascript:;" alt="France Métropolitaine et Corse" title="France Métropolitaine et Corse" onClick="afficheCarteDetail('FM');" />
      <area shape="rect" coords="100,170,250,210" href="javascript:;" alt="Antilles et Guyanne" title="Antilles et Guyanne" onClick="afficheCarteDetail('AG');"/>
      <area shape="rect" coords="60,215,150,250" href="javascript:;" alt="Clipperton" title="Clipperton" onClick="afficheCarteDetail('CL');"/>
      <area shape="rect" coords="0,255,145,300" href="javascript:;" alt="Polynésie française" title="Polynésie française" onClick="afficheCarteDetail('PF');"/>  
      <area shape="rect" coords="345,274,450,315" href="javascript:;" alt="Océan indien" title="Océan indien" onClick="afficheCarteDetail('OI');"/>
      <area shape="rect" coords="455,245,600,295" href="javascript:;" alt="Nouvelle-Calédonie" title="Nouvelle-Calédonie" onClick="afficheCarteDetail('NC');"/>
      <area shape="rect" coords="455,300,600,315" href="javascript:;" alt="Wallis et Futuna" title="Wallis et Futuna" onClick="afficheCarteDetail('WF');"/>
      <area shape="rect" coords="495,355,600,405" href="javascript:;" alt="Antarctique" title="Antarctique" onClick="afficheCarteDetail('AN');"/>
    </map>
    J'ai essayé les deux méthodes de transition, mais rien n'y fait: je perds le "div" où doit se trouver le geoportail...

    Merci d'avance pour l'éventuelle aide que vous pourez m'apporter.

  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 Tlenglar Voir le message
    Voici le code original pour le JS
    On pourrait avoir le code porté en 2.0 car celui-là ne fonctionnera plus jamais ...

  3. #3
    Candidat au Club
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Octobre 2011
    Messages : 7
    Points : 4
    Points
    4
    Par défaut
    Alors, voilà le code de l'étape 2 de la procédure d'upgrade: déjà à cette étape je n'ai aucun affichage. Le "div width=600" est bien pris en compte, puisque la largeur du portlet reste la même. Ceci dit je perds toute la hauteur, et aucune carte ne s'affiche...
    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
    <%@ page contentType="text/html;charset=utf-8" %>
    <%@ include file="include.jsp" %>
    
    <liferay-util:html-top>
    
    <script type="text/javascript" src="http://api.ign.fr/geoportail/api?key=${cleGeoportail}&amp;"></script>
    
    <!-- v=2.0-e -->
        <script type="text/javascript" src="http://api.ign.fr/geoportail/api/js/2.0/GeoportalExtended.js" charset="utf-8">
        <!--//--><![CDATA[//><!--
        //--><!]]>
        </script>
    
    
    
    <script type="text/javascript"><!--//--><![CDATA[//><!--
    
    // la variable VIEWER n'est plus déclarée par l'API
        VISU= null;
    	
    	
    function afficheCarteDetail(zone)
    {
    	document.getElementById('carte_fixe').style.display='none';
    	if(geoportalLoadVISU)
    	{
    		geoportalLoadVISU("GeoportalVisuDiv", "normal");
    		if (VISU) 
    		{
    			VISU.addGeoportalLayers();
    			VISU.setSize(600,600);
    			var markers = new OpenLayers.Layer.Markers( "Stations");
    			VISU.getMap().addLayer(markers);
    			var size = new OpenLayers.Size(21,25);
    			var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
    			var wgs84 = OpenLayers.Projection.CRS84;
    			var mapProj = VISU.getMap().getProjection();
    			<c:forEach var="station" items="${stations}">
    			<c:if test="${station.longitude!=null && station.latitude!=null}">
    			var icon${station.idStation} = new OpenLayers.Icon('${context}/images/icone_station_${station.etat}.png', size, offset);
    			var marker${station.idStation} = new OpenLayers.Marker(new OpenLayers.LonLat(${station.longitude},${station.latitude}).transform(wgs84,mapProj),icon${station.idStation});
    			marker${station.idStation}.events.register("click",marker${station.idStation},function() {document.location='/${station.friendlyUrl}';});
    			markers.addMarker(marker${station.idStation});
    			</c:if>
    			</c:forEach>
    			if(zone=='FM')
    				VISU.getMap().setCenterAtLonLat(1.9,47, 4);
    			else if(zone=='SP')
    				VISU.getMap().setCenterAtLonLat(-56.32,47.85, 4);	
    			else if(zone=='AG')
    				VISU.getMap().setCenterAtLonLat(-61.5,11.03, 4);
    			else if(zone=='CL')
    				VISU.getMap().setCenterAtLonLat(-109.18,10.31, 4);
    			else if(zone=='PF')
    				VISU.getMap().setCenterAtLonLat(-149.566667,-17.533333, 3);
    			else if(zone=='OI')
    				VISU.getMap().setCenterAtLonLat(75.55,-26.67, 2);
    			else if(zone=='NC')
    				VISU.getMap().setCenterAtLonLat(166.45,-22.27, 4);
    			else if(zone=='WF')
    				VISU.getMap().setCenterAtLonLat(-176.17,-13.3, 4);
    			else if(zone=='AN')
    				VISU.getMap().setCenterAtLonLat(145.35,-57.10, 2);		
    		}
    	}
    }
    </script>
    
    <!-- DEFINIR geoportalLoadVISU : -->
        <script type="text/javascript"><!--//--><![CDATA[//><!--
        function geoportalLoadVISU(idDivMap, mode) {
            var options= {};
            if(mode) {options.mode= mode;}
            options.nameInstance= 'VISU';
            OpenLayers.Util.extend(options, gGEOPORTALRIGHTSMANAGEMENT || {});
            VISU= new Geoportal.Viewer.Default("GeoportalVisuDiv", "normal");
    
            return VISU;
        }
    
    //--><!]]></script>
    </liferay-util:html-top>
    
    <script type="text/javascript"><!--//--><![CDATA[//><!--
    window.onload = afficheCarteDetail('FM');
    //--><!]]></script>
    
    <div id="GeoportalVisuDiv" style="width:600px"></div>
    <img src="${context}/images/carte.png" style="width:600px" id="carte_fixe" usemap="#carte_fixe_map" alt="<spring:message code="carte-du-monde"/>">
    <map name="carte_fixe_map">
      <area shape="rect" coords="90,100,255,170" href="javascript:;" alt="Saint-Pierre et Miquelon" title="Saint-Pierre et Miquelon" onClick="afficheCarteDetail('SP');" />
      <area shape="rect" coords="270,135,460,160" href="javascript:;" alt="France Métropolitaine et Corse" title="France Métropolitaine et Corse" onClick="afficheCarteDetail('FM');" />
      <area shape="rect" coords="100,170,250,210" href="javascript:;" alt="Antilles et Guyanne" title="Antilles et Guyanne" onClick="afficheCarteDetail('AG');"/>
      <area shape="rect" coords="60,215,150,250" href="javascript:;" alt="Clipperton" title="Clipperton" onClick="afficheCarteDetail('CL');"/>
      <area shape="rect" coords="0,255,145,300" href="javascript:;" alt="Polynésie française" title="Polynésie française" onClick="afficheCarteDetail('PF');"/>  
      <area shape="rect" coords="345,274,450,315" href="javascript:;" alt="Océan indien" title="Océan indien" onClick="afficheCarteDetail('OI');"/>
      <area shape="rect" coords="455,245,600,295" href="javascript:;" alt="Nouvelle-Calédonie" title="Nouvelle-Calédonie" onClick="afficheCarteDetail('NC');"/>
      <area shape="rect" coords="455,300,600,315" href="javascript:;" alt="Wallis et Futuna" title="Wallis et Futuna" onClick="afficheCarteDetail('WF');"/>
      <area shape="rect" coords="495,355,600,405" href="javascript:;" alt="Antarctique" title="Antarctique" onClick="afficheCarteDetail('AN');"/>
    </map>

    En continuant jusqu'à l'étape 3, j'ai du mouvement: plus rien ne réagit. Le fait de cliquer sur une des zones géographiques n'a plus aucun effet...
    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
    <%@ page contentType="text/html;charset=utf-8" %>
    <%@ include file="include.jsp" %>
    
    <liferay-util:html-top>
    
    </liferay-util:html-top>
    
    <div id="GeoportalVisuDiv" style="width:600px"></div>
    <img src="${context}/images/carte.png" style="width:600px" id="carte_fixe" usemap="#carte_fixe_map" alt="<spring:message code="carte-du-monde"/>">
    <map name="carte_fixe_map">
      <area shape="rect" coords="90,100,255,170" href="javascript:;" alt="Saint-Pierre et Miquelon" title="Saint-Pierre et Miquelon" onClick="afficheCarteDetail('SP');" />
      <area shape="rect" coords="270,135,460,160" href="javascript:;" alt="France Métropolitaine et Corse" title="France Métropolitaine et Corse" onClick="afficheCarteDetail('FM');" />
      <area shape="rect" coords="100,170,250,210" href="javascript:;" alt="Antilles et Guyanne" title="Antilles et Guyanne" onClick="afficheCarteDetail('AG');"/>
      <area shape="rect" coords="60,215,150,250" href="javascript:;" alt="Clipperton" title="Clipperton" onClick="afficheCarteDetail('CL');"/>
      <area shape="rect" coords="0,255,145,300" href="javascript:;" alt="Polynésie française" title="Polynésie française" onClick="afficheCarteDetail('PF');"/>  
      <area shape="rect" coords="345,274,450,315" href="javascript:;" alt="Océan indien" title="Océan indien" onClick="afficheCarteDetail('OI');"/>
      <area shape="rect" coords="455,245,600,295" href="javascript:;" alt="Nouvelle-Calédonie" title="Nouvelle-Calédonie" onClick="afficheCarteDetail('NC');"/>
      <area shape="rect" coords="455,300,600,315" href="javascript:;" alt="Wallis et Futuna" title="Wallis et Futuna" onClick="afficheCarteDetail('WF');"/>
      <area shape="rect" coords="495,355,600,405" href="javascript:;" alt="Antarctique" title="Antarctique" onClick="afficheCarteDetail('AN');"/>
    </map>
    
    
    
    <!-- v=2.0-e -->
        <script type="text/javascript" src="http://api.ign.fr/geoportail/api/js/2.0/GeoportalExtended.js" charset="utf-8">
        <!--//--><![CDATA[//><!--
        //--><!]]>
        </script>
    
    <!-- DEFINIR le chargeur de contrat : -->
        <script type="text/javascript"><!--//--><![CDATA[//><!--
        if (window.__Geoportal$timer===undefined) {
            var __Geoportal$timer= null;
        }
    
        function checkApiLoading(retryClbk,clss) {
            if (__Geoportal$timer!=null) {
                //clearTimeout: annule le minuteur "__Geoportal$timer" avant sa fin
                window.clearTimeout(__Geoportal$timer);
                __Geoportal$timer= null;
            }
        
            /**
             * Il se peut que l'init soit exécuté avant que l'API ne soit chargée
             * Ajout d'un code temporisateur qui attend 300 ms avant de relancer l'init
             */
            var f;
            for (var i=0, l= clss.length; i<l; i++) {
                try {
                    f= eval(clss[i]);
                } catch (e) {
                    f= undefined;
                }
                if (typeof(f)==='undefined') {
                    __Geoportal$timer= window.setTimeout(retryClbk, 300);
                    return false;
                }
            }
            return true;
        }
    
        function loadAPI() {
            // on attend que les classes soient chargées
            if (checkApiLoading(loadAPI,['OpenLayers','Geoportal','Geoportal.Viewer','Geoportal.Viewer.Default'])===false) {
                return;
            }
    
            // on charge la configuration de la clef API, puis on charge l'application
            Geoportal.GeoRMHandler.getConfig([${cleGeoportail}], null, null, {
                onContractsComplete: afficheCarteDetail('FM')
            });
        }
        //--><!]]></script>
    
    <script type="text/javascript"><!--//--><![CDATA[//><!--
    
    // la variable VISU n'est plus déclarée par l'API
        VISU= null;
    	
    	
    function afficheCarteDetail(zone)
    {
    	document.getElementById('carte_fixe').style.display='none';
    	
    	VISU= new Geoportal.Viewer.Default(
    									"GeoportalVisuDivDetail",
    									OpenLayers.Util.extend({
    									mode:"normal"},
    									gGEOPORTALRIGHTSMANAGEMENT || {})
    									);
    									
    		if (VISU) 
    		{
    			VISU.addGeoportalLayers();
    			VISU.setSize(600,600);
    			var markers = new OpenLayers.Layer.Markers( "Stations");
    			VISU.getMap().addLayer(markers);
    			var size = new OpenLayers.Size(21,25);
    			var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
    			var wgs84 = OpenLayers.Projection.CRS84;
    			var mapProj = VISU.getMap().getProjection();
    			<c:forEach var="station" items="${stations}">
    			<c:if test="${station.longitude!=null && station.latitude!=null}">
    			var icon${station.idStation} = new OpenLayers.Icon('${context}/images/icone_station_${station.etat}.png', size, offset);
    			var marker${station.idStation} = new OpenLayers.Marker(new OpenLayers.LonLat(${station.longitude},${station.latitude}).transform(wgs84,mapProj),icon${station.idStation});
    			marker${station.idStation}.events.register("click",marker${station.idStation},function() {document.location='/${station.friendlyUrl}';});
    			markers.addMarker(marker${station.idStation});
    			</c:if>
    			</c:forEach>
    			if(zone=='FM')
    				VISU.getMap().setCenterAtLonLat(1.9,47, 4);
    			else if(zone=='SP')
    				VISU.getMap().setCenterAtLonLat(-56.32,47.85, 4);	
    			else if(zone=='AG')
    				VISU.getMap().setCenterAtLonLat(-61.5,11.03, 4);
    			else if(zone=='CL')
    				VISU.getMap().setCenterAtLonLat(-109.18,10.31, 4);
    			else if(zone=='PF')
    				VISU.getMap().setCenterAtLonLat(-149.566667,-17.533333, 3);
    			else if(zone=='OI')
    				VISU.getMap().setCenterAtLonLat(75.55,-26.67, 2);
    			else if(zone=='NC')
    				VISU.getMap().setCenterAtLonLat(166.45,-22.27, 4);
    			else if(zone=='WF')
    				VISU.getMap().setCenterAtLonLat(-176.17,-13.3, 4);
    			else if(zone=='AN')
    				VISU.getMap().setCenterAtLonLat(145.35,-57.10, 2);		
    		}
    	}
    }
    </script>
    
    <script type="text/javascript"><!--//--><![CDATA[//><!--
    window.onload = loadAPI;
    //--><!]]></script>

  4. #4
    Membre chevronné Avatar de gcebelieu
    Homme Profil pro
    Ingénieur Géographe et Cartographe
    Inscrit en
    Novembre 2010
    Messages
    1 106
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur Géographe et Cartographe
    Secteur : Service public

    Informations forums :
    Inscription : Novembre 2010
    Messages : 1 106
    Points : 1 843
    Points
    1 843
    Par défaut
    En premiere lecture du code, il apparait que vous créez un viewer associé à un identifiant de div : "GeoportalVisuDivDetail", alors que la div a un id='GeoportalVisuDiv'

  5. #5
    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
    et Le code du premier listing est très bizarre ...

    * ligne 88: comme l'indique gcebelieu la div de la carte a pour identifiant "GeoportalVisuDiv"

    * ligne 85: window.onload s'attend à une fonction et non à un appel d'une fonction qui ne retourne ... rien. Cette ligne devrait être :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    window.onload= function() {
        afficheCarteDetail('FM');
    };
    * ligne 71 : la fonction geoportalLoadVISU reçoit un paramètre idDivMap qui contient l'identifiant de la carte (Cf. ligne 27). La ligne 76 utilise explicitement "GeoportalVisuDiv" au lieu de idDivMap ...

    * ligne 6 : à détruire car la clef n'est jamais passée au chargeur Geoportal.GeoRMHandler.getConfig() ...

  6. #6
    Candidat au Club
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Octobre 2011
    Messages : 7
    Points : 4
    Points
    4
    Par défaut
    Merci pour vos réponses.
    Je teste ça et vous redis.

    En ce qui concerne le GeoportalVisuDiv, à force de faire des copier-coller, on rate des petites choses comme ça...

  7. #7
    Candidat au Club
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Octobre 2011
    Messages : 7
    Points : 4
    Points
    4
    Par défaut
    Bonjour,
    Après quelques tests et essais, j'ai corrigé certains problèmes, mais pas tous.
    En effet, j'ai à présent le cadre geoportail qui s'affiche correctement, mais il me manque les fonds de carte, ce qui est quand même un peu gênant...
    J'ai le même problème aussi bien sur mon serveur de test (qui utilise une clef de développement) que sur celui de prod (qui utilise une clef définitive).

    Je me demande du coup si le problème est lié au compte/clef ou si c'est un problème de codage.

    Vous pouvez voir un exemple à cette adresse.

    Sinon, voici le fichier javascript lié:
    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
    <div id="GeoportalVisuDivDetail" style="width:250px; height:300px"></div>
    
    <!-- v=2.0-e -->
         <script type="text/javascript" src="http://api.ign.fr/geoportail/api/js/2.0.0/GeoportalExtended.js" charset="utf-8">
        <!--//--><![CDATA[//><!--
        //--><!]]>
        </script>
    
    
    <!-- DEFINIR le chargeur de contrat : -->
        <script type="text/javascript"><!--//--><![CDATA[//><!--
        if (window.__Geoportal$timer===undefined) {
            var __Geoportal$timer= null;
        }
    
        function checkApiLoading(retryClbk,clss) {
            if (__Geoportal$timer!=null) {
                //clearTimeout: annule le minuteur "__Geoportal$timer" avant sa fin
                window.clearTimeout(__Geoportal$timer);
                __Geoportal$timer= null;
            }
        
            /**
             * Il se peut que l'init soit exécuté avant que l'API ne soit chargée
             * Ajout d'un code temporisateur qui attend 300 ms avant de relancer l'init
             */
            var f;
            for (var i=0, l= clss.length; i<l; i++) {
                try {
                    f= eval(clss[i]);
                } catch (e) {
                    f= undefined;
                }
                if (typeof(f)==='undefined') {
                    __Geoportal$timer= window.setTimeout(retryClbk, 300);
                    return false;
                }
            }
            return true;
        }
    
        function loadAPI() {
            // on attend que les classes soient chargées
            if (checkApiLoading(loadAPI,['OpenLayers','Geoportal','Geoportal.Viewer','Geoportal.Viewer.Default'])===false) {
                return;
            }
    
            // on charge la configuration de la clef API, puis on charge l'application
            Geoportal.GeoRMHandler.getConfig(['q0b753...fxaf1'], null, null, {
                onContractsComplete: initGeoportalMap
            });
        }
        //--><!]]></script>
        
    
    <script type="text/javascript"><!--//--><![CDATA[//><!--
    
    // la variable VIEWER n'est plus déclarée par l'API
        VISU= null;
    
    function initGeoportalMap()
    {
    	VISU= new Geoportal.Viewer.Default(
    									"GeoportalVisuDivDetail",
    									OpenLayers.Util.extend({
    									mode:"normal"},
    									gGEOPORTALRIGHTSMANAGEMENT || {})
    									);
    	if (VISU) 
    	{
    		VISU.addGeoportalLayers();
    		VISU.setSize(250,300);
    		VISU.setLayersPanelVisibility(false);
    		VISU.setToolsPanelVisibility(false);
    		var markers = new OpenLayers.Layer.Markers( "Stations");
    		VISU.getMap().addLayer(markers);
    		var size = new OpenLayers.Size(21,25);
    		var offset = new OpenLayers.Pixel(-(size.w/2), -size.h);
    		var wgs84 = OpenLayers.Projection.CRS84;
    		var mapProj = VISU.getMap().getProjection();
    		<c:forEach var="station" items="${stations}">
    		<c:if test="${station.longitude!=null && station.latitude!=null}">
    		var icon${station.idStation} = new OpenLayers.Icon('${context}/images/icone_station_${station.etat}.png', size, offset);
    		var marker${station.idStation} = new OpenLayers.Marker(new OpenLayers.LonLat(${station.longitude},${station.latitude}).transform(wgs84,mapProj),icon${station.idStation});
    		marker${station.idStation}.events.register("click",marker${station.idStation},function() {document.location='/${station.friendlyUrl}';});
    		markers.addMarker(marker${station.idStation});
    		</c:if>
    		</c:forEach>
    		<c:if test="${stationCourante.longitude!=null && stationCourante.latitude!=null}">
    		VISU.getMap().setCenterAtLonLat(${stationCourante.longitude},${stationCourante.latitude},12);
    		</c:if>
    	}
    }
    //--><!]]></script>
    
    <script type="text/javascript"><!--//--><![CDATA[//><!--
    window.onload = loadAPI;
    //--><!]]></script>

  8. #8
    Membre averti
    Femme Profil pro
    Consultante SIG
    Inscrit en
    Mars 2011
    Messages
    233
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Consultante SIG

    Informations forums :
    Inscription : Mars 2011
    Messages : 233
    Points : 356
    Points
    356
    Par défaut
    Bonjour,
    Votre clé est expirée depuis le 01/10/2012.
    J'ai fait une demande de prolongation auprès du service concerné.
    Je vous tiens au courant dès que c'est fait.

  9. #9
    Membre averti
    Femme Profil pro
    Consultante SIG
    Inscrit en
    Mars 2011
    Messages
    233
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Paris (Île de France)

    Informations professionnelles :
    Activité : Consultante SIG

    Informations forums :
    Inscription : Mars 2011
    Messages : 233
    Points : 356
    Points
    356
    Par défaut
    c'est fait!
    La clé est valable jusqu'au 01/10/2013.

  10. #10
    Candidat au Club
    Homme Profil pro
    Inscrit en
    Octobre 2011
    Messages
    7
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations forums :
    Inscription : Octobre 2011
    Messages : 7
    Points : 4
    Points
    4
    Par défaut
    Parfait!
    Merci beaucoup.

Discussions similaires

  1. [template] problème de passage de paramètres
    Par vinny_the_true dans le forum C++
    Réponses: 2
    Dernier message: 14/12/2005, 01h15
  2. [FLASH MX] Problème de passage de variable
    Par mandaillou dans le forum Flash
    Réponses: 2
    Dernier message: 15/11/2005, 10h22
  3. Réponses: 9
    Dernier message: 13/05/2005, 03h13
  4. problème de passage de paramêtre sous mozilla
    Par mat10000 dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 27/09/2004, 10h48
  5. problème de passage de texte avec getvariable
    Par VincentB dans le forum Flash
    Réponses: 2
    Dernier message: 12/01/2004, 18h35

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